Crate uucore

Source
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/--zero flags.
  • 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. ShortcutValueParser is similar to clap’s PossibleValuesParser

Macros§

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 a Vec<String>. The collected Vec<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 OsString from a byte field It converts Vec<u8> to OsString for unix targets only. On non-unix (i.e. Windows) it may fail if the bytes are not valid UTF-8
  • Equivalent to std::BufRead::lines which outputs each line as a Vec<u8>, which avoids panicking on non UTF-8 input.
  • Equivalent to std::BufRead::lines which outputs each line as an OsString This 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_ARG to 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.