Commit graph

61 commits

Author SHA1 Message Date
Martin Geisler
d6743bb70d Fix compilation warnings (#825)
* tests: remove unnecessary mut

When building the projec, I was told

    warning: variable does not need to be mutable, #[warn(unused_mut)]
    on by default
      --> tests/macros.rs:39:9
       |
    39 |     let mut app = clap_app!(("app name with spaces-and-hyphens") =>
       |         ^^^^^^^

* examples: remove unused variable

The inner Some value is not used in the match arm:

    warning: unused variable: `local_matches`,
    #[warn(unused_variables)] on by default
       --> examples/20_subcommands.rs:128:32
        |
    128 |                 ("local", Some(local_matches)) =>{
        |                                ^^^^^^^^^^^^^
2017-01-29 18:13:49 -08:00
Arnavion
f41ec962c2 feat(clap_app!): Support --("some-arg-name") syntax for defining long arg names
Used for arg names that aren't idents.

Ref #321
2016-12-12 22:42:11 -08:00
Kevin K
0e0f33547a
docs(Examples): adds subcommand examples
Closes #766
2016-12-07 15:28:21 -05:00
Wim
c22fbc0735 docs: Fix typo in example 13a_enum_values_automatic 2016-10-30 20:03:05 +01:00
mvaude
847f719921 fix(yaml-example): inconsistent args
change yaml example to be consistent with its configuration

fix #707, #708
2016-10-27 15:12:12 +02:00
tormol
cd516006e3 imp: Stabilize clap_app!
It was de-stabilized in 2.0.0 but hasn't been changed since.

This commit also updates docs to reflect that the "unstable" feature does nothing now.
2016-10-16 21:33:52 +02:00
Kevin K
6b9bd215c1
docs(Default Values): adds better examples on using default values
Closes #418
2016-09-18 16:01:27 -04:00
Kevin K
b7793a2f4d Issues rollup (#637)
* feat: adds App::with_defaults to automatically use crate_authors! and crate_version! macros

One can now use

```rust
let a = App::with_defaults("My Program");

// same as
let a2 = App::new("My Program")
	.version(crate_version!())
	.author(crate_authors!());
```

Closes #600

* imp(YAML Errors): vastly improves error messages when using YAML

When errors are made while developing, the panic error messages have
been improved instead of relying on the default panic message which is
extremely unhelpful.

Closes #574

* imp(Completions): uses standard conventions for bash completion files, namely '{bin}.bash-completion'

Closes #567

* imp(Help): automatically moves help text to the next line and wraps when term width is determined to be too small, or help text is too long

Now `clap` will check if it should automatically place long help
messages on the next line after the flag/option. This is determined by
checking to see if the space taken by flag/option plus spaces and values
doesn't leave enough room for the entirety of the help message, with the
single exception of of if the flag/option/spaces/values is less than 25%
of the width.

Closes #597

* tests: updates help tests to new forced new line rules

* fix(Groups): fixes some usage strings that contain both args in groups and ones that conflict with each other

Args that conflict *and* are in a group will now only display in the
group and not in the usage string itself.

Closes #616

* chore: updates dep graph

Closes #633

* chore: clippy run

* style: changes debug header to match other Rust projects

* chore: increase version
2016-08-27 23:42:31 -04:00
Kevin K
b6c99e1377 docs(YAML): fixes example 17's incorrect reference to arg_groups instead of groups
Closes #601
2016-07-25 20:15:58 -04:00
Roman A. Taycher
05edc4338e removed unstable gate from crate_authors 2016-07-23 15:56:42 -07:00
Hendrik Sollich
6ba910e89b test: adds failing doc test 2016-05-11 20:16:56 +02:00
Roman A. Taycher
ac46864381 move import inside function to avoid conditional compilation warning 2016-04-11 16:49:39 -07:00
Roman A. Taycher
38fb59abf4 feat(Authors Macro): adds a crate_authors macro
Adds a crate_authors! macro that fetches
crate authors from a (recently added)
cargo enviromental variable populated
from the Cargo file. Like the
crate_version macro.

Closes #447
2016-04-11 16:17:44 -07:00
Kevin K
ab41be700b imp(arg_enum): enum declared with arg_enum returns [&'static str; #] instead of Vec 2016-01-31 08:23:34 -05:00
Kevin K
90542747ac chore: fixes doc and style mistakes 2016-01-28 21:58:40 -05:00
Kevin K
f8692a0b3a docs: updates examples for 2x release
Closes #394
2016-01-28 11:46:12 -05:00
Kevin K
c3e96232c9 tests(v2): fixing more tests on the new v2 base 2016-01-28 11:45:31 -05:00
Kevin K
0031d78564 refactor(v2): improving macros for code dedup 2016-01-28 11:45:31 -05:00
Kevin K
7fc18e685f test(v2): fixing tests to pass under new v2 changes 2016-01-28 11:45:31 -05:00
Sung Rim Huh
3936b28035 tests(yaml): use scope wide attribute 2016-01-11 21:13:14 -08:00
Sung Rim Huh
575de089a3 examples(17_yaml): conditinonally compile 17_yaml example 2015-12-08 21:10:00 -08:00
Kevin K
945b00a0c2 docs: fixes panic in 14_groups example
Closes #295
2015-10-01 10:20:04 -04:00
Kevin K
7005cf8c47 style: removes trailing whitespace 2015-09-30 23:59:40 -04:00
Nelson Chen
f85640f9f6 docs: fixes various typos and spelling 2015-09-20 16:59:32 -07:00
Alexander Kuvaev
4ba6249c3c examples: add clap_app quick example 2015-09-09 16:21:59 +03:00
James McGlashan
443841b012 feat: Builder macro to assist with App/Arg/Group/SubCommand building 2015-09-08 22:53:31 +10:00
Alexander Kuvaev
9b84862229 examples(17_yaml): fixed example 2015-09-02 01:09:08 +03:00
Kevin K
82a09abb32 Merge branch 'issue-205' of https://github.com/Vinatorul/clap-rs into vin-issue-205 2015-09-01 00:05:54 -04:00
Kevin K
0e53642a85 chore: fixes .travis.yml for building with yaml feature of clap
Closes #80
2015-08-31 23:59:35 -04:00
Kevin K
ab41d7f382 docs(YAML): adds examples for using YAML to build a CLI 2015-08-31 23:57:35 -04:00
Kevin K
8cbacd8883 docs(Examples): adds better usage examples instead of having unused variables 2015-08-30 16:29:45 -04:00
Kevin K
4f836ee5ef refactor(Examples): corrects compiler warnings about names
Closes #204
2015-08-30 15:43:57 -04:00
Alexander Kuvaev
5a8e341e8e refactor(ArgGroup): changed Vec<&str> using to &[&str] 2015-08-30 20:22:26 +03:00
SungRim Huh
12705079ca examples: Add AppSettings example 2015-08-27 23:35:08 -05:00
SungRim Huh
b9997d1fca examples: add custom validator example 2015-08-27 10:50:39 -05:00
SungRim Huh
d4f1b740ed examples: fix indentation 2015-08-27 10:50:05 -05:00
Kevin K
a5b8b3584b test: fixes tests for 1.0 and deprecated functions 2015-06-29 22:21:47 -04:00
Kevin K
ebf442ebeb docs: updates docs to new version flag defaults 2015-06-16 20:46:11 -04:00
Tshepang Lekhonkhobe
8891d92917 docs(clap): fix typos caught by codespell
Thanks to [tshepang](https://github.com/tshepang) for catching these!
2015-05-05 22:02:14 -04:00
Kevin K
0cc2f69839 feat(arg): allow other types besides Vec for multiple value settings
Breaking Change

Instead of requiring a Vec<&str> for various Arg::*_all() and
Arg::possible_values() methods this
commit now requires a generic IntoIterator<Item=AsRef<str>> which allows
things such as constant arrays. This change requires that any
Arg::*_all() methods be changed from vec!["val", "val"] -> let vals =
["val", "val"]; some_arg.possible_values(&vals) (or vals.iter()).

Closes #87
2015-04-29 17:52:13 -04:00
Kevin K
39d744cefd docs(groups): adds examples of ArgGroup usage 2015-04-27 23:18:58 -04:00
Kevin K
c630969aa3 feat(macros.rs): add macro to get version from Cargo.toml 2015-04-19 14:22:03 -04:00
Kevin K
31b476ca99 refactor(arg.rs): remove deprecation warnings for stable rustc 2015-04-18 13:37:01 -04:00
Kevin K
2c499f8015 feat(macros): add ability to create enums pub or priv with derives
Err type of FromStr trait changed from &'a str->String in order
to allow showing valid values on failed parse

Breaking Change
2015-04-17 11:17:19 -04:00
Kevin K
fb672aff56 feat(macros): add macro to create custom enums to use as types 2015-04-16 14:21:32 -04:00
Kevin K
178c50ffe6 docs(examples): add example covering custom enums 2015-04-16 13:31:50 -04:00
Kevin K
1a192521b6 docs(clap): fix typo core->std 2015-04-16 12:53:05 -04:00
Kevin K.
77fdd5ffa7 docs(12_TypedValues.rs): fix typo in trait name 2015-04-16 11:21:58 -04:00
Kevin K
f246fa1778 docs(examples): add examples for value_t! and value_t_or_exit! macros 2015-04-14 15:37:21 -04:00
Kevin K
b389743672 docs(clap): improve examples and documentation as well as include new from_usage() features 2015-04-13 22:18:50 -04:00