-
Here's my code. #[derive(Parser)]
#[command(subcommand_precedence_over_arg = true)]
pub struct Cli {
#[arg(global = true)]
pub input: Option<Vec<String>>,
#[command(subcommand)]
pub command: Option<Commands>,
}
#[derive(Subcommand)]
pub enum Commands {
Add,
} If I enter following commands, $ prog a add b I want to get |
Beta Was this translation helpful? Give feedback.
Answered by
epage
Jul 22, 2024
Replies: 1 comment
-
You can workaroudn this by not using |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
rvnkcode
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
global
s are not merged between invocations at this time. There would be issues with knowing the user and programmers intent and responding the right way. I wonder if we should conflict in this case...You can workaroudn this by not using
global
but instead specifyinginput
in each subcommand and merging them yourself.