You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create a program that's supposed to work like this:
$ ./app copy "some text"
$ ./app paste
some text
The paste subcommand is not supposed to take any arguments. But I can't figure out from the docs whether it is possible.
I tried something like this:
// ...#[derive(FromArgs,PartialEq,Debug)]#[argh(subcommand)]enumSubcommand{Copy(SubcommandCopy),Paste(SubcommandPaste),}// ....#[derive(FromArgs,PartialEq,Debug)]/// Second subcommand.#[argh(subcommand)]structSubcommandPaste{};
But this doesn't work because SubcommandPaste cannot be an empty or unit struct.
Any pointers are appreciated. Thank you.
The text was updated successfully, but these errors were encountered:
use argh::FromArgs;#[derive(FromArgs,PartialEq,Debug)]/// Top-level command.pubstructArgs{#[argh(subcommand)]pubnested:Subcommand,}#[derive(FromArgs,PartialEq,Debug)]#[argh(subcommand)]pubenumSubcommand{Copy(SubcommandCopy),Paste(SubcommandPaste),}#[derive(FromArgs,PartialEq,Debug)]/// copy command#[argh(subcommand, name = "copy")]pubstructSubcommandCopy{#[argh(positional)]/// the text to be storedpubinput:String,}#[derive(FromArgs,PartialEq,Debug)]#[argh(subcommand, name = "paste")]/// paste commandpubstructSubcommandPaste{}
I am trying to create a program that's supposed to work like this:
The paste subcommand is not supposed to take any arguments. But I can't figure out from the docs whether it is possible.
I tried something like this:
But this doesn't work because SubcommandPaste cannot be an empty or unit struct.
Any pointers are appreciated. Thank you.
The text was updated successfully, but these errors were encountered: