mirror of
https://github.com/Start9Labs/rpc-toolkit.git
synced 2026-03-26 02:11:56 +00:00
parse for stdin
This commit is contained in:
@@ -497,9 +497,15 @@ fn cli_handler(
|
||||
let arg_name = LitStr::new(&name.to_string(), name.span());
|
||||
let field_name = Ident::new(&format!("arg_{}", name), name.span());
|
||||
if arg.stdin.is_some() {
|
||||
if let Some(parse) = &arg.parse {
|
||||
quote! {
|
||||
#field_name: #parse(&mut std::io::stdin(), matches)?,
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
#field_name: rpc_toolkit_prelude::default_stdin_parser(&mut std::io::stdin(), matches)?,
|
||||
}
|
||||
}
|
||||
} else if arg.check_is_present {
|
||||
quote! {
|
||||
#field_name: matches.is_present(#arg_name),
|
||||
|
||||
Reference in New Issue
Block a user