Crate wild

source ·
Expand description

Emulates glob (wildcard) argument expansion on Windows. No-op on other platforms.

Unix shells expand command-line arguments like a*, file.??? and pass them expanded to applications. On Windows cmd.exe doesn’t do that, so this crate emulates the expansion there. Instead of std::env::args() use wild::args().

The glob syntax on Windows is limited to *, ?, and [a-z]/[!a-z] ranges. Glob characters in quotes ("*") are not expanded.

Parsing of quoted arguments precisely follows Windows native syntax (CommandLineToArgvW, specifically) with all its weirdness.

§Usage

Use wild::args() instead of std::env::args() (or wild::args_os() instead of std::env::args_os()).

If you use Clap, use .get_matches_from(wild::args_os()) instead of .get_matches().

Functions§

  • Returns an iterator of glob-expanded command-line arguments. Equivalent of std::env::args().

Type Aliases§

  • Iterator of arguments. Equivalent to std::env::Args. See args for details.
  • Same as Args, but keeps invalid Unicode intact.