Skip to main content

Crate uucore

Crate uucore 

Source
Expand description

library ~ (core/bundler file)

Re-exports§

pub extern crate libc;

Modules§

clap_localization
Helper clap functions to localize error handling and options
display
Utilities for printing paths, with special attention paid to special characters and invalid unicode.
error
All utils return exit with an exit code. Usually, the following scheme is used:
line_ending
Provides consistent newline/zero terminator handling for -z/--zero flags.
locale
os
Test if the program is running under WSL ref: https://github.com/microsoft/WSL/issues/4555 @@ https://archive.is/dP0bz
panic
Custom panic hooks that allow silencing certain types of errors.
posix
Iterate over lines, including the line ending character(s).
safe_traversal
signals
This module provides a way to handle signals in a platform-independent way. It provides a way to convert signal names to their corresponding values and vice versa. It also provides a way to ignore the SIGINT signal and enable pipe errors.
systemd_logind
Systemd-logind support for reading login records
time
Set of functions related to time handling
utmpx
Aims to provide platform-independent methods to obtain login records

Macros§

bin
Execute utility code for util.
crate_version
Generate the version string for clap.
init_startup_state_capture
Initializes startup state capture. Call once at crate root level.
prompt_yes
Prompt the user with a formatted string and returns true if they reply 'y' or 'Y'
show
Display a crate::error::UError and set global exit code.
show_error
Show an error to stderr in a similar style to GNU coreutils.
show_if_err
Display an error and set global exit code in error case.
show_warning
Print a warning message to stderr.
show_warning_caps
Print a warning message to stderr, prepending the utility name.
translate
Macro for retrieving localized messages with optional arguments.
uio_error
Shorthand to construct UIoError-instances.

Structs§

CharByteIterator
Iterates on the valid and invalid parts of a byte sequence with regard to the UTF-8 encoding.
NonUtf8OsStrError

Enums§

CharByte
Represent either a character or a byte. Used to iterate on partially valid UTF-8 data

Traits§

Args
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.
IntoCharByteIterator

Functions§

args_os
Returns an iterator over the command line arguments as OsStrings. args_os() can be expensive to call
args_os_filtered
Returns an iterator over the command line arguments as OsStrings, filtering out empty arguments. This is useful for handling cases where extra whitespace or empty arguments are present. args_os_filtered() can be expensive to call
disable_rust_signal_handlers
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.
execution_phrase
Derive the complete execution phrase for “usage”.
format_usage
Generate the usage string for clap.
get_canonical_util_name
get_utility_is_second_arg
Used to check if the utility is the second argument. Used to check if we were called as a multicall binary (coreutils <utility>)
localized_help_template
Creates a localized help template for clap commands.
localized_help_template_with_colors
Create a localized help template with explicit color control This ensures color detection consistency between clap and our template
os_str_as_bytes
Converts an OsStr to a UTF-8 &[u8].
os_str_as_bytes_lossy
Performs a potentially lossy conversion from OsStr to UTF-8 bytes.
os_str_from_bytes
Converts a &[u8] to an &OsStr, or parses it as UTF-8 into an OsString on non-unix platforms.
os_string_from_vec
Converts a Vec<u8> into an OsString, parsing as UTF-8 on non-unix platforms.
os_string_to_vec
Converts an OsString into a Vec<u8>, parsing as UTF-8 on non-unix platforms.
read_byte_lines
Equivalent to std::BufRead::lines which outputs each line as a Vec<u8>, which avoids panicking on non UTF-8 input.
read_os_string_lines
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_yes
Read a line from stdin and check whether the first character is 'y' or 'Y'
set_utility_is_second_arg
Change the value of UTILITY_IS_SECOND_ARG to true Used to specify that the utility is the second argument.
util_name
Derive the utility name.

Attribute Macros§

main
A procedural macro to define the main function of a uutils binary.