Commit graph

206 commits

Author SHA1 Message Date
CreepySkeleton
7a7148d087 Make struct SubCommand private 2020-04-29 21:34:59 +03:00
CreepySkeleton
c6fdd3a7ce Reshape imports 2020-04-27 21:47:08 +03:00
CreepySkeleton
739e7048a5 Make vec_map required dependency - in fact, it already is 2020-04-24 15:33:11 +03:00
Pavan Kumar Sunkara
01c179f527 Added arg_enum support 2020-04-22 14:37:45 +02:00
Stephan Boyer
606d120d18 Update the documentation regarding which features are enabled by default 2020-04-04 13:16:30 -07:00
CreepySkeleton
4fc4a00b8f Remove _some_ of pubs 2020-03-19 10:17:52 +03:00
Pavan Kumar Sunkara
b8851a7d5e Allow replacing input on the fly 2020-02-21 18:15:33 +01:00
CreepySkeleton
ae574df2f9
Extract subcommands into separate trait 2020-02-12 23:15:05 +03:00
bors[bot]
ad5606b5a0
Merge #1678
1678: Refactor clap_generate r=CreepySkeleton a=pksunkara

I have copied the code from [clap_generate]( https://github.com/clap-rs/clap_generate) and refactored the structure a bit.

This new structure will allow people to write their own generators using our `Generator` trait which will contain some helpers (Still working on polishing them).

Co-authored-by: Ole Martin Ruud <barskern@outlook.com>
Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-02-08 15:00:50 +00:00
Pavan Kumar Sunkara
33f47acc67 Refactor clap_generate 2020-02-07 07:52:04 +01:00
Pavan Kumar Sunkara
5b3a0dff9c Remove extern & macro_use where possible 2020-02-07 07:34:01 +01:00
CreepySkeleton
cf11d46373 Default value for default_value (yeah, sounds awkward) 2020-02-04 11:40:01 +03:00
Dylan DPC
922a531fa6
Update lib.rs 2020-02-02 02:02:10 +01:00
Pavan Kumar Sunkara
c799e8d0ca chore: Updated contributing instructions and justfile 2020-01-31 18:37:56 +01:00
danieleades
af45420027 style: format code with rustfmt (#1632)
> incidentally, how do we feel about adding a rustfmt check to the CI(s)?
yes we should be doing that. you can send another pr that adds the check to the Ci
2020-01-11 23:45:46 +05:30
dylan_DPC
1c79bb5b28 fix subcommand is private bug 2020-01-01 23:28:06 +05:30
Dylan DPC
335f34bee2 fix broken CI 2019-11-11 14:28:30 +01:00
Dylan DPC
dd6c8e08ad use 2018 edition and minor refactors 2019-11-11 12:54:55 +01:00
Za Wilcox
14bfbd6ef4
add missing 'the' 2019-10-29 21:47:42 -04:00
Oleksii Filonenko
1e39967044
Fix some clippy lints
- Manually fix some problems
- Run 'cargo fix --clippy'

Commits taken from similar PRs open at that time:

- Replace indexmap remove with swap_remove
  Resolves #1562 and closes #1563
- Use cognitive_complexity for clippy lint
  Resolves #1564 and closes #1565
- Replace deprecated trim_left_matches with trim_start_matches
  Closes #1539

Co-authored-by: Antoine Martin <antoine97.martin@gmail.com>
Co-authored-by: Brian Foley <bpfoley@users.noreply.github.com>
2019-10-29 21:46:25 -04:00
Kevin K
958437661a
chore: clippy fixes 2019-04-05 20:21:34 -04:00
Kevin K
fcbae1574a
style: rustfmt run 2019-04-05 20:21:33 -04:00
Kevin K
573b0a9e88
chore: upgrades to 2018 edition of Rust 2019-04-05 20:21:30 -04:00
Kevin K
4cc85990fd
refactor: removed strings as an internal ID for arguments, groups, and
subcommands

This commit changes the internal ID to a u64 which will allow for
greater optimizations down the road. In addition, it lays the ground
work for allowing users to use things like enum variants as argument
keys instead of strings.

The only downside is each key needs to be hashed (the implementation
used is an FNV hasher for performance). However, the performance gains
in faster iteration, comparison, etc. should easily outweigh the single
hash of each argument.

Another benefit of if this commit is the removal of several lifetime
parameters, as it stands Arg and App now only have a single lifetime
parameter, and ArgMatches and ArgGroup have no lifetime parameter.
2019-04-05 20:21:22 -04:00
Kevin K
3dffd4908c
Removing the lint features and invoking cargo clippy manually instead 2019-04-04 13:27:08 -04:00
Kevin K
eafee3c5c1 style: cargo fmt run 2018-11-14 14:01:48 -05:00
Kevin K
2a480451d3 refactor: clippy run 2018-11-14 14:01:48 -05:00
Kevin K
0de9e07412
Merge branch 'v3-master' into map 2018-11-13 22:07:16 -05:00
Kevin K
3550066c88 refactor: cleans out deprecated code in prep for final beta.1 push 2018-11-08 20:34:13 -05:00
Kevin K
03333800fe refactor: remove code going to other crates and deprecations 2018-10-19 23:31:06 -04:00
Alena Yuryeva
272170e333
WIP 2018-08-04 18:32:08 -04:00
Alena Yuryeva
f230cfedc3
WIP 2018-08-04 18:26:33 -04:00
Alena Yuryeva
7e5a6935b9
WIP. Big reformat 2018-08-04 18:22:10 -04:00
Alena Yuryeva
3efcf3ae03
WIP changing macros into MKeyMap calls 2018-08-04 18:13:33 -04:00
Kevin K
94872e00a5
refactor(Arg): changes Arg::short to accept a char instead of &str
Closes #1303
2018-07-23 15:10:12 -04:00
Kevin K
53b2ca51f4
refactor(Derives): changes the derive traits for the clap_derive crate 2018-07-13 11:36:53 -04:00
Kevin K
09de35f208 Fix some broken doc links and formatting. 2018-06-30 19:33:34 -04:00
Alan K
4492aa5b96 refactor: Changed the custom derive traits 2018-06-30 18:19:29 +02:00
Kevin K
e5def030d3
refactor(Modules): moves the modules around into a more logical order to make contribution easier 2018-06-12 11:44:40 -04:00
Kevin K
b033bb5abc
chore: ordermap to indexmap 2018-06-12 10:22:18 -04:00
andy boot
a4d080370c fix typo 2018-03-19 16:48:01 -04: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
300a059f51
chore: updates the version tests 2018-02-03 15:22: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
1fa4afa45d
tests: continues to update tests to take advantage of new internals 2018-01-25 22:54:05 -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
1ab10275e4
style: rustfmt run 2018-01-25 12:21:17 -05:00
Kevin K
5bb926ebf9 chore: fix html_doc_root 2018-01-18 15:06:23 -05:00
Kevin K
3e97085e58 chore: udpates html doc root 2018-01-09 12:02:35 -05:00
Cameron Dershem
56e734b839 docs: fixes broken links.
Small correction to add a link to the source in the documentation, previously
it was a placeholder.

`rustdoc` does not appear to package assets with the docs, therefore
relative links looking for static files do not work. The links are
consistent enough on github that the static files can be directly linked
to on the master branch.
2017-12-27 00:00:06 -05:00