Expand description
Utility functions for click-rs.
This module provides utility functions for path handling, stream access, environment queries, and other common operations needed by CLI applications.
§Reference
Based on Python Click’s utils.py.
Functions§
- expand_
args - Expand glob patterns in arguments.
- expand_
path - Expand a path by resolving
~and environment variables. - format_
filename - Format a path for user-friendly display.
- get_
app_ dir - Get the platform-specific application directory.
- get_
binary_ stdin - Get a binary stdin reader.
- get_
binary_ stdout - Get a binary stdout writer.
- get_
extension - Get the file extension from a path, if any.
- get_
os_ args - Get the command-line arguments.
- get_
os_ args_ skip_ program - Get the command-line arguments without the program name.
- get_
terminal_ width - Get the terminal width.
- get_
text_ stderr - Get a text stderr writer.
- get_
text_ stdout - Get a text stdout writer.
- home_
dir - Get the user’s home directory.
- is_tty
- Check if the output stream is a terminal/TTY.
- join_
with_ conjunction - Join items with a separator and a final conjunction.
- make_
safe_ filename - Make a filename safe by removing or replacing problematic characters.
- pluralize
- Pluralize a word based on a count.
- safecall
- Safely encode a string for terminal output.
- should_
strip_ ansi - Check if ANSI escape codes should be stripped from output.
- split_
arg_ string - Parse a string like a shell would: handle quotes, escapes, and whitespace.
- strip_
extension - Strip the file extension from a path.