Commit graph

169 commits

Author SHA1 Message Date
Kevin K
d2b4c2c61b
fix: fixes false positive clean parse when the suggestions feature is disabled and InferSubcommands is enabled 2017-03-10 08:24:30 -05:00
Kevin K
5c76350f77
tests: fixes failing hidden args test 2017-03-10 08:24:30 -05:00
Kevin K
642db9b042
tests: adds tests for new dual usage strings with certain subcommand settings 2017-03-10 08:24:29 -05:00
Kevin K
c8ab24bafa
imp: when AppSettings::SubcommandsNegateReqs and ArgsNegateSubcommands are used, a new more accurate double line usage string is shown
Closes #871
2017-03-10 08:24:29 -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
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
Kevin K
677f323bce
tests: adds tests to ensure borrowed args don't break 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
a01812fed8
tests: adds tests for requiring the equals syntax in options 2017-02-20 20:24:28 -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
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
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
563a539a8e tests: show how final word is not always wrapped
This is #828.
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
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
Kevin K
e80fd4d671
tests: adds tests for AppSettings::AllowMissingPositional 2017-01-04 00:02:26 -05:00
Kevin K
2fc5acaff7
fixup! tests: adds tests for propogating values down 2017-01-02 23:10:46 -05:00
Kevin K
f967235a90
tests: massively rehauls tests for better debugging and vastly improved error messages/deduplication 2017-01-02 23:05:50 -05:00
Kevin K
c142fb544d
tests: adds tests for propogating values down 2017-01-02 23:05:50 -05:00
Kevin K
fc3800b830
tests: adds tests for wrapping meta help items 2017-01-02 16:44:40 -05:00
Kevin K
aa26a50d5c
tests: adds tests to guard against low index multiples with allow_hyphen_values failing 2017-01-02 14:34:25 -05:00
Kevin K
9d9683feb0
tests(Arg::value_terminator): adds tests for Arg::value_termintaor 2017-01-02 12:23:03 -05:00
Kevin K
12026f63d9
tests: adds tests for 2016-12-30 23:22:09 -05:00
Kevin K
25cbca4e41
tests: adds tests for 2016-12-30 22:40:28 -05:00
Kevin K
01caf84b87
tests(DisableHelpSubcommand): adds tests for AppSettings::DisableHelpSubcommand 2016-12-30 21:53:58 -05:00
Kevin K
327c514d7a
test(Options): adds a test against issue 665 2016-12-30 16:25:48 -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
60e1a3a02b
tests(Conditionally Required): adds tests for conditionally required args 2016-12-28 23:30:52 -05:00
Kevin K
eca609159a
test(Conditional Requirements): adds teste for conditional requirements 2016-12-28 23:21:40 -05:00
Kevin K
b03eff6df5
tests(Default Values If): adds tests for the new defualt_value_if[s] methods 2016-12-28 23:21:40 -05: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
Arnavion
79bbf57815 tests(clap_app!): Added test for clap_app! macro. 2016-12-12 22:42:11 -08: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
29e362cc19
tests: adds tests against issue 760 help message alignment 2016-12-01 18:47:20 -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
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
Kevin K
908d78eb82
tests: adds tests against issue-725 part 2 2016-11-01 23:32:26 -04:00
Kevin K
74360184fa
tests(Multiple Values): renames some tests to reduce redundancy 2016-11-01 16:25:54 -04:00
Kevin K
ac49e7bc04
tests: adds tests for low index positionals with multiple(true) set 2016-11-01 16:25:54 -04:00
Kevin K
44f6b1edbf
tests: updates conflict tests to new more precise output 2016-10-31 00:35:13 -04:00
Wim Looman
f5b577c4fe tests: Add tests related to #706
Try and stress the combinations of DeriveDisplayOrder and UnifiedHelpMessage
along with propagating them to subcommands and explicitly setting a display
order.

The new tests

  derive_order_subcommand_propagate
  unified_help_and_derive_order_subcommand_propagate
  unified_help_and_derive_order_subcommand_propagate_with_explicit_display_order

are currently failing because of bug #706.
2016-10-26 20:47:19 +02:00
Kevin K
b94f897daf
tests(Help Message): adds tests to guard aginst multiple values throwing off alignment 2016-10-24 05:56:21 -04:00
Kevin K
e443f2d6c1
tests(AllowNegativeNumbers): adds some new tests for AllowNegativeNumbers and AllowLeadingHyphen 2016-10-21 09:42:25 -04:00
Kevin K
637d25dde3
tests: adds tests to guard against issue-688 2016-10-20 19:39:21 -04:00
Kevin K
440a21cfdc
tests: updates tests to new space counts in help messages 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