Expand description
Provides various utility functions and extension traits for common tasks.
This module contains general-purpose helpers that don’t fit neatly into other domain-specific modules. This includes functions for string manipulation, as well as potentially other reusable components or patterns.
Structs§
- Fuzzy
Term - Represents an individual search term and its associated matching semantics
- Shell
Info - Split
Captures - An iterator that splits a text string based on a regular expression, yielding both the substrings that don’t match
the regex and the
Captures
objects for the parts that do match.
Enums§
- Fuzzy
Match - Represents a component of a fuzzy search query.
- Fuzzy
Term Kind - Defines the different kinds of matching strategies for a
FuzzyTerm
. - Shell
Type - Split
Item - Represents an item yielded by the SplitCaptures iterator.
Statics§
- COMMAND_
VARIABLE_ REGEX - Regex to match variables from a command, with a capturing group for the name
- COMMAND_
VARIABLE_ REGEX_ ALT - Regex to match variables from a command, with two capturing groups for the name
- COMMAND_
VARIABLE_ REGEX_ QUOTES - Regex to match variables from a command, with a capturing group for the name.
Functions§
- convert_
alt_ to_ regular - Converts alternative variable syntax
<var>
to the regular{{var}}
syntax - execute_
shell_ command_ capture - Executes a shell command, capturing
stdout
andstderr
. - execute_
shell_ command_ inherit - Executes a shell command, inheriting the parent’s
stdout
andstderr
- extract_
tags_ and_ cleaned_ text - Extracts hashtags from a string and returns them along with the cleaned text.
- extract_
tags_ from_ description - Extracts hashtags from a description string
- extract_
tags_ with_ editing_ and_ cleaned_ text - Extracts hashtags from a string and returns the tag where the cursor is placed, other tags found on the text and the cleaned text.
- flatten_
str - Normalizes a string by performing ASCII transliteration and converting to lowercase.
- flatten_
variable - Normalizes a variable name string that may contain multiple segments separated by
|
. - format_
env_ var - Formats an env var name into its shell representation, based on the current shell
- generate_
working_ dir_ tree - Generates a string representation of the current working directory tree, respecting .gitignore files
- get_
executable_ version - A helper function to get the version from an executable (e.g. git)
- get_
os_ info - Retrieves the operating system information
- get_
shell_ info - Retrieves information about the current shell, including its type and version
- get_
shell_ type - Retrieves the current shell type
- get_
working_ dir - Retrieves the working directory
- parse_
fuzzy_ query - Parses a fuzzy search query string into a vector of
FuzzyMatch
items. - read_
history - Reads command history from a specified shell or history manager.
- remove_
newlines - Removes newline sequences and any surrounding whitespace, replacing them with a single space.
- truncate_
spans - Truncates a slice of spans to fit within a maximum width
- truncate_
spans_ with_ ellipsis - Truncates a slice of spans and adds an ellipsis if truncation occurred
- unify_
newlines - Converts all types of newline sequences (
\r
,\n
,\r\n
) in a string to a single newline character (\n
).