Expand description
library ~ (core/bundler file)
Modules§
- Utilities for printing paths, with special attention paid to special characters and invalid unicode.
- All utils return exit with an exit code. Usually, the following scheme is used:
- Encapsulates differences between OSs regarding the access to file handles / descriptors. This is useful when dealing with lower level stdin/stdout access.
- Provides consistent newline/zero terminator handling for
-z/--zeroflags. - Test if the program is running under WSL ref: https://github.com/microsoft/WSL/issues/4555 @@ https://archive.is/dP0bz
- Custom panic hooks that allow silencing certain types of errors.
- Parsing a glob Pattern from a string.
- Parser for sizes in SI or IEC units (multiples of 1000 or 1024 bytes).
- Parsing a duration from a string.
- Iterate over lines, including the line ending character(s).
- A parser that accepts shortcuts for values.
ShortcutValueParseris similar to clap’sPossibleValuesParser
Macros§
- Execute utility code for
util. - Display an error and
std::process::exit - Unwrap a
std::result::Result, crashing instead of panicking. - Get the about text from the help file.
- Reads a section from a file of the util as a
strliteral. - Get the usage from the help file.
- Prompt the user with a formatted string and returns
trueif they reply'y'or'Y' - Display a
crate::error::UErrorand set global exit code. - Show an error to stderr in a similar style to GNU coreutils.
- Display an error and set global exit code in error case.
- Print a warning message to stderr.
- Print a warning message to stderr, prepending the utility name.
- Shorthand to construct
UIoError-instances.
Traits§
- Args contains arguments passed to the utility. It is a trait that extends
Iterator<Item = OsString>. It provides utility functions to collect the arguments into aVec<String>. The collectedVec<String>can be lossy or ignore invalid encoding.
Functions§
- Returns an iterator over the command line arguments as
OsStrings. args_os() can be expensive to call - Disables the custom signal handlers installed by Rust for stack-overflow handling. With those custom signal handlers processes ignore the first SIGBUS and SIGSEGV signal they receive. See https://github.com/rust-lang/rust/blob/8ac1525e091d3db28e67adcbbd6db1e1deaa37fb/src/libstd/sys/unix/stack_overflow.rs#L71-L92 for details.
- Derive the complete execution phrase for “usage”.
- Generate the usage string for clap.
- Used to check if the utility is the second argument. Used to check if we were called as a multicall binary (
coreutils <utility>) - Helper function for processing delimiter values (which could be non UTF-8) It converts OsString to &u8 for unix targets only On non-unix (i.e. Windows) it will just return an error if delimiter value is not UTF-8
- Helper function for converting a slice of bytes into an &OsStr or OsString in non-unix targets.
- Helper function for making an
OsStringfrom a byte field It convertsVec<u8>toOsStringfor unix targets only. On non-unix (i.e. Windows) it may fail if the bytes are not valid UTF-8 - Equivalent to
std::BufRead::lineswhich outputs each line as aVec<u8>, which avoids panicking on non UTF-8 input. - Equivalent to
std::BufRead::lineswhich outputs each line as anOsStringThis won’t panic on non UTF-8 characters on Unix, but it still will on Windows. - Read a line from stdin and check whether the first character is
'y'or'Y' - Change the value of
UTILITY_IS_SECOND_ARGto true Used to specify that the utility is the second argument. - Derive the utility name.
Attribute Macros§
- A procedural macro to define the main function of a uutils binary.