Crate komichi

Source
Expand description

§小道 Komichi

komichi is a collection of tools to make working with file-system paths more convenient.

§Features, include but are not limited to:

  • Uses camino paths so that an application, using this crate, can treat paths like normal Rust string-like types.
  • EnvVal provides the ability to retrieve environment variable values and use a default value if the environment variable does NOT exist or have a value.
  • Expand provides a relatively-fast ability to expand unicode-paths that:
    • may contain BASH-like variables; and
    • may start with a tilde; and
    • may not be absolute.
  • Local can provide application local ($HOME) path directory locations for:
    • cache files
    • config files
    • data files
    • log files
    • state files

Modules§

error
Komichi errors.
util
Utilities.

Structs§

EnvVal
Used to acquire an environment variable value with a fallback value.
Expand
Expand identifiers in paths.
Local
Return path locations for a given application name from a local perspective.

Functions§

expand_cwd
Prepend the current working directory (“CWD”) to the given path.
expand_environment_identifiers
Expand any environment variables in the given path
expand_strict_with
Strictly expand the given path with the given function/callback.
expand_tilde
Expand a starting tilde in the given path to the home directory.
expand_with
Expand the given path with the given function/callback.
get_cwd
Return the current user’s current working directory (“CWD”) as a Utf8PathBuf.
get_home
Return the current user’s home directory as a Utf8PathBuf.
get_local_application_paths
Return a Local struct that has functions to get various local application paths for the given application name.
normalize
Return the given path with all its intermediate components normalized, without performing I/O.
scrub
Replace the user’s home directory, in the given path, with a tilde.
use_cwd
Return the given path or the current user’s current working directory (“CWD”) as a Utf8PathBuf.
use_home
Return the given home directory or the current user’s home directory as a Utf8PathBuf.
utf8_path_buf
Convert the given path into a Utf8PathBuf.