Expand description
kodegen-bash-shell: Embeddable POSIX/bash shell with cancellation support.
This is a permanent fork of brush-shell with
programmatic command cancellation support via CancellationToken.
§Quick Start
use kodegen_bash_shell::{Shell, ExecutionResult};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mut shell = Shell::builder().build().await?;
let result = shell.exec("echo 'Hello!'", &shell.default_exec_params()).await?;
Ok(())
}§Custom Builtins
See the custom-builtin example for how to implement custom shell builtins.
Re-exports§
pub use core::BuiltinError;pub use core::CommandArg;pub use core::CreateOptions;pub use core::Error;pub use core::ErrorKind;pub use core::ExecutionContext;pub use core::ExecutionControlFlow;pub use core::ExecutionExitCode;pub use core::ExecutionParameters;pub use core::ExecutionResult;pub use core::ExecutionSpawnResult;pub use core::ProcessGroupPolicy;pub use core::Shell;pub use core::ShellBuilder;pub use core::ShellBuilderState;pub use core::ShellFd;pub use core::ShellValue;pub use core::ShellVariable;pub use core::OutputStreamType;pub use core::StreamingOutput;pub use core::openfiles;pub use parser::ParseError;pub use parser::Parser;pub use parser::ParserBuilder;pub use parser::ParserOptions;pub use parser::SourceInfo;pub use parser::Token;pub use parser::TokenLocation;pub use parser::TokenizerError;pub use parser::TokenizerOptions;pub use builtins::BuiltinSet;pub use builtins::ShellBuilderExt;pub use builtins::default_builtins;pub use core::builtins::builtin;pub use core::builtins::Command;pub use core::builtins::ContentType;pub use core::builtins::DeclarationCommand;pub use core::builtins::Registration;
Modules§
- builtins
- Standard builtins.
- core
- Core implementation of the brush shell. Implements the shell’s abstraction, its interpreter, and various facilities used internally by the shell.
- interactive
- Library implementing interactive command input and completion for the brush shell.
- parser
- Implements a tokenizer and parsers for POSIX / bash shell syntax.
- prelude
- Prelude module for convenient glob imports.
- shell
- Create for brush, an executable bash-compatible shell.
Macros§
- minus_
or_ plus_ flag_ arg - Macro to define a struct that represents a shell built-in flag argument that can be enabled or disabled by specifying an option with a leading ‘+’ or ‘-’ character.
Structs§
- Cancellation
Token - A token which can be used to signal a cancellation request to one or more tasks.