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
So I was playing around with clap for the first time and started going straight for subcommands with 1 required argument and multiple optional arguments. well every single time I tried a optional argument I would always get:
error: unexpected argument '--arg' found
and assumed that was a generic clap response for a argument not found.
which made me assume I was doing something wrong, so I went through all the docs I could find, trying different things / altering other example to my needs. Everything I tried failed.
So after about 5 hours of trying to get clap to work and seeing many examples of people running cargo with:
cargo run -- Program
I decided to change the default run command in RustRover :
run --package Program --bin Program
which I always changed to:
run --package Program --bin Program subcommand required --arg val
To this:
run -- Program subcommand required --arg val
....5 hours
So I guess since the default command was using optional -- arguments it made cargo think my arguments were its.
So anyone using RustRover might want to consider changing the default run command.
anyway I thought I would give a heads up for anyone that wants to listen to my rant.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
So I was playing around with clap for the first time and started going straight for subcommands with 1 required argument and multiple optional arguments. well every single time I tried a optional argument I would always get:
error: unexpected argument '--arg' found
and assumed that was a generic clap response for a argument not found.
which made me assume I was doing something wrong, so I went through all the docs I could find, trying different things / altering other example to my needs. Everything I tried failed.
So after about 5 hours of trying to get clap to work and seeing many examples of people running cargo with:
cargo run -- Program
I decided to change the default run command in RustRover :
run --package Program --bin Program
which I always changed to:
run --package Program --bin Program subcommand required --arg val
To this:
run -- Program subcommand required --arg val
....5 hours
So I guess since the default command was using optional
--
arguments it made cargo think my arguments were its.So anyone using RustRover might want to consider changing the default run command.
anyway I thought I would give a heads up for anyone that wants to listen to my rant.
Beta Was this translation helpful? Give feedback.
All reactions