[][src]Crate windows_args

windows-args

A command-line argument parser for Windows, copied almost wholesale from the rust standard library.

Offerings include:

  • Args and ArgsOs, iterators that produce String and OsString values respectively.
  • Two parsing functions, Args::parse_cmd and Args::parse_args.
    • These differ in how they parse the first argument, and in how they treat empty input.

Due to limitations of the current implementation, this crate currently can only be used on Windows.

use windows_args::Args;

// to parse a complete command (beginning with an executable name)
let mut args = Args::parse_cmd(r#"foobar.exe to "C:\Program Files\Hi.txt" now"#);

// to parse arguments to a command (NOT beginning with an executable name)
let mut args = Args::parse_args(r#"foobar to "C:\Program Files\Hi.txt" now"#);

assert_eq!(args.next(), Some("foobar".to_string()));
assert_eq!(args.next(), Some("to".to_string()));
assert_eq!(args.next(), Some("C:\\Program Files\\Hi.txt".to_string()));
assert_eq!(args.next(), Some("now".to_string()));
assert_eq!(args.next(), None);

Structs

Args

An iterator over the arguments of a process, yielding a String value for each argument.

ArgsOs

An iterator over the arguments of a process, yielding an OsString value for each argument.