| Crates.io | starbase_args |
| lib.rs | starbase_args |
| version | 0.1.4 |
| created_at | 2026-01-10 00:39:58.771263+00 |
| updated_at | 2026-01-23 06:06:13.950705+00 |
| description | A generic command line argument parser with support for POSIX-based shells and more. |
| homepage | |
| repository | https://github.com/moonrepo/starbase |
| max_upload_size | |
| id | 2033248 |
| size | 81,787 |
A generic command line parser.
This is more than just an argument parser; it supports "full" command line syntax including piping, redirection, expansion, and substitution. It organizes parsed tokens into a structured format using Rust enums and structs.
For example, the command git rebase -i --empty=drop --exec "echo" HEAD~3 would be parsed into:
CommandLine(vec![
Pipeline::Start(CommandList(vec![
Sequence::Start(Command(vec![
Argument::Value(Value::Unquoted("git".into())),
Argument::Value(Value::Unquoted("rebase".into())),
Argument::Flag("-i".into()),
Argument::Option("--empty".into(), Some(Value::Unquoted("drop".into()))),
Argument::Option("--exec".into(), None),
Argument::Value(Value::DoubleQuoted("echo".into())),
Argument::Value(Value::Unquoted("HEAD~3".into())),
]))
]))
])
The following shells are shells "supported":
This library only supports parsing command line syntax that you would enter into a terminal. For example: commands, arguments, options, flags, redirections, pipelines, expansions, substitutions, etc.
It does not support parsing shell specific syntax such as control flow (if/else), variable assignments, functions, etc.
Additionally, while this library aims to support multiple shells, it may not cover all edge cases or unique syntax of every shell! Just syntax that is generic and common enough across them.