Repository files navigation
A command-line arguments parser library
My first open source Rust program
Started off as an example of a Rust-based command-line program
To be copied as a template to start new projects
The project originally used clap to parse the command-line arguments
Morphed into a parser library instead
I decided I should learn how to parse command-line arguments myself
As part of my learning the basics of the Rust programming language
cargo run --example example-commander -- --help
Prints the help information for the examples that uses the library
cargo run --example example-commander
Runs the example that uses the library
cargo run --example example-commander -- -i=false
cargo run --example example-commander -- -n=World
cargo run --example example-commander -- -q
Quiet mode suppress the exclamation mark in the response
cargo run --example example-commander -- -qi=false
Use quiet mode and disable interactive mode
cargo run --example example-commander -- -i=false -n=World
Disable interactive mode and use the specified name
cargo run --example example-commander -- --interactive=false
cargo run --example example-commander -- --name=World
cargo run --example example-commander -- -u
Show an error message for the unknown option
cargo run --example example-commander -- --unknown
Show an error message for the unknown option
cargo run --example example-commander -- --help=true
Show an error message for an invalid option value
Usage for the clap Example is similar to the Parser Library Example
Except that the commands start with "cargo run --example example-clap"
A Rust workspace with two crates
The primary library crate "croftsoft-commander"
Functions for parsing option values from command-line arguments
Functions for displaying application help information including options
The secondary library crate "croftsoft-commander-examples"
With two example applications
One showing how to use the library crate "croftsoft-commander"
The other showing how to run the same example application using "clap"
And a library containing the application code common to the two examples
A "Hello, World" application that prompts the user for a name
Configured by parsing option values from command-line arguments
Using either the "croftsoft-commander" library or the "clap" library
cargo clippy
cargo doc --examples --no-deps
Makes target/doc/commander/index.html
cargo fmt
cargo test
cargo test --all-targets
cargo update
rustup update
Parse sub-commands
Use a code coverage tool
About
Rust command-line arguments parser
Resources
License
Stars
Watchers
Forks
You can’t perform that action at this time.