pub(crate) fn split_os_argument(
input: &OsStr,
) -> Option<(ArgType, String, Option<Arg>)>Expand description
split OsString into argument specific bits
takes a possibly non-utf8 string looking like “–name=value” and splits it into bits: “–” - type, “name” - name, must be representable as utf8, “=” - optional, “value” - flag
dashes and equals sign are low codepoint values and - can look for them literally in a string. This probably means not supporting dashes with diacritics, but that’s okay
name must be valid utf8 after conversion and must not include =
argument is optional and can be non valid utf8.
The idea is to split the OsString into opaque parts by looking only at the parts simple parts
and let stdlib to handle the decoding of those parts.
performance wise this (at least on unix) works some small number percentage slower than the previous version
Notation -fbar is ambigous and could mean either -f -b -a -r or -f=bar, resolve it into
[Arg::Ambiguity] and let subparser disambiguate it later depending on available short flag and
arguments