Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
67ad41a
separate creating app and adding arguments
williamyaoh Jun 29, 2017
d204657
split `impl_structopt` into struct and enum branches
williamyaoh Jun 29, 2017
4112eab
skeleton of enum impl
williamyaoh Jun 29, 2017
dc2a1fb
factor out code generation that's needed for enums
williamyaoh Jun 29, 2017
eebf9fa
prototype enum stuff?
williamyaoh Jun 29, 2017
79295f8
lifetime fix
williamyaoh Jun 29, 2017
f321bca
add test for subcommand parsing (texitoi/structopt#1)
williamyaoh Jun 29, 2017
fdb1b9c
add ability to put in nested subcommands (texitoi/structopt#1)
williamyaoh Jun 30, 2017
21df5bc
ignore unused matches for empty subcommands (texitoi/structopt#1)
williamyaoh Jun 30, 2017
5ab334a
allow for optional subcommands (texitoi/structopt#1)
williamyaoh Jun 30, 2017
d5f029a
add test suite for nested subcommands (texitoi/structopt#1)
williamyaoh Jun 30, 2017
ae7048b
fix hyphenated subcommands
williamyaoh Jul 3, 2017
650e3bd
add link to structopt-derive documentation from structopt crate
williamyaoh Jul 3, 2017
54372b7
preliminary editing of structopt-derive documentation
williamyaoh Jul 3, 2017
86611bc
add documentation in structopt-derive about how to use subcommands
williamyaoh Jul 3, 2017
f2c0cdb
note about optional subcommands
williamyaoh Jul 3, 2017
c64cc1e
add note about using doc comments for help messages (texitoi/structop…
williamyaoh Jul 3, 2017
0418cb6
bump versions of structopt and structopt-derive
williamyaoh Jul 3, 2017
7b8066c
add missing backticks (oops)
williamyaoh Jul 3, 2017
72d9d35
bump versions of structopt in README, fix typo
williamyaoh Jul 3, 2017
7cbf766
bump versions to 0.1.0
williamyaoh Jul 3, 2017
fc9a8ae
remove unnecessary Option in documentation [ci skip]
williamyaoh Jul 3, 2017
9a5ea9c
fix typoes
williamyaoh Jul 3, 2017
cb3bc99
add extra Arg methods in doc so examples still work
williamyaoh Jul 3, 2017
d7daced
allow for documentation to be placed on subcommands
williamyaoh Jul 4, 2017
4ff50e6
add support for unit-variant subcommands
williamyaoh Jul 4, 2017
42529fb
update structopt-derive documentation to reflect unit subcommands change
williamyaoh Jul 4, 2017
b329f01
move `augment_clap` into inherent impl
williamyaoh Jul 7, 2017
8060f31
move assert
williamyaoh Jul 7, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "structopt"
version = "0.0.5"
version = "0.1.0"
authors = ["Guillaume Pinot <texitoi@texitoi.eu>"]
description = "Parse command line argument by defining a struct."
documentation = "https://docs.rs/structopt"
Expand All @@ -17,6 +17,6 @@ travis-ci = { repository = "TeXitoi/structopt" }
clap = "2.20"

[dev-dependencies]
structopt-derive = { path = "structopt-derive", version = "0.0.5" }
structopt-derive = { path = "structopt-derive", version = "0.1.0" }

[workspace]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Find it on Docs.rs: [structopt-derive](https://docs.rs/structopt-derive) and [st

## Example

Add `structopt` and `structop-derive` to your dependencies of your `Cargo.toml`:
Add `structopt` and `structopt-derive` to your dependencies of your `Cargo.toml`:
```toml
[dependencies]
structopt = "0.0.3"
structopt-derive = "0.0.3"
structopt = "0.1.0"
structopt-derive = "0.1.0"
```

And then, in your rust file:
Expand Down
40 changes: 40 additions & 0 deletions examples/git.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//! `git.rs` serves as a demonstration of how to use subcommands,
//! as well as a demonstration of adding documentation to subcommands.
//! Documentation can be added either through doc comments or the
//! `about` attribute.

extern crate structopt;
#[macro_use] extern crate structopt_derive;

use structopt::StructOpt;

#[derive(StructOpt, Debug)]
#[structopt(name = "git")]
/// the stupid content tracker
enum Opt {
#[structopt(name = "fetch")]
/// fetch branches from remote repository
Fetch {
#[structopt(long = "dry-run")]
dry_run: bool,
#[structopt(long = "all")]
all: bool,
#[structopt(default_value = "origin")]
repository: String
},
#[structopt(name = "add")]
/// add files to the staging area
Add {
#[structopt(short = "i")]
interactive: bool,
#[structopt(short = "a")]
all: bool,
files: Vec<String>
}
}

fn main() {
let matches = Opt::from_args();

println!("{:?}", matches);
}
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
//! `StructOpt` trait definition
//!
//! This crate defines the `StructOpt` trait. Alone, this crate is of
//! little interest. See the `structopt-derive` crate to
//! automatically generate implementation of this trait.
//! little interest. See the
//! [`structopt-derive`](https://docs.rs/structopt-derive) crate to
//! automatically generate an implementation of this trait.

extern crate clap as _clap;

Expand Down
2 changes: 1 addition & 1 deletion structopt-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "structopt-derive"
version = "0.0.5"
version = "0.1.0"
authors = ["Guillaume Pinot <texitoi@texitoi.eu>"]
description = "Parse command line argument by defining a struct, derive crate."
documentation = "https://docs.rs/structopt-derive"
Expand Down
Loading