Expand description
Initialize the value of all flags based on arguments from the command line at runtime.
This function must be called before accessing the values of any flags. After
this function has been called, the values of flags are available in the
.FLAG
field of each flag.
The return vector contains everything on the command line which is not a flag. These are sometimes called positional arguments.
Examples
If we execute the following program with command line ./my_program a b c
then nothing is printed because --print-args
is not set. If we execute it
with ./my_program --print-args a b c
then the positional arguments a
b
c
are printed.
gflags::define! {
--print-args = false
}
fn main() {
let args = gflags::parse();
if print_args.FLAG {
println!("args = {:?}", args);
}
}