Crate debate

Crate debate 

Source
Expand description

A principled, type and trait-driven command line arguments parsing library; debate is a more sensible way to handle (command-line) arguments.

More substantial docs and examples are coming. If you’re here, you’re probably interested in the parameter module, which provides traits you can implement on your own types to make them parsable as command line arguments, or in debate’s macros:

  • #[derive(FromArgs)] and #[derive(Usage)] can be derived on your structs, making them into containers for parsed command-line arguments. The #[debate] attribute lets you customize parsing behavior with attributes like short, long, default, placeholder, override, and invert. It’s likely that, in the future, it won’t be necessary to separately derive Usage.

  • #[debate::main] can be placed on your main function to make the command line arguments available as a function argument. It even works on tokio async fn main!

Until we write more complete docs and examples, check out the debate-demo for examples on how to use debate.

Modules§

arguments
Container type for raw arguments retrieved from the environment.
build
Traits related to composable parsing of command line arguments.
errors
Basic error implementations for the various error traits throughout debate
from_args
Top-level trait for structures that can be parsed from command-line arguments
help
Types and traits related to structured usage information about command line arguments.
parameter
Traits enabling individual parameter parsing.
state
Command-line argument parsing state. Pairs with the traits in build.
util
Utility types and functions for debate

Structs§

Arg
A single, raw argument passed in from the command line.

Enums§

Tags
The set of tags that identify a particular option (-short, --long)

Attribute Macros§

main
Decorate an fn main to inject the command line arguments as a type.

Derive Macros§

FromArgs
ParameterUsage
Usage
Value