Skip to main content

Crate esh

Crate esh 

Source
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

FlagDefaultDescription
tracing-logoffBridges the log crate to tracing so libraries that use log::* macros are captured by the tracing subscriber.

Macros§

die
Log a fatal error via tracing::error! and exit shell via error handling
pluralize
Simple English pluralisation helper.
shell_config
Create a ShellConfig with Cargo metadata filled in automatically.

Structs§

ShellConfig
Builder for constructing a Shell instance.

Enums§

ShellError
Errors returned by shell operations.
ShellParseError
Errors that can occur when parsing a shell line.

Traits§

Shell
Core trait for running the shell.
Vfs
Backend-agnostic VFS interface for the shell.

Functions§

get_cmd_basename
Return the basename of the running binary, cached for the process lifetime.
get_cmd_fallback
Convenience wrapper around get_cmd_basename that uses CARGO_PKG_NAME as 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 OsString values.
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::Command with additional subcommands or arguments.
Handler
A shared closure that handles a parsed command.
VfsLookup
A shared closure that creates a Vfs from the parsed command-line arguments.