Function gflags::parse_os

source ·
pub fn parse_os() -> Vec<&'static OsStr>
Expand description

Initialize the value of all flags, accepting non-UTF8 positional arguments.

Equivalent to gflags::parse in all ways except that non-UTF8 positional arguments are not an error. Note that non-UTF8 flag values are allowed even by gflags::parse.

Examples found in repository?
src/parse.rs (line 55)
47
48
49
50
51
52
53
54
55
56
pub fn parse() -> Vec<&'static str> {
    fn to_str_or_abort(os_str: &OsStr) -> &str {
        os_str.to_str().unwrap_or_else(|| {
            eprintln!("Unsupported non-UTF8 command line argument");
            process::exit(1);
        })
    }

    parse_os().into_iter().map(to_str_or_abort).collect()
}