Update README.md

This commit is contained in:
Kevin K. 2015-03-16 10:38:43 -04:00
parent bb973008a8
commit 09f1234d3e

View file

@ -1,19 +1,17 @@
# clap ![Travis-CI](https://travis-ci.org/kbknapp/clap-rs.svg?branch=master)
Command Line Argument Parser written in Rust
A simply library for parsing command line arguments when writing
command line and console applications.
A simply library for parsing command line arguments and subcommands when writing command line and console applications.
You can use `clap` to lay out a list of possible valid command line arguments and subcommands, then let `clap` parse the string given by the user at runtime.
You can use `clap` to lay out a list of possible valid command line arguments and let `clap` parse the string given by the user at runtime.
When using `clap` you define a set of parameters and rules for your arguments and at runtime `clap` will determine their validity.
Also, `clap` provides the traditional version and help switches 'for free' by parsing the list of possible valid arguments lazily at runtime.
i.e. only when it's been determined that the user wants or needs to see the help and version information.
When using `clap` you define a set of parameters and rules for your arguments and subcommands, then at runtime `clap` will determine their validity.
After defining a list of possible valid arguments you get a list of matches that the user supplied at runtime. You can then use this list to
determine the functioning of your program.
`clap` also provides the traditional version and help switches 'for free' by parsing the list of possible valid arguments lazily at runtime, and if not already defined by the developer `clap` will autogenerate all applicable "help" and "version" switches (as well as a "help" subcommand if other subcommands are defined as well).
Example:
After defining a list of possible valid arguments and subcommands, `clap` gives you a list of valid matches that the user supplied at runtime, or informs the user of their error and exits gracefully. You can use this list to determine the functioning of your program.
# Example (Full example with comments in examples/myapp.rs)
```rust
extern crate clap;
@ -70,7 +68,7 @@ Command Line Argument Parser written in Rust
// more porgram logic goes here...
```
If you were to compile the above program and run it with the flag `--help` or `-h` the following output woud be presented
If you were to compile the above program and run it with the flag `--help` or `-h` (or `help` subcommand, since we defined `test` as a subcommand) the following output woud be presented
```sh
$ myprog --help
@ -98,19 +96,25 @@ Command Line Argument Parser written in Rust
```
## Installation
Simply add `clap` as a dependecy in your `Cargo.toml` file to use from crates.io:
Add `clap` as a dependecy in your `Cargo.toml` file to use from crates.io:
```
[dependencies]
clap = "*"
```
Or to simply track the latest on the master branch at github:
Or track the latest on the master branch at github:
```
[dependencies.clap]
git = "https://github.com/kbknapp/clap-rs.git"
```
Then run `cargo build` or `cargo update` for your project.
## Usage
Add `extern crate clap;` to your crate root.
## More Information
You can find complete documentation on the [github-pages site](http://kbknapp.github.io/clap-rs/docs/clap/index.html) for this project.