Commit graph

2397 commits

Author SHA1 Message Date
Will Murphy
23a48ea03a vec_map must be optional
This adds a keys method to the internal implementation of vec_map and
adds conditional compilation in the parser to make the parser compile
with or without the vec_map dependency.
2018-03-04 15:50:35 -05:00
Will Murphy
3401e6a3ec clean up whitespace 2018-03-01 06:55:24 -05:00
Will Murphy
5ea7eab427 Port 1161 fix to v3
Copy the fix from https://github.com/kbknapp/clap-rs/pull/1162 into
the v3 parser, and add a test to protect against regressions in the
expected behavior of example 22.
2018-03-01 06:52:30 -05:00
Kevin K
bd08e73e54
Merge pull request #1182 from kbknapp/v3-dev
V3 dev
2018-02-14 13:41:39 -05:00
Kevin K
e0b891d784
style: removes unused imports 2018-02-13 15:47:31 -05:00
Kevin K
6971624428
imp(Deps): doesnt compile ansi_term on Windows since its not used
Before this commit, ansi_term was compiled anytime the `color` feature
was used. However, on Windows the `color` feature is ignored. Even so
ansi_term was compiled, and just not used. This commit fixes that by
only compiling ansi_term on non-Windows targets. Thanks to @retep998 for
the gudiance.

Closes #1155
2018-02-13 15:43:45 -05:00
Kevin K
cdfdbfffb5
tests(Bash Completions): updates the bash completions to the new file completion fallback 2018-02-13 15:42:48 -05:00
Kevin K
79a210472c
imp(Bash Completions): instead of completing a generic option name, all bash completions fall back to file completions UNLESS Arg::possible_values was used 2018-02-13 15:42:47 -05:00
Kevin K
14a2dadc31
Merge pull request #1177 from kbknapp/v3-dev
V3 dev
2018-02-12 14:56:59 -05:00
Kevin K
08dfdc877b
style: changes values->possible values in help messages as well as errors 2018-02-12 14:52:29 -05:00
etopiei
973022184e
Tests pass now 2018-02-12 14:39:55 -05:00
etopiei
5220122f72
Adjusted error message, as specified in Issue #1160 2018-02-12 14:39:51 -05:00
Kevin K
e630a848d2
Merge pull request #1172 from kbknapp/v3-dev
V3 dev
2018-02-10 15:45:43 -05:00
Kevin K
dc098e19a2
tests(AllArgsOverrideSelf): adds tests for AllArgsOverrideSelf 2018-02-10 15:43:39 -05:00
Kevin K
7c23bee6b8
setting(AllArgsOverrideSelf): adds a convenience setting to say all args override themselves 2018-02-10 15:42:44 -05:00
Kevin K
da1ede55f5
Merge pull request #1171 from kbknapp/v3-dev
V3 dev
2018-02-09 23:42:48 -05:00
Kevin K
e1d1c06d45
chore: updates version sync in readme 2018-02-09 23:40:55 -05:00
Kevin K
237c2bdff4
tests(Self Overrides): adds tests for args that override themselves 2018-02-09 23:35:14 -05:00
Kevin K
db237f3ed2
docs(Self Overrides): adds docs to better explain overrides_with 2018-02-09 23:34:58 -05:00
Kevin K
4204787e0f
imp(Self Overrides): allows args to override themselves properly 2018-02-09 23:34:36 -05:00
Kevin K
f8e6876415
chore: adds some idea project files to the ignore list 2018-02-09 23:33:40 -05:00
Kevin K
e1b10f60aa
chore(Cargo.toml): updates with new excludes to trim package and new badges for crates.io 2018-02-05 16:23:00 -05:00
Kevin K
b4c2dedaf9
Merge pull request #1163 from kbknapp/v3-dev
chore: updates the version tests
2018-02-03 15:23:41 -05:00
Kevin K
300a059f51
chore: updates the version tests 2018-02-03 15:22:56 -05:00
Kevin K
4fc790563f
Merge pull request #1157 from kbknapp/v3-dev
V3 dev
2018-02-03 15:16:24 -05:00
Kevin K
6a8b301fa4
chore: bumps the Cargo.toml version to 3.0.0-alpha1 to reduce confusion 2018-02-03 15:15:00 -05:00
Kevin K
cf3eaaeb0c
tests: fixes some typos that caused failing doc tests 2018-02-03 15:14:34 -05:00
Kevin K
97fd3f1328
tests: partially updates tests to new arg.setting calls 2018-02-03 15:06:58 -05:00
Kevin K
41572e4d2d
benches: partially updates the benches to new arg.setting calls 2018-02-03 15:06:58 -05:00
Kevin K
2b39054437
chore(v3_changes.md): adds a document to track changes to announce for v3 2018-02-03 15:06:58 -05:00
Kevin K
41436d3b7d
docs(Arg.rs): updates documentation for the deprecations 2018-02-03 15:06:56 -05:00
Kevin K
6fc70d825c
depr(Arg.rs): adds deprecations in prep for v3
A full list of deprecations is:

