Module util

Source
Expand description

§Common utilities

Common utilities and structs used within the ACORN library

Modules§

cli
Command line interface (CLI) utilities

Structs§

Constant
Struct for using and sharing constants
Label
Struct for using and sharing colorized logging labels
SemanticVersion
Semantic version
SemanticVersionBuilder
Use builder syntax to set the inputs and finish with build().

Enums§

MimeType
MIME types
ProgrammingLanguage
Programming languages

Functions§

checksum
Get SHA256 hash of a file
command_exists
Checks if a given command exists in current terminal context.
download_binary
Downloads a binary file from the given URL to the destination path.
extension
Get file extension
files_all
Returns a vector of PathBuf containing all files in a directory that match the given extension and do not match the ignore pattern.
files_from_git_branch
Returns a vector of PathBuf containing all files changed in the given Git branch relative to the default branch.
files_from_git_commit
Returns a vector of PathBuf containing all files changed in the given Git commit.
generate_guid
Generates a random GUID using a custom alphabet.
git_branch_name
Returns the current Git branch name if the git command is available and executed successfully.
git_default_branch_name
Returns the default Git branch name if the git command is available and executed successfully.
image_paths
Returns a vector of PathBuf representing paths to all images found in the given directory and all of its subdirectories.
make_executable
Makes the given file executable.
parent
Returns the parent directory of the given path.
path_to_string
Converts a PathBuf into a String representation of the absolute path.
pretty_print
Prints text to stdout using syntax highlighting for the specified syntax.
print_changes
Prints a diff of changes between two strings.
print_values_as_table
Prints the given values as a table.
read_file
Reads the given file and returns its contents as a string.
standard_project_folder
Returns path to a folder in the operating system’s cache directory that is unique to the given namespace with a random UUID as the name of the final folder.
suffix
Returns “s” if the given value is not 1, otherwise returns an empty string.
text_diff_changes
Computes the differences between two strings line by line and returns a vector of changes.
to_string
Convert a vector of string slices to a vector of strings
tokio_runtime
Create a new Tokio runtime
write_file
Writes the given content to a file at the given path.