Commit graph

748 commits

Author SHA1 Message Date
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