* Arg::last -> ArgSettings::Last
* Arg::required -> ArgSettings::Required
* Arg::require_equals -> ArgSettings::RequireEquals
* Arg::allow_hyphen_values -> ArgSettings::AllowHyphenValues
* Arg::takes_value -> ArgSettings::TakesValue
* Arg::hide_possible_values -> ArgSettings::HidePossibleValues
* Arg::hide_default_value -> ArgSettings::HideDefaultValue
* Arg::multiple -> ArgSettings::Multiple (see Arg::multiple split)
* Arg::multiple -> ArgSettings::MultipleValues (see Arg::multiple split)
* Arg::multiple -> ArgSettings::MultipleOccurrences (see Arg::multiple split)
* Arg::global -> ArgSettings::Global
* Arg::empty_values -> ArgSettings::AllowEmptyValues
* Arg::hidden -> ArgSettings::Hidden
* Arg::case_insensitive -> ArgSettings::IgnoreCase
* Arg::use_delimiter -> ArgSettings::UseDelimiter
* Arg::require_delimiter -> ArgSettings::RequireDelimiter
* Arg::hide_env_values -> ArgSettings::HideEnvValues
* Arg::next_line_help -> ArgSettings::NextLineHelp
* Arg::set -> Arg::unset_setting (consistent naming with App)
* Arg::unset -> Arg::setting (consistent naming with App)

Relates to #1037
2018-02-03 15:00:55 -05:00
Kevin K
e1f1b474a3
Merge pull request #1156 from kbknapp/v3-dev
V3 dev
2018-01-30 21:14:17 -05:00
Kevin K
04b7532bcb
docs(App.rs): updates the docs away from deprecated methods 2018-01-30 21:10:35 -05:00
Kevin K
c441467de3
depr(App.rs): deprecates old App methods in prep for v3
A full list of deprecations is:

* App::version_message -> App::mut_arg
* App::version_short -> App::mut_arg
* App::help_message -> App::mut_arg
* App::help_short -> App::mut_arg
* App::from_yaml -> serde
* App::usage -> App::override_usage (+no longer assumes leading \t)
* App::help -> App::override_help
* App::template -> App::help_template
* App::args_from_usage -> App::args(&str)
* App::arg_from_usage -> App::arg(Arg::from)
* App::write_help -> &self -> &mut self (#808)
* App::gen_completions -> clap_completions::generate
* App::gen_completions_to -> clap_completions::generate_to
* App::get_matches_safe -> App::try_get_matches (#950 Lib Blitz naming
consistency)
* App::get_matches_from_safe -> App::try_get_matches_from (#950 Lib Blitz
naming consistency)
* App::get_matches_safe_borrow -> App::try_get_matches_from_mut (#950 Lib
Blitz naming consistency)
2018-01-30 21:04:19 -05:00
Kevin K
7372359c9c
Merge pull request #1154 from kbknapp/v3-prep
v3 Prep
2018-01-25 23:15:17 -05:00
Kevin K
4c54c2a696
tests: silence some warnings 2018-01-25 23:03:13 -05:00
Kevin K
1fa4afa45d
tests: continues to update tests to take advantage of new internals 2018-01-25 22:54:05 -05:00
Kevin K
90c0698aff
tests(Bash Completions): fixes the order of several completion commands 2018-01-25 22:36:20 -05:00
Kevin K
78090e5529
tests: removes some instances of println in the tests 2018-01-25 22:36:20 -05:00
Kevin K
7788ef70d9
wip: continuing to iron out the bugs from the internal refactor 2018-01-25 22:36:20 -05:00
Kevin K
712333be98
tests: splits tests into single duties 2018-01-25 15:08:57 -05:00
Kevin K
7673dfc085
perf: refactors the POSIX override handling to lazy handling
This commit primarily changes to a lazy handling of POSIX overrides by
relying on github.com/bluss/ordermap instead of the old HashMap impl.
The ordermap allows us to keep track of which arguments arrived first,
and therefore determine which ones should be removed when an override
conflict is found.

This has the added benefit of we no longer have to do the bookkeeping to
keep track and override args as they come in, we can do it once at the
end.

Finally, ordermap allows fast Vec like iteration of the keys, which we
end up doing several times. Benching is still TBD once the v3 prep is
done, but this change should have a meaningful impact.
2018-01-25 15:08:57 -05:00
Kevin K
e890b647f3
wip: still setting the stage for v3 2018-01-25 12:29:36 -05:00
Kevin K
1ab10275e4
style: rustfmt run 2018-01-25 12:21:17 -05:00
Kevin K
f66e4f3266
chore: removes no longer used style lints 2018-01-25 12:20:58 -05:00
Kevin K
efb3b28ae8
tests: updates the tests that were using clap internals 2018-01-25 12:20:56 -05:00
Kevin K
6705195449
wip: setting the stage for serde, custom derive, and v3 2018-01-25 12:20:04 -05:00
Kevin K
8173d717b1
chore: adds some just recipies for showing errors and tracking todos 2018-01-25 12:20:03 -05:00
Kevin K
4f3231a51c fix(Help): fixes an issue where help is not properly written using App::write_help
Contains a *MINOR* breaking change. App::write_help now requires `&mut self` instead of `&self`.

This fixes a major bug where the help message is entirely incorrect.
More can be found at https://github.com/kbknapp/clap-rs/issues/808

I've decided to make this change because it was preventing further progress.

Anyone's code who breaks the fix is trivial:

```rust
// OLD BROKEN
let app = App::new("broken");
let mut out = io::stdout();
app.write_help(&mut out).expect("failed to write to stdout");

// NEW FIX
let mut app = App::new("broken");  // <-- let mut
let mut out = io::stdout();
app.write_help(&mut out).expect("failed to write to stdout");
```

Closes #808
2018-01-24 11:34:14 -05:00