Commit graph

915 commits

Author SHA1 Message Date
Kevin K
6f638a53c1
perf: doesn't run arg_post_processing on multiple values anymore 2017-03-10 08:24:28 -05:00
Kevin K
150756b989
setting(InferSubcommands): adds a setting to allow one to infer shortened subcommands or aliases (i.e. for subcommmand "test", "t", "te", or "tes" would be allowed assuming no other ambiguities)
Closes #863
2017-03-10 08:22:31 -05:00
Joost Yervante Damad
8adf353e0b
fix(help): don't show ARGS when there are only hidden positional args
Also no need to check for Hidden inside for that already is filtered
on !Hidden.

Closes #882
2017-03-10 08:22:31 -05:00
Kevin K
24e3839220
perf: changes internal use of VecMap to Vec for matched values of Args
This makes a very big difference for CLIs that parse a large number of
values (think ripgrep over a large directory).

This commit improved the ripgrep parsing of ~2,000 values, simulating
giving ripgrep a bunch of files. Parsing when from ~1,200,000 ns to
~400,000 ns! This was conducted a i7-5600U 2.6GHz
2017-03-10 08:22:31 -05:00
Caleb Jones
c5dac3fa43 Support loading help_message and version_message from the YAML 2017-03-10 01:54:50 -05:00
Caleb Jones
389c413b70 Allow customizing the --version and --help messages 2017-03-10 01:01:56 -05:00
Anthony Ramine
f4939ad560 Remove direct dependency on libc
It's not actually used anymore anywhere.
2017-03-05 19:44:16 +01:00
Kevin K
8da0303bc0
perf: vastly reduces the amount of cloning when adding non-global args minus when they're added from App::args which is forced to clone 2017-02-28 08:30:14 -05:00
Kevin K
0a922e5f61
tests: adds parsing cases to ripgrep bench 2017-02-28 08:30:14 -05:00
Kevin K
0efa411963
perf: refactor to remove unneeded vectors and allocations and checks for significant performance increases
Building an `App` struct with a fair number of args/flags/switches, etc. (used ripgrep as test case)
went from taking ~21,000 ns to ~13,000ns.
2017-02-28 08:30:13 -05:00
Kevin K
b55cae5fdb
refactor: removes unused fields and moves some bools to bitfields 2017-02-28 08:30:09 -05:00
Corey Farwell
5ee2665e7a Implement ExactSizeIterator for Values. (#877) 2017-02-26 23:20:52 -05:00
Kevin K
6bf94606c2
test: fixes failing doc test 2017-02-22 20:37:56 -05:00
Marco A L Barbosa
fa26d40a18 Fix missing line before code block 2017-02-22 11:25:10 -03:00
Kevin K
588f373ea8
chore: rustfmt run 2017-02-20 21:16:14 -05:00
Kevin K
8c2dd28718
fix: fixes some memory leaks when an error is detected and clap exits 2017-02-20 21:16:07 -05:00
Kevin K
6b5725836f Merge branch 'master' into issues-833,849 2017-02-20 20:36:15 -05:00
Kevin K
1ae2110801
fix: fixes a trait that's marked private accidentlly, but should be crate internal public 2017-02-20 20:31:57 -05:00
Kevin K
10ca4d1e21
chore: rustfmt run 2017-02-20 20:24:28 -05:00
Kevin K
f002693dec
feat(Options): adds the ability to require the equals syntax with options --opt=val
Closes #833
2017-02-20 20:24:27 -05:00
Kevin K
e0f7722685
style: improves the style of doc tests and examples to increase readability and uniformity 2017-02-20 20:24:27 -05:00
Kevin K
0f2a378219
api: provides default_value_os and default_value_if[s]_os
One can now define default values that contain invalid UTF-8.

The underlying implementation has also been changed to use OsStrs in order to avoid duplication
of code and provide the new APIs basically for free.

Closes #849
2017-02-20 20:24:24 -05:00
Kevin K
fb7057cc7a
refactor(Arg): removes duplicate and uses Base, Switched, and Valued internally now 2017-02-20 19:06:36 -05:00
Kevin K
65b12f9107
chore: clippy run 2017-02-20 19:06:36 -05:00
Niklas Claesson
1971209c0c Fix minor documentation bug 2017-02-20 23:13:06 +01:00
Peter Williams
68e03681d8 refactor: use the atty crate for isatty() detection
Not only does this remove some unsafe code from clap itself, `atty` does the
right thing on Windows too. This isn't relevant now since we don't currently
support colorized output on Windows, but will come in handy if/when we
implement that feature (#836).
2017-02-19 11:12:55 -05:00
Eduard-Mihai Burtescu
f28b2353b2 Add missing fragment specifier to a clap_app! rule. 2017-02-18 12:03:41 +02:00
Peter Williams
e635658dad tests: fix clap_app! doctest 2017-02-16 10:48:34 -07:00
Kevin K
e3296e566b Docs (#854)
* docs(App::template) adds missing categories and fixes descriptions

* docs(clap_app): documents all the shorthand syntax

Closes #736

* chore: fixes crates.io category...hopefully
2017-02-16 09:44:44 -05:00
Kevin K
5e9b9cf4dd
fix(Completions): fixes a bug that tried to propogate global args multiple times when generating multiple completion scripts
Closes #846
2017-02-15 11:01:41 -05:00
Kevin K
92919f5f67 Call this PR "Raid" cause it's squashin bugs! (#843)
* tests: adds tests for default values triggering conditional requirements

* fix: fixes a bug where default values should have triggered a conditional requirement but didnt

Closes #831

* tests: adds tests for missing conditional requirements in usage string of errors

* fix: fixes a bug where conditionally required args werent appearing in errors

* tests: adds tests for completion generators

* tests: adds tests for completions with binaries names that have underscores

* fix: fixes a bug where ZSH completions would panic if the binary name had an underscore in it

Closes #581

* fix: fixes bash completions for commands that have an underscore in the name

Closes #581

* chore: fix the category for crates.io

* docs(Macros): adds a warning about changing values in Cargo.toml not triggering a rebuild automatically

Closes #838

* fix(Completions): fixes a bug where global args weren't included in the generated completion scripts

Closes #841

* fix: fixes a println->debugln typo

* chore: increase version
2017-02-03 17:43:49 -05:00
Kevin K
07d985d8c5 Issues 839,840 (#842)
* fix: fixes a critical bug where subcommand settings were being propogated too far

Closes #832

* imp: adds ArgGroup::multiple to the supported YAML fields for building ArgGroups from YAML

Closes #840

* chore: increase version
2017-02-03 15:46:25 -05:00
Martin Geisler
564c5f0f17 fix: allow final word to be wrapped in wrap_help
Before, inserting a newline did not move the prev_space index forward.
This meant that the next word was measured incorrectly since the
length was measured back to the word before the newly inserted
linebreak.

Fixes #828.
2017-01-30 18:33:48 +01:00
Martin Geisler
84d8c5476d fix: actually show character in debug output
The &help[j..j] string slice was empty so nothing was shown.
2017-01-30 18:33:48 +01:00
Martin Geisler
aff4ba18da fix: include final character in line lenght
Before, wrapping the help text at, say, 80 characters really meant
that every line could be at most 79 characters wide.

Lines can now be up to and including avail_chars columns wide.

If needed, a desired margin or padding can be subtracted from the
avail_chars argument at a later point.
2017-01-30 18:33:48 +01:00
Kevin K
69bd16c410
chore: clippy run 2017-01-29 21:19:00 -05:00
Richard Janis Goldschmidt (Beckert)
f9f778e8a4 Fix finding required arguments in group arguments (#829)
This fixes #827. The problem was that the check `grp.args.contains(&grp.args[i])` was a) trivially fulfilled (of course `grp.args[i]` is contained in `grp.args`) and b) causing an out-of-bounds error, since the indices were taken from `.required.len()`.

With this change the argument in the group will be removed from the list of required arguments, as intended.
2017-01-29 18:14:04 -08:00
Trevor Spiteri
5b29be9b07 docs: fix link from app_from_crate! to crate_authors! (#822) 2017-01-29 18:13:34 -08:00
Richard Janis Goldschmidt (Beckert)
ed52851c5d Fix confusing, wrong wording in doc (#821) 2017-01-29 18:12:54 -08:00
Richard Janis Goldschmidt
f1b11886dc Explain how AppSettings::ArgRequiredElseHelp and Arg::default_value interact
When calling the executable without arguments one expects a help message. However, if even one argument has a default value, the validation step of the parser will always see at least one argument, and therefore report success. This effectively disables the settings.
2017-01-18 17:14:06 +01:00
pixelistik
5de1b6e1c8 doc: Fix typo 2017-01-08 23:45:03 +01:00
Brian Bowman
4f30a65b9c docs: fix spelling of "guaranteed" 2017-01-07 20:18:59 -06:00
Kevin K
9d88f19181
refactor: 'reverts' a breaking change until further discussion and approval has taken place 2017-01-05 19:26:16 -05:00
Kevin K
6edde30b8e
setting(AllowMissingPositional): allows one to implement $ prog [optional] <required>
Closes #636
2017-01-04 00:02:26 -05:00
Kevin K
985536c8eb
setting(PropagateGlobalValuesDown): adds a setting to allow automatically propagating global args values down through *used* subcommands
Closes #694
2017-01-02 23:05:50 -05:00
Kevin K
20842ed8c2
fix: fixes an issue where the full help message wasn't written when doing App::write_help
Closes #801
2017-01-02 23:05:50 -05:00
Kevin K
ad4691b71a
feat(Help Wrapping): long app names (with spaces), authors, and descriptions are now wrapped appropriately
Closes #777
2017-01-02 16:43:45 -05:00
Kevin K
1f33de5450
imp(Default Values): improves the error message when default values are involved
Closes #774
2017-01-02 16:43:07 -05:00
Kevin K
26c670ca16
fix(Low Index Multiples): fixes a bug which caused combinations of LowIndexMultiples and allow_hyphen_values to fail parsing 2017-01-02 14:33:56 -05:00
Kevin K
baff4200a4
refactor: implements BitOr for AppFlags to improve some ergonomics and performance 2017-01-02 12:23:03 -05:00
Kevin K
be64ce0c37
api(Arg::value_terminator): adds the ability to terminate multiple values with a given value
One can now specificy a value termintaor that will stop the parsing of multiple values upon
reaching this special value.

Closes #782
2017-01-02 12:23:03 -05:00
nabijaczleweli
4d9a82db8e
feat(simple-cargo-app): Implement crate_description!, crate_name! and app_from_crate! macros
Closes #778
2016-12-31 14:25:59 +01:00
Kevin K
5e2af8c96a
setting: adds a setting to disable args being allowed between subcommands (ArgsNegateSubcommands)
Specifies that use of a valid [argument] negates [subcomands] being used after. By default
`clap` allows arguments between subcommands such as
`<cmd> [cmd_args] <cmd2> [cmd2_args] <cmd3> [cmd3_args]`. This setting disables that
functionality and says that arguments can only follow the *final* subcommand. For instance
using this setting makes only the following invocations possible:

* `<cmd> <cmd2> <cmd3> [cmd3_args]`
* `<cmd> <cmd2> [cmd2_args]`
* `<cmd> [cmd_args]`

Closes #793
2016-12-30 23:21:28 -05:00
Kevin K
c2978afc61
setting: adds a new setting to disable the collapsing of positional args into [ARGS] in the usage string (DontCollapseArgsInUsage)
Closes #769
2016-12-30 22:38:42 -05:00
Kevin K
c20701b74a
chore: clippy run 2016-12-30 22:08:28 -05:00
Kevin K
a10fc859ee
setting: adds a setting to disable building the help subcommand (DisableHelpSubcommand)
Relates to #787
2016-12-30 21:52:45 -05:00
Kevin K
d34ec3e032
fix(Help Subcommand): fixes a bug where the help subcommand couldn't be overriden
Closes #787
2016-12-30 21:37:09 -05:00
Kevin K
5a5f2b1e9f
fix(Options): fixes a critical bug where options weren't forced to have a value
For instance imagine --opt <val> and --opt2 <val>

Running:

```
$ prog --opt --opt2 val
```

Would pass. This has been fixed.

Closes #665
2016-12-30 16:17:47 -05:00
Kevin K
988b9cbea4
style: standardizes debug calls and output
Closes #792
2016-12-29 23:34:46 -05:00
Kevin K
280bb85f69 Merge branch 'master' into issue-764 2016-12-28 23:58:11 -05:00
Kevin K
3055e77ea7
tests(YAML): adds some of the new APIs to the YAML tests 2016-12-28 23:56:33 -05:00
Kevin K
9a4df32789
imp(YAML): adds conditional requirements and conditional default values to YAML
All of the conditional default values and conditional requirements
(requried and requires) can now be used with YAML builders as well.

Closes #764
2016-12-28 23:34:29 -05:00
Kevin K
ee9cfddf34
feat(Conditionally Required): adds the ability for an arg to be conditionally required
An arg can now be conditionally required (i.e. it's only required if arg
A is used with a value of V).

For example:

```rust
let res = App::new("ri")
	.arg(Arg::with_name("cfg")
	    .required_if("extra", "val")
	    .takes_value(true)
	    .long("config"))
	.arg(Arg::with_name("extra")
	    .takes_value(true)
	    .long("extra"))
	.get_matches_from_safe(vec![
	    "ri", "--extra", "val"
	]);

assert!(res.is_err());
assert_eq!(res.unwrap_err().kind, ErrorKind::MissingRequiredArgument);
```

Relates to #764
2016-12-28 23:30:52 -05:00
Kevin K
4ef091019c
docs(Conditional Default Values): fixes the failing doc tests of Arg::default_value_ifs 2016-12-28 23:28:21 -05:00
Kevin K
7f296e29db
docs(Conditional Requirements): adds docs for Arg::requires_ifs 2016-12-28 23:28:21 -05:00
Kevin K
198449d643
feat(Conditional Requirements): adds the ability to conditionally require additional args
An arg can now conditionally require additional arguments if it's value matches a specific value.

For example, arg A can state that it only requires arg B if the value X was used with arg A. If any
other value is used with A, arg B isn't required.

Relates to #764
2016-12-28 23:28:21 -05:00
Kevin K
eb4010e7b2
feat(Conditional Default Values): adds new Arg::default_value_if[s] methods for conditional default values
One can now implement conditional default values. I.e. a default value that is only applied in
certain conditions, such as another arg being present, or another arg being present *and*
containing a specific value.

Now it's possible to say, "Only apply this default value if arg X is present" or "Only apply this
value if arg X is present, but also only if arg X's value is equal to Y"

This new method is fully compatible with the current `Arg::default_value`, which gets set only if
the arg wasn't used at runtime *and* none of the specified conditions were met.

Releates to #764
2016-12-28 23:21:40 -05:00
Kevin K
a7186fa8fe Merge branch 'master' into master 2016-12-28 12:01:11 -05:00
Kevin K
68dadde061 Merge branch 'master' into issue-shortcircuit-help 2016-12-28 09:33:16 -05:00
Oliver Smith
17d70dc38e Merge branch 'master' into master 2016-12-28 12:33:23 +00:00
glowing-chemist
1da29a6266 proper OsString conversion 2016-12-28 12:30:50 +00:00
Kevin K
d3d34a2b51
fix: fixes a bug where calling the help of a subcommand wasn't ignoring required args of parent commands
Closes #789
2016-12-28 04:25:58 -05:00
Jędrzej
6fdd2f9d69 feat(no_cargo): add no_cargo feature to disable Cargo-env-var-dependent macros (#786) 2016-12-27 21:07:59 -05:00
glowing-chemist
47232498a8 feat(Validators): adds ability to validate invalid UTF-8 2016-12-27 23:16:28 +00:00
glowing-chemist
f49fb88aa2 updated 2016-12-27 16:19:42 +00:00
glowing-chemist
a43f32ce52 added validator_os 2016-12-25 18:55:03 +00:00
Björn Steinbrink
eb1d79dbb1 Only colorize missing arguments when appropriate (#781)
Instead of using Format::Error directly, we need to use a Colorizer to
make sure that the message only gets colorized when it is appropriate
to do so.

Fixes #775
2016-12-19 12:47:49 -06:00
Kevin K
83bacb87bb Merge branch 'master' into fix/779/crate_authors!-newlines 2016-12-18 17:08:38 -05:00
nabijaczleweli
315dffc011
Add documentation for new crate_authors!() functionality 2016-12-18 22:43:43 +01:00
nabijaczleweli
15d1619fa2
Default crate_authors!() macro to colon version. Add arm to handle custom separators
This makes default crate_authors!() invocation same as before the
changes
2016-12-18 21:56:44 +01:00
nabijaczleweli
05f4953409
Inline lazy_static! even harder in crate_authors!()
Functionality remains the same
2016-12-18 13:39:43 +01:00
nabijaczleweli
1a84ce22bc
Replace colons with newlines in crate_authors!()
The implementation is basically manually expanded lazy_static! macro
(with some hand-crafted simplifications and inlining), since you can't
use extern crates (and therefore import macros therefrom) in macros.

This ensures that you get this:

    p:\Rust\http>target\debug\http -h
    http 0.1.0
    thecoshman <thecoshman@gmail.com>
    nabijaczleweli <nabijaczleweli@gmail.com>
    Host These Things Please - a basic HTTP server for hosting a folder fast and simply

Instead of this:

    p:\Rust\http>target\debug\http -h
    http 0.1.0
    thecoshman <thecoshman@gmail.com>:nabijaczleweli <nabijaczleweli@gmail.com>
    Host These Things Please - a basic HTTP server for hosting a folder fast and simply

Closes #779
2016-12-18 13:17:34 +01: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
Arnavion
9895b671cf feat(clap_app!): Support ("some app name") syntax for defining app names
Used for setting names that aren't Rust idents.

Fixes #759
2016-12-12 22:42:11 -08:00
Nathan Musoke
5c9b0d47ca docs(src/app/mod.rs): fix some typos 2016-12-11 11:36:37 +13:00
Kevin K
7e17d5a36b
fix(ZSH Completions): escapes square brackets in ZSH completions
Since ZSH completions use `[ and ]` for descriptions, but clap args use `[ and ]` for possible
values and other auxillary arg information, this was creating a conflict. clap now escapes any
square brackets before writing the help, i.e. `\\[ and \\]` which removes conflicts.

Alternatives would be to switch `[ and ]` for `( and )` but this would create a slight difference
in help messages and completions.

Closes #771
2016-12-08 15:36:18 -05:00
Andrew Gallant
4aec1a5441 Query OUT_DIR at runtime. (#770)
It seems that Cargo no longer sets OUT_DIR when compiling build.rs, but
it's still available at runtime. Therefore, switch `env!` to
`env::var_os`.
2016-12-07 19:30:54 -05:00
Kevin K
56bd25ab38 Merge branch 'master' into issue-threedots 2016-12-01 23:54:22 -05:00
Daniel Luz
b1b16d56d8 imp(Completions): adds fallbacks to Bash completions
With these options, in case the completion function cannot provide
suggestions, Bash will perform its default completions, based on e.g.
files, directories, and variable names. This is particularly useful for
argument values.
2016-12-01 23:27:35 -02:00
Kevin K
cd94b3188d
fix(Help Messages): fixes help message alignment when specific settings are used on options
Prior to this commit setting `number_of_values(1)` and `multiple(true)` would cause the help
message alignment to be off. This commit fixes that.

Closes #760
2016-12-01 18:45:24 -05:00
Kevin K
802cd1bf17
docs: fixes the doc landing page 2016-11-20 21:27:17 -05:00
Kevin K
36e9d29b01
chore: fixes build failure for 1.11.0 2016-11-20 21:26:36 -05:00
Kevin K
01e1e33f37
docs: updates the docs landing page 2016-11-20 20:59:00 -05:00
Kevin K
49e7cdab76
fix(ZSH Completions): fixes an issue where zsh completions caused panics if there were no subcommands
Closes #754
2016-11-20 13:13:01 -05:00
Kevin K
d20331b6f7
fix(Required Unless): fixes a bug where having required_unless set doesn't work when conflicts are also set
Closes #753
2016-11-20 12:10:14 -05:00
Kevin K
65eb33859d
imp(Validators): improves the error messages for validators
Failing value validators now produce messages like the following:

error: Invalid value for '-j <val>': some message about the value

Closes #744
2016-11-20 08:36:26 -05:00
Kevin K
80cc68748d
chore: rustfmt run 2016-11-20 14:47:04 -05:00
Kevin K
b1053f1016
chore: clippy run 2016-11-20 14:47:04 -05:00
Kevin K
c0d70febad
feat: allows specifying AllowLeadingHyphen style values, but only for specific args vice command wide
One can now use `Arg::allow_hyphen_values(true)` which will enable `--opt -val` style values only
for the specific arg and not command wide.

Closes #742
2016-11-20 14:47:04 -05:00
Kevin K
cf9d6ce5cd
refactor: refactors the internals a bit
Flags, Opts, and Positionals now store their internals using compartmented Base, Valued, and
Switched structs to keep the code duplication down and make it easier to maintain.

Iniside the src/app/parser.rs there have been several changes to make reasoning about the code
easier. Primarily moving related sections out of the large get_matches_with into their own
functions.
2016-11-20 14:47:03 -05:00
Matthias Beyer
192a808e0f Use try!() instead of ? operator, for older compilers (#752) 2016-11-16 14:41:26 -05:00
Tshepang Lekhonkhobe
2ebde60d5a doc: some formatting fixes 2016-11-14 20:18:44 +02:00
John Downey
808e7ceeb8 docs: fix broken docs links
These links are relative to the root of the server instead of the
current file. This breaks causes them to be broken on docs.rs.
2016-11-13 11:35:07 -05:00
Kevin K
390bf5b0e3 Merge branch 'master' into master 2016-11-12 15:36:06 -05:00
Kevin K
e600f49b77
chore: clippy run 2016-11-12 12:20:45 -05:00
Kevin K
7cb44abc09
Revert "Auto merge of #737 - kbknapp:questionmark, r=kbknapp"
This reverts commit f24a3760e4, reversing
changes made to 087cee7404.
2016-11-12 12:12:05 -05:00
Richard Petrie
bc2552f505 Corrected name of tests folder
Unsure why these are wrong, but simple fixes
2016-11-12 01:08:54 -06:00
Kevin K
b4f2e2a1b6
chore: clippy run 2016-11-11 15:48:40 -05:00
Kevin K
55e7385685
style: changes try! to ? and rustfmt run 2016-11-11 15:20:07 -05:00
Arnavion
5869ebbffc Completion support for PowerShell.
Fixes #729
2016-11-05 02:47:23 -07:00
Kevin K
33924e8844
fix(Low Index Multiples): fixes a bug where using low index multiples was propgated to subcommands
Closes #725
2016-11-01 23:31:29 -04:00
Kevin K
61bde461e1
chore: clippy run 2016-11-01 18:42:03 -04:00
Kevin K
1ced2a7433
feat(Positional Args): allows specifying the second to last positional argument as multiple(true)
Now one can build CLIs that support things like `mv <files>... <target>`

There are a few requirements and caveats;

 * The final positional argument (and all positional arguments prior) *must* be required
 * Only one positional argument may be `multiple(true)`
 * Only the second to last, or last positional argument may be `multiple(true)`

Closes #725
2016-11-01 16:25:54 -04:00
Kevin K
1d6f8fd7de
chore(Completion Error): changes error message to reflect not only BASH is supported 2016-11-01 16:25:47 -04:00
Matthias Beyer
bc2075d088 Add App::app_name() getter 2016-11-01 20:11:26 +01:00
Kevin K
3d37001d1d
imp(Error Output): conflicting errors are now symetrical, meaning more consistent and less confusing
Prior to this commit, conflicting error messages and the suggeseted usage would depend on whether
you defined the conflict on both arguments, or just one, and the order in which you specified the
conflicting arguments at runtime.

Now they are symetrical, meaning the suggestions from the error message are consistent, and it no
longer matters if you specify the conflict in one, or both arguments.

Closes #718
2016-10-31 00:35:23 -04:00
Kevin K
5c70e1a01b
fix(ZSH Completions): fixes bug that caused panic on subcommands with aliases
ZSH completions now fully support subcommands with aliases. Only visible aliases will be displayed
in the completions.

Closes #714
2016-10-30 19:18:13 -04:00
Kevin K
6c11ccf443 fix(debug): fixes the debug feature (#716) 2016-10-29 11:10:14 -04:00
Wim Looman
9cb6facf50 fix: Derive display order after propagation
Don't attempt to change the display order of flags/options until any app
settings have been propagated down from a parent App in case DeriveDisplayOrder
and/or UnifiedHelpMessage are propagated.

Fixes #706
2016-10-26 20:47:24 +02:00
Kevin K
780b4a1828
fix(Fish Completions): fixes a bug where single quotes are not escaped
Closes #704
2016-10-25 10:34:46 -04:00
Kevin K
e9efa8ed6f
chore: clippy run 2016-10-24 05:56:32 -04:00
Kevin K
ebddac791f
fix(Help Message): fixes a regression bug where args with multiple(true) threw off alignment
Closes #702
2016-10-24 05:55:48 -04:00
Kevin K
3e36b0bac4
feat(Completions): adds ZSH completion support
ZSH is now supported in the exact same way as BASH and FISH completion scripts.

Closes #699
2016-10-23 19:32:52 -04:00
Kevin K
291bcccd6b
refactor: makes some minor changes to the private API for better ergonomics 2016-10-23 19:32:42 -04:00
Kevin K
ee6e987acd
refactor(Completions): moves completing functions into their own modules 2016-10-23 19:31:24 -04:00
Kevin K
993622364e
tests(AllowNegativeNumber): fixes failing doc test 2016-10-21 09:54:34 -04:00
Kevin K
2d2ec03995
chore: clippy run 2016-10-21 09:52:16 -04:00
Kevin K
7d6f760a91
style: rustfmt run 2016-10-21 09:41:59 -04:00
Kevin K
f056eb9e4e
refactor: moves some code out of the large main function into it's own 2016-10-21 09:41:45 -04:00
Kevin K
ab06454677
feat(AppSettings): adds new setting AllowNegativeNumbers
One can now use `AppSettings::AllowNegativeNumbers` which functions similar to `AllowLeadingHyphen`
with the exception that only unknown numbers are allowed have a preceding hyphen character.

See the documentation for details and examples.

Closes #696
2016-10-21 09:39:17 -04:00
Kevin K
9ed4d4d795
docs(app/settings.rs): moves variants to roughly alphabetical order 2016-10-21 06:59:58 -04:00
Kevin K
03d2b2ac80
tests: updates tests to new version of arg.to_string() 2016-10-20 19:39:21 -04:00
Kevin K
a79d0f132c
tests(app/help.rs): adds some additional debugging code, and standardizes a few calls 2016-10-20 19:39:21 -04:00
Kevin K
468baadb83
fix: fixes a bug that made determining when to auto-wrap long help messages inconsistent
Closes #688
2016-10-20 19:39:21 -04:00
Kevin K
dc906398fb Merge branch 'master' into stabilize_clap_app! 2016-10-18 10:45:36 -04:00
Kevin K
dbe83dfbe7 Merge branch 'master' into fix_werrnings 2016-10-18 10:17:09 -04: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
nabijaczleweli
2608540940
imp(with_defaults): Deprecate App::with_defaults()
Following the discussion on #638 a consensus that it can never work
(and was a mistake in the first place) has been reached

Closes #638
2016-10-16 21:22:54 +02:00
tormol
190aef43fd style: Fix new lints in fish_inner() 2016-10-16 13:05:47 +02:00
tormol
84546f5c7a style: fix one allow()ed lint 2016-10-16 13:04:45 +02:00
tormol
816b0d49c4 style: dis-allow() untriggered lints 2016-10-16 13:04:11 +02:00
tormol
4ee85b95d2 docs: Improve documentation around features
* Clap has dependencies even with all features disabled.
* The "nightly" feature does nothing, so don't mention it.
* Explain the difference between "unstable" and "nightly" better.
* Split features into groups (default, opt-in, clap-development).
* For contributors: update what tests should be run, and remove make command.
* Removes a repeated word and splits up some long markdown lines.

Also groups features by category and dependencies by feature in Cargo.toml.
2016-10-16 11:31:12 +02:00
tormol
835f75e3ba fix(features): Make lints not enable other nightly-requiring features 2016-10-16 11:31:12 +02:00
tormol
86828a5024 chore(debug): fix a single typo in a debug message 2016-10-16 11:31:12 +02:00
tormol
3ccde7a4b8 docs: reword docs for ErrorKind and app::Settings
Also adds a blank line between variants and
wraps markdown lines at punctuation when it makes sense. (Doesn't affect generated docs)
2016-10-16 11:31:12 +02:00
tormol
9f6217a424 docs(ErrorKind): improve some errors about subcommands
* InvalidSubcommand requires feature="suggestions".
* UnknownArgument can also be caused by unrecognized subcommands.
2016-10-16 11:31:12 +02:00
tormol
996fc38176 docs: fix tests that fail when the "suggestions" feature is disabled 2016-10-16 11:31:12 +02:00
tormol
da88fd254b style: only ignore clippy warning if lints are enabled
else you get another warning!
2016-10-16 11:31:12 +02:00
tormol
af9e1a393c docs: fix the OsString-using doc-tests 2016-10-16 11:31:12 +02:00
tormol
4c27f0ade9 tests: run OsString-using doc-tests on unix platforms
Closes #506
2016-10-16 11:31:12 +02:00