Expand description
Embeddable shell framework.
esh provides a configurable command-line shell that can be extended with
custom subcommands, argument augmentors, handlers, and a virtual filesystem.
Start with shell_config! to build a Shell instance.
§Feature flags
Macros§
- die
- Log a fatal error via
tracing::error!and exit shell via error handling - pluralize
- Simple English pluralisation helper.
- shell_
config - Create a
ShellConfigwith Cargo metadata filled in automatically.
Structs§
- Shell
Config - Builder for constructing a
Shellinstance.
Enums§
- Shell
Error - Errors returned by shell operations.
- Shell
Parse Error - Errors that can occur when parsing a shell line.
Traits§
Functions§
- get_
cmd_ basename - Return the basename of the running binary, cached for the process lifetime.
- get_
cmd_ fallback - Convenience wrapper around
get_cmd_basenamethat usesCARGO_PKG_NAMEas the fallback. - init_
tracing - Initialise the global tracing/logging subscriber.
- make_
env_ ident - Sanitize an arbitrary string into a valid, uppercase environment variable
name using only
[A-Z0-9_]. - shell_
parse_ arg - Parse a single string using double-quote escape rules, returning an
OsString. - shell_
parse_ arg_ bytes - Parse a single string using double-quote escape rules, returning raw bytes.
- shell_
parse_ line - Split a string into words using POSIX shell-like parsing rules, returning
OsStringvalues. - shell_
parse_ line_ bytes - Split a string into words using POSIX shell-like parsing rules, returning raw byte vectors.
Type Aliases§
- Augmentor
- A shared closure that augments a
clap::Commandwith additional subcommands or arguments. - Handler
- A shared closure that handles a parsed command.
- VfsLookup
- A shared closure that creates a
Vfsfrom the parsed command-line arguments.