-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default subcommand #57
Comments
this is a valid way to do this i think: #[derive(FromArgs, PartialEq, Debug)]
/// Top-level command.
struct TopLevel {
#[argh(subcommand)]
nested: Option<Sub>,
} you can just do an |
@mraerino I don't think this would work. If subcommand doesn't match (i.e.: default should be used) then your code will lose all arguments. |
True. You wouldn't be able to use args on your default command. But global args still work. |
FWIW, I did. I was adding subcommands to an existing tool, and wanted one subcommand to be the default so that the tool would function as it did before if no subcommand was given. Its arguments shouldn't be valid for other subcommands, though. |
Is it possible to make a default subcommand with
argh
? I want something like this:With
cmd one ...
resulting inSub::One(..)
cmd two ...
resulting inSub::Two(..)
cmd ...
resulting inSub::One(..)
(the default)The text was updated successfully, but these errors were encountered: