These are chat archives for kbknapp/clap-rs

20th
Apr 2018
Alexey
@KalitaAlexey
Apr 20 2018 11:46
Can I have an argument which possible values depend on the value of other argument?
Like if I enter "build" then I have to enter either "one" or "two", but if I enter "run" then I have to enter either "one" or "three".
xliiv
@xliiv
Apr 20 2018 12:04
any way of dealing required ref as fn argument when i can't gwaranteed its corectness, like here:
https://play.rust-lang.org/?gist=67b3225a22beecc32c33f6fcbd45b1b9&version=stable
i've got Arg::with_name(name) but name is calcuated as String which doesn't live long enough
i mean name.as_ref() doesn't live long engouh
Kevin K.
@kbknapp
Apr 20 2018 13:14
@KalitaAlexey not currently. There are some ways to make it happen, but it's not built in
if you can share a gist of what you'd like to happen, there may also be alternative ways to design the CLI to a similar outcome
Kevin K.
@kbknapp
Apr 20 2018 13:21
@xliiv the problem is because you want to return the Arg from a function
where the name outlives the Arg
however, what most people do is have a fn return an App and not an Arg as having individual fn's for Args could be tedious
xliiv
@xliiv
Apr 20 2018 13:23
@kbknapp thanks, i'll give it a try