T'interwebs, I'm confused. I'm writing a program to learn Rust, and the argument parser is behaving oddly. I give it one argument, and it acts as though I've given it another. Please can someone point out the bit where I've been stupid? gist.github.com/arafel/2d65e… cc @dsilverstone
1
I'm afraid I've lost the knack to read clap parser chains. I use the derive approach where you define your CLI as structs and enums
3
Though what it looks like is that your `update` argument has the value `search` which is kinda expected - it looks to me like you intended `update` and `search` to be subcommands of `groups` no?
1
I did, but I was expecting β€œupdate” to be Boolean, ie if the flag is present the value is true, no arguments or anything. search takes an argument (what to search for), update doesn’t. Did I get that wrong?
1
Good psychic debugging, that seems to fix it. Thanks! So far I've found if stuff gets past rustc then it mostly works, so that one threw me a bit. :-) Enjoying Rust as a whole though.
1
Replying to @arafel2
Sadly if the semantics of something are valid but not what you wanted, rustc won't catch it :D

Apr 23, 2022 Β· 9:13 PM UTC