Arg

Arg

An OS-aware representation of a command-line argument.

Though we tend to think of args as Unicode strings, most operating systems represent command-line arguments as lists of bytes that aren't necessarily UTF-8 encoded. Windows doesn't even use bytes, but U16s.

Most of the time, you will pass these to packages and they will handle the encoding for you, but for quick-and-dirty code you can use display to convert these to Str in a lossy way.

to_os_raw : Arg -> [ Unix (List U8), Windows (List U16) ]

Unwrap an Arg into a raw, OS-aware numeric list.

This is a good way to pass Args to Roc packages.

from_os_raw : [ Unix (List U8), Windows (List U16) ] -> Arg

Wrap a raw, OS-aware numeric list into an Arg.

display : Arg -> Str

Convert an Arg to a Str for display purposes.

NB: this will currently crash if there is invalid utf8 bytes, in future this will be lossy and replace any invalid bytes with the Unicode Replacement Character U+FFFD �