commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
fbe6a55408fd1296bf3a844341eab76d147de320 | CreepySkeleton | 2019-11-26T17:15:02 | Fix #283 (#284)
Fix #283 | diff --git a/structopt-derive/src/attrs.rs b/structopt-derive/src/attrs.rs
index c53628b..634796d 100644
--- a/structopt-derive/src/attrs.rs
+++ b/structopt-derive/src/attrs.rs
@@ -604,7 +604,7 @@ impl Attrs {
let about = &self.about;
let methods = &self.methods;
- quote!( #(#methods)* #autho... | 2 | 15 | 1 |
0e4fa6f9f0b2b0a416b1b0a91c89a08664495ea2 | xiaoniu-578fa6bff964d005 | 2019-11-08T07:59:30 | Fix parse for OptionVec (#279)
ref pull #191 | diff --git a/structopt-derive/src/attrs.rs b/structopt-derive/src/attrs.rs
index 8dee492..be8e0ec 100644
--- a/structopt-derive/src/attrs.rs
+++ b/structopt-derive/src/attrs.rs
@@ -508,7 +508,7 @@ impl Attrs {
let mut ty = Self::ty_from_field(&field.ty);
if res.has_custom_parser {
... | 1 | 1 | 1 |
d77740dee6b6ab5b36548e0054cac8a6ebe2d894 | CreepySkeleton | 2019-10-21T19:28:41 | Fix documentation inaccuracy (#276) | diff --git a/src/lib.rs b/src/lib.rs
index 446cece..af03931 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -618,7 +618,7 @@
//!
//! ### Optional subcommands
//!
-//! A nested subcommand can be marked optional:
+//! Subcommands may be optional:
//!
//! ```
//! # use structopt::StructOpt; | 1 | 1 | 1 |
1c36a16d65fb1a587c5e524b5827c7e6da380ff6 | Thiago Arrais | 2019-10-21T18:31:36 | docs: observes that the trait is more than from_args (#275) | diff --git a/src/lib.rs b/src/lib.rs
index 7773b98..446cece 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -104,6 +104,11 @@
//! (unless they're [subcommands](#subcommands)),
//! and you can adjust these apps and args by `#[structopt(...)]` [attributes](#attributes).
//!
+//! The derived `StructOpt` trait allows access... | 1 | 5 | 0 |
fe5e704c2fbf950145580192a04ec32df5f6c7d9 | CreepySkeleton | 2019-10-17T11:15:40 | Add table of contents in documentation (#273) | diff --git a/src/lib.rs b/src/lib.rs
index a3ba986..7773b98 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -32,6 +32,25 @@
//! paw = "1.0"
//! ```
//!
+//! # Table of Contents
+//!
+//! - [How to `derive(StructOpt)`](#how-to-derivestructopt)
+//! - [Attributes](#attributes)
+//! - [Raw methods](#raw-methods)
+//! ... | 1 | 24 | 5 |
8d8661695718f652b858879257684e66e9a99826 | Luiz F. A. de Prá | 2019-10-05T18:48:04 | Fix code formatting | diff --git a/structopt-derive/src/attrs.rs b/structopt-derive/src/attrs.rs
index 53b7604..9d64d08 100644
--- a/structopt-derive/src/attrs.rs
+++ b/structopt-derive/src/attrs.rs
@@ -146,9 +146,7 @@ impl Parser {
let func = match spec.parse_func {
None => match kind {
- FromStr | Fr... | 1 | 1 | 3 |
0c888e962d842f2c90c6c290d3a2a40947b37005 | Mitchell Ferree | 2019-09-19T18:05:05 | Fix clippy warnings | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index bb6650b..2e36824 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -290,8 +290,7 @@ fn gen_constructor(fields: &Punctuated<Field, Comma>, parent_attribute: &Attrs)
Ty::OptionVec => quote_spanned... | 1 | 2 | 4 |
1cae9fab4b558afbd228a20cf702e1966a233d92 | CreepySkeleton | 2019-09-19T13:32:54 | Suppress all clippy warnings | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 158383f..bb6650b 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -543,13 +543,17 @@ fn impl_structopt_for_struct(
let clap_tokens = basic_clap_app_gen.tokens;
quote! {
#[allow(unused_variables)]... | 1 | 9 | 1 |
c228c2399b53f2644362273983f22ffc6b535ad6 | CreepySkeleton | 2019-09-18T09:33:16 | Fix version in docs (AGAIN) | diff --git a/src/lib.rs b/src/lib.rs
index bb96164..bb3a245 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -18,7 +18,7 @@
//!
//! ```toml
//! [dependencies]
-//! structopt = { version = "0.2", default-features = false }
+//! structopt = { version = "0.3", default-features = false }
//! ```
//!
//! Support for [`paw`... | 1 | 1 | 1 |
c3c6273bb92f58a774c5ed03d95e4336c740423a | CreepySkeleton | 2019-09-17T09:34:13 | Update version in the documentation | diff --git a/src/lib.rs b/src/lib.rs
index e57e8c0..c8b0610 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -28,7 +28,7 @@
//!
//! ```toml
//! [dependencies]
-//! structopt = { version = "0.2", features = [ "paw" ] }
+//! structopt = { version = "0.3", features = [ "paw" ] }
//! paw = "1.0"
//! ```
//! | 1 | 1 | 1 |
52fa7262088d14833864351413b413008164b785 | CreepySkeleton | 2019-09-09T21:49:26 | Propagate span info from origin code to generated code
Most of `quote!` invocations are replaced with `quote_spanned!` ones.
Now everywhere - sometimes it's pointless, sometimes we don't have
any meaningless location to toke a span from, sometimes I just can't
workaround the current implementation - too much changes. | diff --git a/src/lib.rs b/src/lib.rs
index 26ef3fe..e57e8c0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -183,7 +183,8 @@
//! - On field-level: `Arg::with_name("name")`.
//!
//! The name for the argument the field stands for, this name appears in help messages.
-//! Defaults to a name, deduced from a field,... | 4 | 262 | 190 |
c4bc9c272089a8d6972e92608c2fde8882986b32 | CreepySkeleton | 2019-09-05T13:49:57 | Do not call .verison() when CARGO_PKG_VERSION is not set | diff --git a/structopt-derive/src/attrs.rs b/structopt-derive/src/attrs.rs
index f390e0e..04724c2 100644
--- a/structopt-derive/src/attrs.rs
+++ b/structopt-derive/src/attrs.rs
@@ -12,7 +12,7 @@ use std::env;
use heck::{CamelCase, KebabCase, MixedCase, ShoutySnakeCase, SnakeCase};
use proc_macro2::{Span, TokenStrea... | 1 | 6 | 5 |
c72ad2f2a40f319b08b2c90c320a749d91a72b48 | kpcyrd | 2019-08-30T14:07:14 | Fix structopt-derive permissions (#239) | diff --git a/structopt-derive/src/attrs.rs b/structopt-derive/src/attrs.rs
old mode 100755
new mode 100644
diff --git a/structopt-derive/src/parse.rs b/structopt-derive/src/parse.rs
old mode 100755
new mode 100644 | 2 | 0 | 0 |
6bd1a69bbcd7393cd526795d6a7e6c23fad87ee2 | Ophir LOJKINE | 2019-08-26T07:30:50 | Update keyvalue example (#234) | diff --git a/examples/keyvalue.rs b/examples/keyvalue.rs
index 31fc221..231aea0 100644
--- a/examples/keyvalue.rs
+++ b/examples/keyvalue.rs
@@ -1,6 +1,7 @@
use std::error::Error;
use structopt::StructOpt;
+/// Parse a single key-value pair
fn parse_key_val<T, U>(s: &str) -> Result<(T, U), Box<dyn Error>>
where
... | 1 | 9 | 1 |
73db7813de208ae213070ffd22aedb488abdfce2 | CreepySkeleton | 2019-08-23T13:39:06 | Update raw_bool_literal.rs (#231) | diff --git a/tests/raw_bool_literal.rs b/tests/raw_bool_literal.rs
index 4084b85..faf8628 100644
--- a/tests/raw_bool_literal.rs
+++ b/tests/raw_bool_literal.rs
@@ -6,7 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use structopt::clap;
use structopt::... | 1 | 0 | 1 |
a91109c3db0c3dcb2236407af36455a715bd043c | CreepySkeleton | 2019-08-23T12:39:08 | Change behavior of `about/author/version` and ad `no_version` | diff --git a/examples/no_version.rs b/examples/no_version.rs
index 8d388cb..8cf2550 100644
--- a/examples/no_version.rs
+++ b/examples/no_version.rs
@@ -4,9 +4,7 @@ use structopt::StructOpt;
#[derive(StructOpt, Debug)]
#[structopt(
name = "no_version",
- about = "",
- version = "",
- author = "",
+ n... | 7 | 199 | 71 |
94946c3b5f32b92fb1475f9f202ca462e46f56ce | Rotem Yaari | 2019-07-19T07:23:24 | Add documentation for `env` (#221) | diff --git a/src/lib.rs b/src/lib.rs
index aba16f0..a94bad8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -289,6 +289,49 @@
//! }
//! # fn main() {}
//! ```
+//!
+//! ## Environment Variable Fallback
+//!
+//! It is possible to specify an environment variable fallback option for an arguments, so that its value is take... | 1 | 43 | 0 |
119dd7eb740671d3b8e29d93cf1dc9284e54a99b | Daniel Schemmel | 2019-07-11T06:47:19 | Explicitly specify the Result type (#218) | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index ed510a2..d7a2b38 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -437,7 +437,7 @@ fn gen_paw_impl(name: &Ident) -> TokenStream {
impl paw::ParseArgs for #name {
type Error = std::io::Error;
... | 1 | 1 | 1 |
b0e3711c57001d3208e9325e9a628ab4cc12cc98 | Robin Stocker | 2019-07-04T15:37:39 | Add example for environment variables (#160) (#216) | diff --git a/examples/env.rs b/examples/env.rs
new file mode 100644
index 0000000..1ad67b9
--- /dev/null
+++ b/examples/env.rs
@@ -0,0 +1,23 @@
+use structopt::StructOpt;
+
+/// Example for allowing to specify options via environment variables.
+#[derive(StructOpt, Debug)]
+#[structopt(name = "env")]
+struct Opt {
+ ... | 1 | 23 | 0 |
d45e1ae9b75d297547e4a8f953015d49e767f206 | Guillaume Pinot | 2019-06-29T16:44:39 | migrate structopt-derive to edition 2018 | diff --git a/structopt-derive/Cargo.toml b/structopt-derive/Cargo.toml
index 5eb524d..ba157b4 100644
--- a/structopt-derive/Cargo.toml
+++ b/structopt-derive/Cargo.toml
@@ -1,6 +1,7 @@
[package]
name = "structopt-derive"
version = "0.3.0"
+edition = "2018"
authors = ["Guillaume Pinot <texitoi@texitoi.eu>"]
descrip... | 4 | 15 | 17 |
47fd6113ecd53162c5cfee38b30afd93a3d685cd | Owen Walpole | 2019-04-24T04:44:35 | Fix some clippy lints | diff --git a/structopt-derive/src/attrs.rs b/structopt-derive/src/attrs.rs
index 8b517de..315f5de 100644
--- a/structopt-derive/src/attrs.rs
+++ b/structopt-derive/src/attrs.rs
@@ -119,10 +119,10 @@ impl ::std::str::FromStr for CasingStyle {
}
impl Attrs {
- fn new(name: String, casing: CasingStyle) -> Attrs {
+... | 2 | 13 | 15 |
865539feb6a8628b11f3b4c125a77516fbf5c876 | Owen Walpole | 2019-04-24T04:00:33 | Fix use of deprecated function | diff --git a/structopt-derive/src/attrs.rs b/structopt-derive/src/attrs.rs
index 3a60689..8b517de 100644
--- a/structopt-derive/src/attrs.rs
+++ b/structopt-derive/src/attrs.rs
@@ -302,11 +302,11 @@ impl Attrs {
}
let value = s.value();
let text = value
- ... | 1 | 6 | 6 |
a7cf4e93725a63edb2dcf9039ffd3ecd506e91d9 | Ivan Veselov | 2019-06-01T19:33:37 | Docs: tell about possible literals use for attribute values (#195) | diff --git a/src/lib.rs b/src/lib.rs
index d15ed67..492355c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -85,8 +85,13 @@
//! - `author`: Defaults to the crate author name given by Cargo.
//! - `about`: Defaults to the crate description given by Cargo.
//!
-//! Methods from `clap::App` that don't take an `&str` ca... | 1 | 18 | 10 |
063eaf0c70deb828ebab89092273cb5ea3e68930 | Ivan Veselov | 2019-06-01T19:14:39 | Update deprecated function and provide more info about the parsing error (#193) | diff --git a/structopt-derive/Cargo.toml b/structopt-derive/Cargo.toml
index fc5484e..62fb6bd 100644
--- a/structopt-derive/Cargo.toml
+++ b/structopt-derive/Cargo.toml
@@ -13,7 +13,7 @@ license = "Apache-2.0/MIT"
travis-ci = { repository = "TeXitoi/structopt" }
[dependencies]
-syn = "0.15"
+syn = "0.15.10"
quote ... | 2 | 20 | 21 |
c29ba3d67a9841ebe44eda1baeafc2cc6a3ca228 | Vasili Novikov | 2019-03-11T22:56:27 | add completions generation example (#169) | diff --git a/examples/gen_completions.rs b/examples/gen_completions.rs
new file mode 100644
index 0000000..26b30cb
--- /dev/null
+++ b/examples/gen_completions.rs
@@ -0,0 +1,29 @@
+// Copyright 2019-present structopt developers
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apa... | 1 | 29 | 0 |
7056669a23d1ad6704d50a3d100ab214ecd78f1b | Ted Driggs | 2019-01-11T07:57:10 | Remove line-ending periods from short help. (#161) | diff --git a/structopt-derive/src/attrs.rs b/structopt-derive/src/attrs.rs
index 1e9a9ee..3b1c5ae 100644
--- a/structopt-derive/src/attrs.rs
+++ b/structopt-derive/src/attrs.rs
@@ -338,10 +338,14 @@ impl Attrs {
args: quote!(#merged_lines),
});
+ // Remove trailing whitespace ... | 2 | 7 | 1 |
444c57833cbf0debbc7721f3694bc03631ed39dc | TakaakiFuruse | 2018-12-29T09:01:03 | Typo fix on lib.rs (#159) | diff --git a/src/lib.rs b/src/lib.rs
index fc22f01..e37e682 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -8,7 +8,7 @@
#![deny(missing_docs)]
-//! This crate defines the `StructOpt` trait and its custom derrive.
+//! This crate defines the `StructOpt` trait and its custom derive.
//!
//! ## Features
//!
@@ -61,7 ... | 1 | 2 | 2 |
23e36e33a84257cbad8811b72f22bbf92bda5669 | Robin Lambertz | 2018-12-10T14:11:54 | Fix invalid structopt syntax error message (#154)
There was a typo preventing the probematic attr to be shown to the user. | diff --git a/structopt-derive/src/attrs.rs b/structopt-derive/src/attrs.rs
index ea5ba38..1e9a9ee 100644
--- a/structopt-derive/src/attrs.rs
+++ b/structopt-derive/src/attrs.rs
@@ -155,7 +155,7 @@ impl Attrs {
match quote!(#path).to_string().as_ref() {
"structopt" => Some(
... | 1 | 1 | 1 |
d48f4ad48858fc172fb77f4acda5043a6c25b601 | rnd | 2018-12-10T11:37:30 | Introduce smarter parsing of doc comments. (#146) | diff --git a/examples/doc_comments.rs b/examples/doc_comments.rs
new file mode 100644
index 0000000..32028df
--- /dev/null
+++ b/examples/doc_comments.rs
@@ -0,0 +1,86 @@
+// Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http... | 4 | 237 | 8 |
b8503cf5460b5a8fa1402a10c1e572558c981112 | Anthony Deschamps | 2018-11-10T21:00:45 | Fix up some docs about argument renaming. (#148) | diff --git a/examples/rename_all.rs b/examples/rename_all.rs
index 5f10c9b..36ac12e 100644
--- a/examples/rename_all.rs
+++ b/examples/rename_all.rs
@@ -1,7 +1,7 @@
//! Example on how the `rename_all` parameter works.
//!
//! `rename_all` can be used to override the casing style used during argument
-//! generation.... | 2 | 17 | 10 |
7320cc913e5d8311e655be7026511510f452bb45 | konstin | 2018-10-05T15:07:49 | Upgrade syn to 0.15 (#140) | diff --git a/structopt-derive/Cargo.toml b/structopt-derive/Cargo.toml
index 5d29412..e835e0b 100644
--- a/structopt-derive/Cargo.toml
+++ b/structopt-derive/Cargo.toml
@@ -13,7 +13,7 @@ license = "Apache-2.0/MIT"
travis-ci = { repository = "TeXitoi/structopt" }
[dependencies]
-syn = "0.14"
+syn = "0.15"
quote = "... | 1 | 1 | 1 |
ea76fa1b1b273e65e3b0b1046643715b49bec51f | Bruce Adams | 2018-06-28T06:12:58 | Add a simple group example (#120) | diff --git a/examples/simple_group.rs b/examples/simple_group.rs
new file mode 100644
index 0000000..d3dd546
--- /dev/null
+++ b/examples/simple_group.rs
@@ -0,0 +1,31 @@
+#[macro_use]
+extern crate structopt;
+
+use structopt::StructOpt;
+
+#[derive(StructOpt, Debug)]
+struct Opt {
+ /// Set a custom HTTP verb
+ ... | 1 | 31 | 0 |
d983649822b32bb6c11fb3ef9891f66258a6e5c9 | spease | 2018-06-18T16:34:33 | Explicitly mention doc comments in flatten error (#118) | diff --git a/structopt-derive/src/attrs.rs b/structopt-derive/src/attrs.rs
index aed307a..a2d562b 100644
--- a/structopt-derive/src/attrs.rs
+++ b/structopt-derive/src/attrs.rs
@@ -303,7 +303,7 @@ impl Attrs {
panic!("parse attribute is not allowed for flattened entry");
}
... | 1 | 1 | 1 |
100d88fb8afac0e4605b4e55277b559fe8207ac7 | Frank Benkstein | 2018-05-24T13:44:00 | fully qualify StructOpt when flattening (#112) | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 025fe92..08d2b20 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -177,7 +177,7 @@ fn gen_constructor(fields: &Punctuated<Field, Comma>) -> TokenStream {
};
quote!(#field_name: <#s... | 1 | 1 | 1 |
87daa0bc8e698d049006455da391d61f38444589 | windwardly | 2018-05-17T08:54:56 | fix Cargo authors list insertion code (#111) | diff --git a/Cargo.toml b/Cargo.toml
index 3002e91..b71ae64 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "structopt"
version = "0.2.8"
-authors = ["Guillaume Pinot <texitoi@texitoi.eu>"]
+authors = ["Guillaume Pinot <texitoi@texitoi.eu>", "others"]
description = "Parse command line argu... | 3 | 8 | 4 |
869c2dcb9e3ae7056093a34c73f1dde997350e6e | Guillaume Pinot | 2018-04-28T19:07:50 | fix nightly | diff --git a/tests/deny-warnings.rs b/tests/deny-warnings.rs
index 2dde87d..1e0e6a2 100644
--- a/tests/deny-warnings.rs
+++ b/tests/deny-warnings.rs
@@ -8,6 +8,7 @@
#![deny(warnings)]
#![cfg(feature = "nightly")]// TODO: remove that when never is stable
+#![feature(never_type)]
#[macro_use]
extern crate structo... | 1 | 1 | 0 |
be8543813e39b19f8342779a6b62d4d9f6f762bb | Guillaume P | 2018-04-18T16:53:51 | Add an example using clap group. | diff --git a/examples/group.rs b/examples/group.rs
new file mode 100644
index 0000000..9b92691
--- /dev/null
+++ b/examples/group.rs
@@ -0,0 +1,41 @@
+// A functional translation of the example at
+// https://docs.rs/clap/2.31.2/clap/struct.App.html#method.group
+
+#[macro_use]
+extern crate structopt;
+
+use structopt... | 1 | 41 | 0 |
5cb7888988a071fb925e9c841ef9101d8c660108 | Guillaume P | 2018-04-09T09:14:28 | subcommand aliases example | diff --git a/examples/subcommand_aliases.rs b/examples/subcommand_aliases.rs
new file mode 100644
index 0000000..a5c41db
--- /dev/null
+++ b/examples/subcommand_aliases.rs
@@ -0,0 +1,22 @@
+#[macro_use]
+extern crate structopt;
+
+use structopt::StructOpt;
+use structopt::clap::AppSettings;
+
+#[derive(StructOpt, Debug... | 1 | 22 | 0 |
5b883fcdaa9906d463d53465d32bcead157ff823 | hcpl | 2018-04-01T21:24:42 | Update `syn`, `quote` and `proc-macro2` (#87)
* Remove `my_quote` and replace with plain `quote` | diff --git a/structopt-derive/Cargo.toml b/structopt-derive/Cargo.toml
index ac7f052..18010ba 100644
--- a/structopt-derive/Cargo.toml
+++ b/structopt-derive/Cargo.toml
@@ -13,9 +13,9 @@ license = "Apache-2.0/MIT"
travis-ci = { repository = "TeXitoi/structopt" }
[dependencies]
-syn = "0.12"
-quote = "0.4"
-proc-mac... | 4 | 69 | 83 |
91f4f41ee7414ec08305374d7d1d66db132fa0ba | Guillaume P | 2018-03-29T22:15:22 | Improve the keyvalue example | diff --git a/examples/keyvalue.rs b/examples/keyvalue.rs
index a6a5cee..89bc653 100644
--- a/examples/keyvalue.rs
+++ b/examples/keyvalue.rs
@@ -2,16 +2,23 @@
extern crate structopt;
use structopt::StructOpt;
+use std::error::Error;
-fn parse_key_val(s: &str) -> Result<(String, String), String> {
+fn parse_key_va... | 1 | 10 | 3 |
73b6b672cae13740c90c1ca2aab0a891c7b8380d | Guillaume P | 2018-03-15T09:37:28 | Add an example with at least 2 arguments | diff --git a/examples/at_least_two.rs b/examples/at_least_two.rs
new file mode 100644
index 0000000..ee9578f
--- /dev/null
+++ b/examples/at_least_two.rs
@@ -0,0 +1,15 @@
+#[macro_use]
+extern crate structopt;
+
+use structopt::StructOpt;
+
+#[derive(StructOpt, Debug)]
+struct Opt {
+ #[structopt(raw(required = "tru... | 1 | 15 | 0 |
495cc1f5e3dbde7ee4590217107f4db26951c8f6 | Guillaume P | 2018-03-12T11:36:21 | Add no_version example | diff --git a/examples/no_version.rs b/examples/no_version.rs
new file mode 100644
index 0000000..97ef5c4
--- /dev/null
+++ b/examples/no_version.rs
@@ -0,0 +1,16 @@
+#[macro_use]
+extern crate structopt;
+
+use structopt::StructOpt;
+use structopt::clap::AppSettings;
+
+#[derive(StructOpt, Debug)]
+#[structopt(name = "... | 1 | 16 | 0 |
b043260eb3decf8946aaa7fb2af4bdcb72d04f3f | Guillaume P | 2018-03-09T15:52:50 | Add an example for KEY=value argument as asked in #79 | diff --git a/examples/keyvalue.rs b/examples/keyvalue.rs
new file mode 100644
index 0000000..a6a5cee
--- /dev/null
+++ b/examples/keyvalue.rs
@@ -0,0 +1,20 @@
+#[macro_use]
+extern crate structopt;
+
+use structopt::StructOpt;
+
+fn parse_key_val(s: &str) -> Result<(String, String), String> {
+ let pos = s.find('=')... | 1 | 20 | 0 |
78d4aa00a027372c14c2f39ba58a67f1c356908f | Guillaume Pinot | 2018-02-15T15:19:52 | Use `r#"str"#` when appropriate | diff --git a/examples/raw_attributes.rs b/examples/raw_attributes.rs
index 2b6c737..413d390 100644
--- a/examples/raw_attributes.rs
+++ b/examples/raw_attributes.rs
@@ -20,13 +20,13 @@ struct Opt {
output: String,
/// admin_level to consider
- #[structopt(short = "l", long = "level", raw(aliases = "&[\"s... | 5 | 8 | 8 |
12ec0ba5e0b15982d6bd17316f53d9864756503a | Kerollmops | 2018-02-10T16:08:04 | Add the `from` method to parse from any Iterator | diff --git a/src/lib.rs b/src/lib.rs
index 0dd573c..5f73cdd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -346,6 +346,8 @@ extern crate structopt_derive;
#[doc(hidden)]
pub use structopt_derive::*;
+use std::ffi::OsString;
+
/// Re-export of clap
pub mod clap {
pub use _clap::*;
@@ -365,4 +367,15 @@ pub trait ... | 1 | 13 | 0 |
3e7d843d8268f627776fb15a9f356663af35be7e | Guillaume Pinot | 2018-02-04T18:27:45 | Add test for the options | diff --git a/tests/options.rs b/tests/options.rs
new file mode 100644
index 0000000..166961a
--- /dev/null
+++ b/tests/options.rs
@@ -0,0 +1,85 @@
+// Copyright (c) 2018 Guillaume Pinot <texitoi(a)texitoi.eu>
+//
+// This work is free. You can redistribute it and/or modify it under
+// the terms of the Do What The Fuck... | 1 | 85 | 0 |
0d2c765e4ce94d04b6d8d9098bc4e63f4a810811 | Guillaume Pinot | 2018-02-04T18:05:08 | Fix a bug arround required(true) | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 4b4dedd..ccebefe 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -142,7 +142,7 @@ fn gen_augmentation(fields: &Punctuated<Field, Comma>, app_var: &Ident) -> quote
Ty::Vec => quote!( .takes_value(t... | 2 | 79 | 1 |
bc027432497787e7bdbdfaccb8787d33396d4eb8 | Guillaume Pinot | 2018-02-04T17:33:59 | Update syn and friends | diff --git a/structopt-derive/Cargo.toml b/structopt-derive/Cargo.toml
index 4cd7209..d4c466f 100644
--- a/structopt-derive/Cargo.toml
+++ b/structopt-derive/Cargo.toml
@@ -13,8 +13,9 @@ license = "WTFPL"
travis-ci = { repository = "TeXitoi/structopt" }
[dependencies]
-syn = "0.11.4"
-quote = "0.3.12"
+syn = "0.12"... | 3 | 133 | 91 |
d74eee5e4637f60c10cbd9b2884fcd698d725810 | Guillaume Pinot | 2018-02-04T14:27:26 | Change `_raw` suffix by `raw()` wrapping | diff --git a/examples/raw_attributes.rs b/examples/raw_attributes.rs
index fc0f876..2b6c737 100644
--- a/examples/raw_attributes.rs
+++ b/examples/raw_attributes.rs
@@ -13,20 +13,20 @@ use structopt::clap::AppSettings;
/// An example of raw attributes
#[derive(StructOpt, Debug)]
-#[structopt(global_settings_raw = "... | 4 | 23 | 18 |
e592f3ef9f20b9dc75d37a15d46017f434e722e6 | Guillaume Pinot | 2018-02-04T14:13:15 | Rewrite attributes handling, failing when attributes are not used | diff --git a/structopt-derive/src/attrs.rs b/structopt-derive/src/attrs.rs
new file mode 100644
index 0000000..cda6356
--- /dev/null
+++ b/structopt-derive/src/attrs.rs
@@ -0,0 +1,222 @@
+// Copyright (c) 2018 The StructOpt developpers
+//
+// This work is free. You can redistribute it and/or modify it under
+// the te... | 2 | 273 | 284 |
98d8cae1f1950245f5e8897f871a8852d5b56315 | Guillaume Pinot | 2018-02-03T15:34:32 | Doc cleanups | diff --git a/src/lib.rs b/src/lib.rs
index 13d126f..1abcc05 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -26,6 +26,7 @@
//!
//! ```
//! #[macro_use] extern crate structopt;
+//! use std::path::PathBuf;
//! #[derive(StructOpt)]
//! #[structopt(name = "example", about = "An example of StructOpt usage.")]
//! struct ... | 1 | 13 | 10 |
087f7dc9cc17d0c43390bad1095ba0514a5d50b8 | Guillaume Pinot | 2018-02-03T15:16:03 | move structopt-derive documentation to structopt | diff --git a/src/lib.rs b/src/lib.rs
index b1c8ea4..13d126f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -7,21 +7,332 @@
#![deny(missing_docs)]
-//! `StructOpt` trait definition
+//! This crate defines the `StructOpt` trait and its custom derrive.
//!
-//! This crate defines the `StructOpt` trait. Alone, this cra... | 3 | 321 | 324 |
5a796774dcb40f79b4a45f76caebc0a7053c274c | Guillaume Pinot | 2018-02-01T23:38:06 | remove ignore for doc comment samples | diff --git a/examples/enum_tuple.rs b/examples/enum_tuple.rs
index 100aefd..7edd91e 100644
--- a/examples/enum_tuple.rs
+++ b/examples/enum_tuple.rs
@@ -1,5 +1,4 @@
-extern crate structopt;
-#[macro_use] extern crate structopt_derive;
+#[macro_use] extern crate structopt;
use structopt::StructOpt;
diff --git a/str... | 3 | 36 | 26 |
79f2c57212a915188e0365000e0b0ded1dd192af | Guillaume Pinot | 2018-02-01T22:20:19 | As the dummy const trick never worked as there was a bug, just remove it | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index acab319..75bc56c 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -530,7 +530,7 @@ fn gen_augmentation(fields: &[Field], app_var: &Ident) -> quote::Tokens {
let required = if cur_type == Ty::Option {
... | 1 | 17 | 25 |
7975343a03debafe9810083f21fb60d878415ae1 | Guillaume Pinot | 2018-01-30T17:38:35 | Support 1-uple enum variant as subcommand
This is a breaking change as it modifies the StructOpt trait.
fix #38 | diff --git a/Cargo.toml b/Cargo.toml
index 86fb3cf..394a77d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "structopt"
-version = "0.1.7"
+version = "0.2.0"
authors = ["Guillaume Pinot <texitoi@texitoi.eu>"]
description = "Parse command line argument by defining a struct."
documentation ... | 10 | 129 | 65 |
35423c96c4dc0eeaf139e880b54c330905fc82f6 | Sergio Benitez | 2018-02-03T14:15:03 | Add 'parse(from_occurrences)' parser. Don't special case 'u64'. (#48) | diff --git a/examples/basic.rs b/examples/basic.rs
index 4197da5..3959ccf 100644
--- a/examples/basic.rs
+++ b/examples/basic.rs
@@ -19,8 +19,8 @@ struct Opt {
#[structopt(short = "d", long = "debug")]
debug: bool,
- /// Verbose mode
- #[structopt(short = "v", long = "verbose")]
+ /// Verbose mode ... | 5 | 116 | 56 |
00a1e13fea3fce60a7dcefefa779a037b4d6b6e3 | Sune Kirkeby | 2018-01-23T14:47:06 | Allow opting out of clap default features. (#46) | diff --git a/Cargo.toml b/Cargo.toml
index eadd04b..86fb3cf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "structopt"
-version = "0.1.6"
+version = "0.1.7"
authors = ["Guillaume Pinot <texitoi@texitoi.eu>"]
description = "Parse command line argument by defining a struct."
documentation ... | 2 | 14 | 2 |
cc6dfd2e542440e4f194ce7823add4bf09ba9c22 | Xavier Bestel | 2017-12-05T14:20:17 | Add doc on colored help (#40)
Added a note about `clap::App`'s _raw methods, and an example specifically about colored help text. | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 486404b..cdda307 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -42,6 +42,32 @@
//! - `author`: Defaults to the crate author name given by Cargo.
//! - `about`: Defaults to the crate description given by Ca... | 1 | 26 | 0 |
3186513b5709b741fd5722504f54df1591cf9657 | Guillaume Pinot | 2017-11-25T22:38:37 | Improve doc about positional arguments
fix #33 | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 0ab193e..486404b 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -53,13 +53,13 @@
//!
//! The type of the field gives the kind of argument:
//!
-//! Type | Effect |... | 1 | 7 | 7 |
5bf0d2ffb579bd7750473fd21fe47cf698344f6f | Guillaume Pinot | 2017-11-25T22:10:11 | Don't call author, version and about if empty argument
fix #31 | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 81be7a4..0ab193e 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -392,13 +392,16 @@ fn extract_attrs<'a>(attrs: &'a [Attribute], attr_source: AttrSource) -> Box<Ite
Box::new(doc_comments.into_iter().chain(set... | 2 | 48 | 14 |
dca4b8daab2bbf395ad55b5dfa140399b7f7634e | Guillaume Pinot | 2017-11-23T15:03:50 | Improve documentation.
Fix #30 | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 19b586d..81be7a4 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -53,13 +53,13 @@
//!
//! The type of the field gives the kind of argument:
//!
-//! Type | Effect | Added method call ... | 1 | 8 | 8 |
227d1fa73c375b0479e182fb041b1a8630d29f0a | Guillaume Pinot | 2017-11-14T14:18:13 | fix bug with optional subsubcommand and Enum | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index b6de4b3..19b586d 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -292,7 +292,7 @@ pub fn structopt(input: TokenStream) -> TokenStream {
gen.parse().unwrap()
}
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone,... | 3 | 59 | 18 |
13fc4fb66a5894b6b37623fb0cc45631171235ae | kennytm | 2017-11-09T09:23:02 | Implement custom string parser from either `&str` or `&OsStr`. (#28)
* Implement custom string parser from either &str or &OsStr.
Fix #2.
Fix #3.
* Addressed review comments. | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 655486a..b6de4b3 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -63,8 +63,9 @@
//!
//! The `FromStr` trait is used to convert the argument to the given
//! type, and the `Arg::validator` method is set to a met... | 2 | 344 | 19 |
43710cf96951838b12663b581aaeb21879f63e32 | Guillaume Pinot | 2017-11-01T21:35:27 | update to 0.1.3 | diff --git a/Cargo.toml b/Cargo.toml
index a5c7a8b..65c3e04 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "structopt"
-version = "0.1.2"
+version = "0.1.3"
authors = ["Guillaume Pinot <texitoi@texitoi.eu>"]
description = "Parse command line argument by defining a struct."
documentation ... | 2 | 3 | 3 |
5ba275680b31dae96899c7fa218efcbbfdbe7893 | Guillaume Pinot | 2017-11-01T21:12:44 | new release | diff --git a/Cargo.toml b/Cargo.toml
index 438aeb7..a5c7a8b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "structopt"
-version = "0.1.1"
+version = "0.1.2"
authors = ["Guillaume Pinot <texitoi@texitoi.eu>"]
description = "Parse command line argument by defining a struct."
documentation ... | 2 | 3 | 3 |
96a726aeb746219b9c5b750b06f91ff28a82c84f | Guillaume Pinot | 2017-11-01T21:00:15 | Handle multiline doc comment as help message
fix #25 | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index b0bbb33..7a1a4e8 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -296,7 +296,7 @@ fn extract_attrs<'a>(attrs: &'a [Attribute], attr_source: AttrSource) -> Box<Ite
_ => None,
}));
- let d... | 2 | 19 | 12 |
4880ccb02540afe17b7000ca4aa673dea0f9b282 | Guillaume Pinot | 2017-11-01T20:30:46 | Fix a privacy bug
Fix #24 | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 8e2ece8..b0bbb33 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -539,7 +539,7 @@ fn gen_augment_clap(fields: &[Field]) -> quote::Tokens {
let app_var = Ident::new("app");
let augmentation = gen_augmenta... | 2 | 34 | 3 |
f7a4be13ca98fe839727f63f7321951ec7baa921 | Guillaume Pinot | 2017-09-22T20:21:07 | update to 0.1.1 | diff --git a/Cargo.toml b/Cargo.toml
index e18bbbb..438aeb7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "structopt"
-version = "0.1.0"
+version = "0.1.1"
authors = ["Guillaume Pinot <texitoi@texitoi.eu>"]
description = "Parse command line argument by defining a struct."
documentation ... | 2 | 3 | 3 |
ebde32aa5b344c5dc9a1c8d499a35978696f0456 | Seebi | 2017-11-01T07:41:58 | Add raw attributes (#26)
* Add raw attributes
This makes it possible to call clap functions that don't take strings,
but any arbitrary value. Even functions that take more than one argument
can be called.
All attributes that are called `attribute_name_raw` are augmented to
`attribute_name(value)` without quot... | diff --git a/examples/raw_attributes.rs b/examples/raw_attributes.rs
new file mode 100644
index 0000000..a1ff6be
--- /dev/null
+++ b/examples/raw_attributes.rs
@@ -0,0 +1,37 @@
+// Copyright (c) 2017 Guillaume Pinot <texitoi(a)texitoi.eu>
+//
+// This work is free. You can redistribute it and/or modify it under
+// the... | 3 | 151 | 27 |
89f0078a0fd61c56662f0c593f8a9a08c86289ef | Pascal Hertleif | 2017-08-27T16:19:19 | Format multiple authors
Cargo's `CARGO_PKG_AUTHORS` env var separates author names with a colon,
which is not very pretty to look at. So, let's replace it with a comma.
Clap has the same functionality it its `crate_authors!` macro but as
it's only a few lines of code I didn't want to call that. | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index d2fac39..a91bca3 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -471,11 +471,20 @@ fn gen_from_clap(struct_name: &Ident, fields: &[Field]) -> quote::Tokens {
}
}
+fn format_author(raw_authors: Lit) -> Lit... | 1 | 11 | 2 |
b4494747c7889d97ae7aca9689688f45b779032f | Pascal Hertleif | 2017-08-27T16:19:32 | Remove some trailing spaces | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 57a9424..d2fac39 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -24,7 +24,7 @@
//! }
//! ```
//!
-//! So `derive(StructOpt)` tells Rust to generate a command line parser,
+//! So `derive(StructOpt)` tells Rus... | 1 | 10 | 10 |
7c60c62ac549a180347a1f88412d5453f65efbdb | Tshepang Lekhonkhobe | 2017-07-18T22:46:54 | doc: improve explanation of "subcommands" | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 3db8e81..57a9424 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -99,11 +99,13 @@
//!
//! ## Subcommands
//!
-//! Some applications, like `git`, support "subcommands;" an extra command that
-//! is used to dif... | 1 | 6 | 4 |
a7224b5255afd4c168b7c7678d6544f00eea3e54 | William Yao | 2017-07-07T17:41:55 | move assert | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 9178842..3db8e81 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -359,6 +359,9 @@ fn gen_augmentation(fields: &[Field], app_var: &Ident) -> quote::Tokens {
quote!( let #app_var = #subcmd_type ::augmen... | 1 | 3 | 2 |
443cc3e1458bae566be9dd925b04de65f3a528c0 | William Yao | 2017-07-07T17:40:10 | move `augment_clap` into inherent impl | diff --git a/src/lib.rs b/src/lib.rs
index 6890550..36477c3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -26,9 +26,6 @@ pub trait StructOpt {
/// Returns the corresponding `clap::App`.
fn clap<'a, 'b>() -> clap::App<'a, 'b>;
- /// Add this app's arguments/subcommands to another `clap::App`.
- fn augmen... | 2 | 5 | 5 |
f6bd33d5deff61f165bae300e5e3d4c65f6e87f3 | William Yao | 2017-07-04T22:11:30 | update structopt-derive documentation to reflect unit subcommands change | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index e79d9df..6535669 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -217,9 +217,9 @@
//!
//! #[derive(StructOpt)]
//! enum Command {
-//! Bar {},
-//! Baz {},
-//! Quux {}
+//! Bar,
+//! Baz,
... | 1 | 3 | 3 |
810831cfe158b25c6f41bd82db170bb6f025a56d | William Yao | 2017-07-04T22:09:54 | add support for unit-variant subcommands | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 700524b..e79d9df 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -535,6 +535,7 @@ fn gen_augment_clap_enum(variants: &[Variant]) -> quote::Tokens {
let app_var = Ident::new("subcommand");
let arg... | 2 | 21 | 2 |
91fb4a40e4da7458a5f779b13d359fc428b213ba | William Yao | 2017-07-04T21:59:27 | allow for documentation to be placed on subcommands | diff --git a/examples/git.rs b/examples/git.rs
new file mode 100644
index 0000000..f25d66c
--- /dev/null
+++ b/examples/git.rs
@@ -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 eithe... | 3 | 65 | 5 |
3772285091732c7a8b25f3333599f2eea5553078 | William Yao | 2017-07-03T21:08:18 | add extra Arg methods in doc so examples still work | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 305faff..1423b39 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -146,7 +146,7 @@
//! #[derive(StructOpt)]
//! #[structopt(name = "make-cookie")]
//! struct MakeCookie {
-//! #[structopt(name = "supervisor"... | 1 | 1 | 1 |
e05c792f658787096b2b0b7095df7b973c1f9a7d | William Yao | 2017-07-03T21:05:17 | fix typoes | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index d8e9ab3..305faff 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -44,7 +44,7 @@
//!
//! Then, each field of the struct not marked as a subcommand corresponds
//! to a `clap::Arg`. As with the struct attributes,... | 1 | 2 | 2 |
c3815cdd812085f7203d45bda41146a508a0eb7b | William Yao | 2017-07-03T21:01:00 | remove unnecessary Option in documentation [ci skip] | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index bc10466..d8e9ab3 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -147,7 +147,7 @@
//! #[structopt(name = "make-cookie")]
//! struct MakeCookie {
//! #[structopt(name = "supervisor", default_value = "Puck")]... | 1 | 1 | 1 |
6f385b4adbef825b0e3c26a663549f45436c8267 | William Yao | 2017-07-03T19:49:01 | add missing backticks (oops) | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index a29b762..bc10466 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -206,6 +206,7 @@
//!
//! A nested subcommand can be marked optional:
//!
+//! ```ignore
//! #[derive(StructOpt)]
//! #[structopt(name = "foo")]... | 1 | 2 | 0 |
593f042c770f2b18a8403a2defc436bb826d0966 | William Yao | 2017-07-03T19:30:14 | bump versions of structopt and structopt-derive | diff --git a/Cargo.toml b/Cargo.toml
index e787c87..461f5f7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "structopt"
-version = "0.0.5"
+version = "0.0.6"
authors = ["Guillaume Pinot <texitoi@texitoi.eu>"]
description = "Parse command line argument by defining a struct."
documentation ... | 2 | 2 | 2 |
a21a01acb237e3feaff5cf7078d3b985781281e8 | William Yao | 2017-07-03T19:26:03 | add note about using doc comments for help messages (texitoi/structopt#1) | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 07c758e..a29b762 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -37,7 +37,7 @@
//! if not specified:
//!
//! - `name`: The binary name displayed in help messages. Defaults
- to the crate name given by... | 1 | 21 | 1 |
12e88e1ea8fee78aa51587eab1f478e6e6dddb4b | William Yao | 2017-07-03T19:22:17 | note about optional subcommands | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 80370ab..07c758e 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -181,6 +181,25 @@
//! + `make-cookie pound 50`
//! + `make-cookie sparkle -mmm --color "green"`
//! + `make-cookie finish 130 glaze 3`
+//!
+//! ... | 1 | 19 | 0 |
a8e466c7bb41f960f67e9585cdc69558f6014171 | William Yao | 2017-07-03T19:18:31 | add documentation in structopt-derive about how to use subcommands | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 11f666e..80370ab 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -76,6 +76,111 @@
//! .help("Set speed")
//! .default_value("42")
//! ```
+//!
+//! ## Subcomamnds
+//!
+//! Some applications, like `git... | 1 | 105 | 0 |
f68a35c3a18511452a0efd104e87f504924b0df5 | William Yao | 2017-07-03T18:44:17 | preliminary editing of structopt-derive documentation | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 1c198d2..11f666e 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -5,9 +5,9 @@
// Version 2, as published by Sam Hocevar. See the COPYING file for
// more details.
-//! How to `derive(StructOpt)`
+//! ## How to... | 1 | 22 | 20 |
f9fc92399316ba339883901acda627eae9611879 | William Yao | 2017-07-03T18:36:36 | add link to structopt-derive documentation from structopt crate | diff --git a/src/lib.rs b/src/lib.rs
index b67860d..6890550 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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 imp... | 1 | 3 | 2 |
a20a9e7be0208f06698746c6f699da71b8e38df2 | William Yao | 2017-07-03T18:29:37 | fix hyphenated subcommands | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 92b0b61..1c198d2 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -379,11 +379,11 @@ fn gen_augment_clap_enum(variants: &[Variant]) -> quote::Tokens {
let name = extract_attrs(&variant.attrs, AttrSource::S... | 1 | 3 | 3 |
b295234d5d9597b3a64ebc8b34ede60302012e7f | William Yao | 2017-06-30T01:02:59 | add test suite for nested subcommands (texitoi/structopt#1) | diff --git a/tests/nested-subcommands.rs b/tests/nested-subcommands.rs
new file mode 100644
index 0000000..d978982
--- /dev/null
+++ b/tests/nested-subcommands.rs
@@ -0,0 +1,116 @@
+// Copyright (c) 2017 Guillaume Pinot <texitoi(a)texitoi.eu>
+//
+// This work is free. You can redistribute it and/or modify it under
+//... | 1 | 116 | 0 |
91e2d28e81c4d1e6d7257c9e0d6cb27e9268fda3 | William Yao | 2017-06-30T00:53:07 | allow for optional subcommands (texitoi/structopt#1) | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index abd0db0..92b0b61 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -447,7 +447,13 @@ fn gen_from_subcommand(name: &Ident, variants: &[Variant]) -> quote::Tokens {
}
fn impl_structopt_for_struct(name: &Ident, fie... | 1 | 7 | 1 |
baa96165f1627dc0ec6b1b54389661acc2b38f28 | William Yao | 2017-06-30T00:44:34 | ignore unused matches for empty subcommands (texitoi/structopt#1) | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 62bc8b3..abd0db0 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -499,7 +499,8 @@ fn impl_structopt(ast: &DeriveInput) -> quote::Tokens {
let dummy_const = Ident::new(format!("_IMPL_STRUCTOPT_FOR_{}", struc... | 1 | 2 | 1 |
c010cf0266dd43e84748fa450fc1da5ce1a45605 | William Yao | 2017-06-30T00:37:52 | add ability to put in nested subcommands (texitoi/structopt#1) | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 184ec5d..62bc8b3 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -92,6 +92,7 @@ pub fn structopt(input: TokenStream) -> TokenStream {
gen.parse().unwrap()
}
+#[derive(Copy, Clone)]
enum Ty {
Bool,
... | 1 | 93 | 54 |
e00e263f23c63830f382196828ca714bbfbc29dc | William Yao | 2017-06-29T15:52:11 | add test for subcommand parsing (texitoi/structopt#1) | diff --git a/tests/subcommands.rs b/tests/subcommands.rs
new file mode 100644
index 0000000..e2aa442
--- /dev/null
+++ b/tests/subcommands.rs
@@ -0,0 +1,57 @@
+// Copyright (c) 2017 Guillaume Pinot <texitoi(a)texitoi.eu>
+//
+// This work is free. You can redistribute it and/or modify it under
+// the terms of the Do W... | 1 | 57 | 0 |
00c659b9c6681a0e58f75f86027c24ece92a99f3 | William Yao | 2017-06-29T15:52:01 | lifetime fix | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 0c3525f..184ec5d 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -399,7 +399,7 @@ fn gen_from_subcommand(name: &Ident, variants: &[Variant]) -> quote::Tokens {
});
quote! {
- fn from_subcommand<... | 1 | 1 | 1 |
30a3b3145c88fc98d1a4c8a8513c7c5df5c73658 | William Yao | 2017-06-29T15:25:07 | prototype enum stuff? | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 8ef9145..0c3525f 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -181,6 +181,20 @@ fn from_attr_or_env(attrs: &[(Ident, Lit)], key: &str, env: &str) -> Lit {
.unwrap_or_else(|| Lit::Str(default, StrStyle:... | 1 | 123 | 4 |
fd67b014667b5cc87b1cc40bb38b36ba50c0f84d | William Yao | 2017-06-29T14:00:04 | factor out code generation that's needed for enums | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index a4c441d..8ef9145 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -181,19 +181,48 @@ fn from_attr_or_env(attrs: &[(Ident, Lit)], key: &str, env: &str) -> Lit {
.unwrap_or_else(|| Lit::Str(default, StrStyle... | 1 | 69 | 51 |
08aeb9b1fb95e540dc29d784c9abb0c2fddd111c | William Yao | 2017-06-29T00:40:55 | skeleton of enum impl | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 48c4534..a4c441d 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -300,7 +300,15 @@ fn impl_structopt_for_struct(name: &Ident, fields: &[Field], attrs: &[Attribute]
}
fn impl_structopt_for_enum(_variants: &[Var... | 1 | 9 | 1 |
00f313b5d12861fa74d704d9d7f1d6123303fff8 | William Yao | 2017-06-29T00:33:32 | split `impl_structopt` into struct and enum branches | diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs
index 403ec4d..48c4534 100644
--- a/structopt-derive/src/lib.rs
+++ b/structopt-derive/src/lib.rs
@@ -228,8 +228,8 @@ fn gen_from_clap(struct_name: &Ident, s: &[Field]) -> quote::Tokens {
}
}
-fn gen_clap(ast: &DeriveInput) -> quote::Tokens ... | 1 | 29 | 14 |
a4826404f3a96a8e5a87eaf4cc5b410451990e0c | William Yao | 2017-06-29T00:16:31 | separate creating app and adding arguments | diff --git a/src/lib.rs b/src/lib.rs
index e6de4a5..b67860d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -25,6 +25,9 @@ pub trait StructOpt {
/// Returns the corresponding `clap::App`.
fn clap<'a, 'b>() -> clap::App<'a, 'b>;
+ /// Add this app's arguments/subcommands to another `clap::App`.
+ fn augmen... | 2 | 22 | 8 |
859ac77f4e51d8852e863f8ae2cea265693320d3 | Guillaume Pinot | 2017-06-16T15:12:21 | Update to 0.0.5 (oups...) | diff --git a/Cargo.toml b/Cargo.toml
index 6ed0d41..e787c87 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "structopt"
-version = "0.0.4"
+version = "0.0.5"
authors = ["Guillaume Pinot <texitoi@texitoi.eu>"]
description = "Parse command line argument by defining a struct."
documentation ... | 2 | 3 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.