Crate climb

Source
Expand description

§Climb

Climb is a simple Rust crate for creating CLI applications. Allows for creating commands that accept inputs, options, and optional inputs. Climb handles all input argument validation and parsing and guarantees that only the correct number of inputs and only valid options are passed into your functions. Climb will also generate help menus for your application and commands.

This is an example calculator application “cool_calc”“ that was created with climb. For a walkthrough of how to create this example application, check out the README on the Climb page on crates.io.

$ cool_calc

This app does some cool math

USAGE:
        cool_calc [OPTIONS] [COMMAND]

OPTIONS:
        -h, --help                   Print help information
        -v, --version                Print version

COMMANDS:
        add        Add two numbers
        div        Divide two numbers

Run `cool_calc [COMMAND] --help` to see help information for a specific command
$ cool_calc add 10 20

30
$ cool_calc div --round 100 3

33
$ cool_calc div --help

Divide two numbers
USAGE:
        cool_calc div [OPTIONS] <NUMBER_A> <NUMBER_B>

ARGS:
        <NUMBER_A>
        <NUMBER_B>

OPTIONS:
        -h--help                     Print help information
            --round                  Round the result

Macros§

create_app
Macro to create an app and initialize it with the current crate name, description, and version.

Structs§

App
Holds information about the application: commands, options, name, version, etc.
Command
Holds information about the commands the application can call.
CommandOption
Holds information about command options.
FunctionOption
Stores the options that are passed into functions

Type Aliases§

CommandFunction
Renaming of type fn(FunctionInput, FunctionOptions) -> FunctionResult.
FunctionInput
Renaming of type Vec<String>
FunctionOptions
Renaming of type Vec<FunctionOption>
FunctionResult
Renaming of type Result<Option<String>, String>