Argument parser and flags in rust is my rust file
The command to pass to run stat on data.csv is:

./stat --min data.csv

which gives minimum value from all columns.

ap.refer(&mut average)
        .add_option(&["--mean", "--average"], Store, "average");

I declared it like this and stored data.csv file itself as value for flag --min inorder to access that file because I dont know how to give flag which doesn't need a value.
So,could you please help me in this type of argument.

What are you using for parsing arguments?

You can also do it directly:

let args: Vec<String> = std::env::args().collect();
let flag = args.contains(&String::from("--flag"));

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.