Crate easy_args[][src]

Expand description

Utility for simple and declarative style command line argument parsing.

easy-args is meant to be used to set up simple command-line argumenst for your applications and give them back in an easy to process way.

Getting Started

// First you must define an [`ArgSpec`] which will determine what the
// command-line arguments are for your program and will be used by the parser to
// do some simple checks.

// You make an [`ArgSpec`] with the builder pattern.

use easy_args::{arg_spec, ArgSpec};

let spec = ArgSpec::build()
    .uinteger_array(2, "size")

// There is an `arg_spec!` macro which provides a nicer syntax.
let spec = arg_spec! {
    fullscreen: bool,
    size: [u64; 2],

// Second you call [`ArgSpecs`]'s [`parse()`] method to retrieve the command-line
// arguments in a processed form.

let args = spec.parse().unwrap();
if args.boolean("fullscreen") == Some(&true) {
    // Put application into windowed mode

And that’s it! The arguments have been parsed and processed and can be accessed via Args’s getter methods.

ArgSpec also has a [parse()] method so you don’t have to make a throwaway variable.

use easy_args::ArgSpec;

let args = ArgSpec::build()



Macro that lets uers write ArgSpecs in a nicer way.



Specifies the valid arguments of the program and is used to parse the command-line arguments into an [Arg].


Builder type for ArgSpec.


Holds all the command-line arguments given by the user.



Enumerates all data types that are handled by ArgSpec::parse().


The error types for argument parsing.

Type Definitions


Convient Result type where [E] is Error.