Commit graph

279 commits

Author SHA1 Message Date
Kevin K
2d2ec03995
chore: clippy run 2016-10-21 09:52:16 -04:00
Kevin K
dc906398fb Merge branch 'master' into stabilize_clap_app! 2016-10-18 10:45:36 -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
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
0ba9f4b123 docs: tag non-rust code blocks as such instead of ignoring them 2016-10-16 11:31:12 +02:00
tormol
330a376a46 tests: run or compile some currently ignored doc-tests 2016-10-16 11:31:12 +02:00
Kevin K
b246be1a4b style: rustfmt run 2016-09-05 17:03:45 -04:00
nabijaczleweli
fc7327e9dc
imp(help): use term_size instead of home-grown solution 2016-08-29 07:36:06 +02:00
nabijaczleweli
0d93d9b953
feat(help): support wrapping help at console width on windows
Closes #455
2016-08-26 17:18:24 +02:00
Kevin K
57690b2af1 chore: allows wrapping help on windows 2016-08-24 22:04:19 -04:00
Kevin K
763a5c920e fix(Unicode): fixes two bugs where non-English characters were stripped or caused a panic with help wrapping
Closes #626
2016-08-24 21:50:27 -04:00
Tshepang Lekhonkhobe
13233d7f2f doc: small fixes (#609) 2016-07-28 21:15:10 -04:00
Kevin K
ccdd0571c2 Merge branch 'fish-completion' of https://github.com/wdv4758h/clap-rs into wdv4758h-fish-completion 2016-07-27 21:15:39 -04:00
Chiu-Hsiang Hsu
1979d2f2f3 feat(Completions): one can generate a basic fish completions script at compile time
The following completion would happen (using example 17_yaml.rs):

```
$ prog <tab>
help subcmd
```

```
$ prog -<tab><tab>
--help  -h                            (Prints help information)
--max-vals      (you can only supply a max of 3 values for me!)
--min-vals  (you must supply at least two values to satisfy me)
--mode                   (shows an option with specific values)
--mult-vals        (demos an option which has two named values)
--option  -o                (example option argument from yaml)
--version  -V                      (Prints version information)
-F                                         (demo flag argument)
```

```
$ prog --<tab><tab>
--help  -h                            (Prints help information)
--max-vals      (you can only supply a max of 3 values for me!)
--min-vals  (you must supply at least two values to satisfy me)
--mode                   (shows an option with specific values)
--mult-vals        (demos an option which has two named values)
--option  -o                (example option argument from yaml)
--version  -V                      (Prints version information)
```

```
$ prog --mode <tab>
emacs  (shows an option with specific values)  vi  (shows an option with specific values)
```

```
$ prog subcmd -<tab>
--help  -h        (Prints help information)  -B  (example subcommand option)
--version  -V  (Prints version information)
```

```
$ prog subcmd --<tab>
--help  (Prints help information)  --version  (Prints version information)
```

Close #578
2016-07-26 10:15:37 +08:00
Kevin K
7bf76b889b chore: clippy run 2016-07-25 20:56:22 -04:00
Bence Szigeti
8d7bea823f Fix: extra space typo removed 2016-07-05 22:01:04 +02:00
Kevin K
e75b6c7b75 feat(Completions): one can now generate a bash completions script at compile time
By using a build.rs "build script" one can now generate a bash completions script which allows tab
completions for the entire program, to include, subcommands, options, everything!

See the documentation for full examples and details.

Closes #376
2016-06-30 23:50:49 -04:00
Kevin K
ceddee9157 refactor(term.rs): moved term.rs into it's own crate so others can pull in just that portion
The functionality can now be found in https://crates.io/crates/term_size

Closes #549
2016-06-29 23:19:08 -04:00
Kevin K
01e7dfd6c0 fix(Windows): fixes a failing windows build 2016-06-07 20:49:18 -04:00
Kevin K
3312893dda docs: inter-links all types and pages
All doc pages should now be inter-linked between other doc pages and
Rust documentation.

Closes #505
2016-05-15 14:23:37 -04:00
Kevin K
52ca6505b4 docs: makes all publicly available types viewable in docs
Some types weren't viewable in the docs, such as `Values`, `OsValues`,
and `ArgSettings`. All these types should now be browsable in the
docs page.

Relates to #505
2016-05-13 18:52:29 -04:00
Kevin K
2efd81ebbc chore: clippy update and run 2016-05-06 17:59:52 -04:00
Kevin K
ffde90f2ba style: rustfmt run 2016-05-06 17:52:23 -04:00
Kevin K
05365ddcc2 fix(Help Message): fixes bug with wrapping in the middle of a unicode sequence
Closes #456
2016-03-27 16:01:17 -04:00
Kevin K
144e7e29d6 chore: clippy run 2016-03-22 21:16:53 -04:00
Kevin K
e36af02666 feat(Help Message): can auto wrap and aligning help text to term width
By default `clap` now automatically wraps and aligns help strings to the
term width. i.e.

```
    -o, --option <opt>    some really long help
text that should be auto aligned but isn't righ
t now
```

Now looks like this:

```
    -o, --option <opt>    some really long help
                          text that should be
                          auto aligned but isn't
                          right now
```

The wrapping also respects words, and wraps at spaces so as to not cut
words in the middle.

This requires the `libc` dep which is enabled (by default) with the
`wrap_help` cargo feature flag.

Closes #428
2016-03-13 22:07:28 -04:00
Kevin K
deace34ad2 chore: clippy run 2016-03-08 10:39:43 -05:00
Kevin K
ab41be700b imp(arg_enum): enum declared with arg_enum returns [&'static str; #] instead of Vec 2016-01-31 08:23:34 -05:00
Kevin K
90542747ac chore: fixes doc and style mistakes 2016-01-28 21:58:40 -05:00
Kevin K
2031682193 chore: updates additional files for 2x release 2016-01-28 11:46:12 -05:00
Kevin K
f1876388a7 docs: updating docs for 2x release 2016-01-28 11:45:31 -05:00
Kevin K
eb4de9215f imp(From Usage): vastly improves the usage parser
Closes #350
2016-01-28 11:45:31 -05:00
Kevin K
0410873d8d chore: clippy run 2016-01-28 11:45:31 -05:00
Kevin K
c3e96232c9 tests(v2): fixing more tests on the new v2 base 2016-01-28 11:45:31 -05:00
Kevin K
20de5c6e76 feat(v2): implementing the base of 2.x
This commit implements the base changes for clap 2.x
2016-01-28 11:45:31 -05:00
Kevin K
55041bc878 chore: updates clippy 2015-12-19 05:35:44 -05:00
Kevin K
1b69ca4bee refactor: moves code for ergonomics 2015-11-09 03:48:49 -05:00
Kevin K
bf4d8417b8 style: rustfmt run 2015-11-09 02:22:12 -05:00
Kevin K
bc4495b32e perf(App): more BTreeMap->Vec, Opts and SubCmds 2015-11-08 03:48:13 -05:00
Kevin K
d357640fab perf(App): changes flags BTreeMap->Vec 2015-11-08 01:50:12 -05:00
Kevin K
64b921d087 perf(App): changes BTreeMap to VecMap in some instances 2015-11-08 01:01:11 -05:00
Kevin K
19538b9c22 chore: fixes features declarations 2015-11-03 01:59:08 -05:00
Ben S
00b61ae226 Fix a bunch of typos in comments 2015-11-01 14:02:37 +00:00
Kevin K
1a8bf31e7a docs: adds comparison in readme
Closes #325
2015-10-29 01:07:43 -04:00
Kevin K
d0c13d2960 style: rustfmt run 2015-10-28 10:56:10 -04:00
Kevin K
f161ffa470 chore: updates and implements lint findings 2015-10-28 10:55:26 -04:00
SungRim Huh
b7df92d7ea docs: clean up some formatting 2015-10-01 21:46:45 -04:00
SungRim Huh
d7233bf122 docs: move the crate-level docs to top of the lib.rs file 2015-10-01 16:48:25 -07:00
Kevin K
34b601be5f docs: changes doc comments to rustdoc comments 2015-10-01 17:27:29 -04:00
Kevin K
6f9ee181e6 docs(Rustdoc): adds portions of the readme to main rustdoc page
Closes #293
2015-10-01 12:03:14 -04:00
Kevin K
ffae52e64b refactor: refactor app settings into flags 2015-09-30 23:59:40 -04:00
Kevin K
af8bfb1610 tests(ArgGroups): adds tests for ArgGroups
closes #279
2015-09-28 12:29:57 -04:00
Kevin K
40229efd99 style: post rustfmt run 2015-09-06 21:37:45 -04:00
Alexander Kuvaev
934e6fbb64 feat(App): Added ability for users to handle errors themselves
Now you can use get_matches_safe instead of get_mathces if you want
to handle errors yourself.

This will allow now to write false-negative tests and check what type
of error occurs
2015-09-06 00:17:32 +03:00
Kevin K
86cf4c4562 feat(YAML): allows building a CLI from YAML files 2015-08-31 23:57:16 -04:00
Alexander Kuvaev
0cfecd328c tests: moved tests from lib.rs to tests.rs and tests dir 2015-08-28 21:48:37 +03:00
Kevin K
ff9628d24d chore: comments out clippy until 0.0.12 is on crates.io 2015-08-26 17:32:25 -04:00
Kevin K
5aa02042ca chore: separates nightly features from travis-cargo flags 2015-08-25 17:28:46 -04:00
Alexander Kuvaev
b41afa8c3d fix(App, Args): fixed subcommand reqs negation
Closes #188
2015-08-24 14:30:33 -04:00
Alexander Kuvaev
fc7a31a745 fix: fixed confusing error message, also added test for it 2015-08-22 12:45:25 +03:00
Alexander Kuvaev
999456969d tests: test for multiple flags in single 2015-08-22 00:04:36 +03:00
Alexander Kuvaev
56ea693084 tests: tests for flag using 2015-08-21 23:55:13 +03:00
Alexander Kuvaev
38fb26b9d7 tests: addet options values testing to some tests 2015-08-21 23:46:51 +03:00
Alexander Kuvaev
215fc821a7 tests: tests for options using 2015-08-21 23:42:47 +03:00
Alexander Kuvaev
133a26c2fb tests: rewrote test for multiple occurrences 2015-08-20 21:52:48 +03:00
Kevin K
754d6b7dd1 tests: adds tests for posix compatible conflicts 2015-08-19 21:44:25 -04:00
Alexander Kuvaev
eed54ff836 tests: moved code from claptests to lib.rs, also moved one test 2015-08-20 00:46:06 +03:00
Kevin K
19c46e1403 chore: fix until clippy on crates.io is updated 2015-08-14 20:58:18 -04:00
Alexander Kuvaev
7df170d7f4 fix: fixed misspell and enum name 2015-08-15 02:11:20 +03:00
Alexander Kuvaev
dc3ada7386 fix: fixed use for clap crate 2015-08-15 01:15:47 +03:00
Kevin K
8a2cd7f95f imp: code corrections thanks to rust-clippy 2015-08-14 00:21:16 -04:00
Kevin K
a5b8b3584b test: fixes tests for 1.0 and deprecated functions 2015-06-29 22:21:47 -04:00
Kevin K
743eefe8dd docs: updates for deprecations and new features 2015-05-22 23:32:56 -04:00
Kevin K
d6c3ed54d2 imp(Colors): implements more structured colored output
Closes #129
2015-05-22 23:01:20 -04:00
Kevin K
960389de02 docs(README): adds details about optional and new features 2015-05-05 22:05:02 -04:00
Kevin K
a3e0671336 tests(arg_enum): adds tests 2015-05-05 22:05:02 -04:00
Kevin K
f8b26b13da feat(errors): colorizes output red on error 2015-05-05 22:05:02 -04:00
Tshepang Lekhonkhobe
8891d92917 docs(clap): fix typos caught by codespell
Thanks to [tshepang](https://github.com/tshepang) for catching these!
2015-05-05 22:02:14 -04:00
Sebastian Thiel
c0e383515d feat(did-you-mean): gate it behind 'suggestions'
You can now disable the did-you-mean feature entirely, which also
removes the additional dependency it comes with.
Learn more about features and how to use them here:
http://doc.crates.io/manifest.html#the-[features]-section

Related to #103
2015-05-05 17:12:20 -04:00
Sebastian Thiel
06e869b518 feat(did-you-mean): for subcommands
If an argument is not understood as subcommand, but has a
high-confidence match in the list of all known subcommands, we will use
this one to print a customized error message.

Previously, it would say that a positional argument wasn't understood,
now it will say that a subcommand was unknown, and if the user meant
`high-confidence-candidate`.

If the argument doesn't sufficiently match any subcommand, the default
handling will take over and try to treat it as positional argument.

* added dependency to `strsym` crate
* new `did_you_mean` function uses `strsim::jaro_winkler(...)` to look
  for good candidates.

Related to #103
2015-05-05 17:12:20 -04:00
Kevin K
3d58197674 feat(from_usage): adds ability to add value names or num of vals in usage string
Allows new usage strings with value names or number of values. If the
names are consecutive, they are counted to represent the number of
values (if they all have the same name), or if their names are different
they are used as value names.

Closes #98
2015-05-05 17:12:20 -04:00
Kevin K
22aef2ab45 style(clap): rustfmt run 2015-05-01 14:44:20 -04:00
Kevin K
82d03638d3 docs(lib.rs): fix doc tests 2015-04-30 20:43:22 -04:00
Kevin K
0d123a0d86 docs(clap): update docs 2015-04-30 20:13:01 -04:00
Kevin K
1c92ed0e72 chore(docs): change makefile -> travis auto cargo doc and upload 2015-04-28 23:18:08 -04:00
Kevin K
ad4e545107 fix(from_usage): removes bug where usage strings have no help text
Creating arguments from usage strings with no help text previously
dropped the final character i.e. --flags -> --flag
This commit fixes that issue by testing if we are at the end of the
string

Closes #83
2015-04-28 22:11:20 -04:00
Kevin K
09eb4d9893 feat(ArgGroups): add ability to create arg groups 2015-04-27 00:53:12 -04:00
Kevin K
d7c724dc65 tests(usage): fix typo in test variable names 2015-04-22 11:23:15 -04:00
Kevin K
bb9d0c377e tests(from_usage): add tests for usage strings with tabs 2015-04-19 14:31:56 -04:00
Kevin K
ab409a8f1d feat(args): add ability to create basic arguments from a usage string 2015-04-13 13:31:14 -04:00
Kevin K
dcbadc6275 perf(usage): remove compiler warnings and dedup some code 2015-04-10 11:50:08 -04:00
Kevin K
9abdb438e3 fix(clap): remove unstable features for Rust 1.0 2015-04-03 11:02:46 -04:00
Kevin K
b047104d9a version bump and rebuilt docs 2015-03-24 14:35:47 -04:00
Kevin K
c7f22728f1 Added test application 2015-03-24 12:16:59 -04:00
Kevin K
66dab46760 Fixed doc error 2015-03-22 22:13:10 -04:00
Kevin K
eff1ef4ff1 Fixed makefile bug 2015-03-22 22:03:28 -04:00
Kevin K
0f7bc363ce Moved tests to tests/ directory and crate 2015-03-22 21:57:02 -04:00
Kevin K
d5d1554b5e Cleaned up codebase...a little 2015-03-22 21:30:48 -04:00
Markus Unterwaditzer
5abee664b2 Deduplicate docs 2015-03-19 00:42:06 +01:00
Kevin K
f270bc171f Restructured project to better reflect internal workings 2015-03-18 15:00:15 -04:00
Kevin K
85648f2949 Moved to stable Rust APIs - Removed uppercasing of argument names due to Rust API stability 2015-03-18 13:40:58 -04:00
Kevin K
399ad97413 Changes to stable APIs towards Rust 1.0 2015-03-18 08:41:09 -04:00
Kevin K.
a0746686ac Merge pull request #7 from untitaker/tabs
Improve formatting for README, remove some tabs
2015-03-16 16:51:32 -04:00
Markus Unterwaditzer
59bcd85662 Improve formatting for README, remove some tabs 2015-03-16 20:56:42 +01:00
Kevin K
eabfa091bc Fixed error in doc test 2015-03-16 14:53:49 -04:00
Kevin K
9f4cdc9fa3 Changed tabs to spaces 2015-03-16 14:47:09 -04:00
Kevin K
b77920304c Fixed bug with un-needed subcommands (i.e. when no subcommand is specified by developer manually - and removed deprecated flags 2015-03-16 11:17:51 -04:00
Kevin K
152aa8919a Fixed doc tests 2015-03-15 21:05:19 -04:00
Kevin K
65a8a4f045 Added support for subcommands 2015-03-15 17:17:52 -04:00
Kevin K
5ca006cbb5 Adding subcommands 2015-03-05 22:44:11 -05:00
Kevin K
42b7a35987 adding tests 2015-03-03 14:19:44 -05:00
Kevin K
9f5b33a241 adding tests 2015-03-03 14:18:56 -05:00
Kevin K
12a727e2a9 Added initial testing 2015-03-03 14:13:31 -05:00
Kevin K
498c13c264 Fixed error in docs 2015-03-03 13:57:19 -05:00
Kevin K
8548be883b Fixed failing tests in the docs 2015-03-01 16:58:39 -05:00
Kevin K
3c0b050a26 updated docs 2015-02-28 20:15:04 -05:00
Kevin K
e9a9273ec1 added cargo docs to github folder 2015-02-28 13:49:33 -05:00
Kevin K
8b2b7080b7 Added version and help to list of flags 2015-02-28 13:36:00 -05:00
Kevin K
72c360dbf6 Added documentation 2015-02-28 13:18:47 -05:00
Kevin K
b0b401ab07 Added documentation and fixed some bugs 2015-02-28 13:13:43 -05:00
Kevin K
e15635d1c7 Re-addedd the pub-use 2015-02-28 10:45:31 -05:00
Kevin K
0bf13bd5f2 Added documentation - and removed a pub-use 2015-02-28 10:43:49 -05:00
Kevin K
da9607512b Added documentation 2015-02-28 09:40:53 -05:00
Kevin K
3f693870bb Adding documentation 2015-02-27 22:19:48 -05:00
Kevin K
5515ea064c v0.0.4.10 2015-02-27 11:12:23 -05:00
Kevin K
385d67da49 v0.0.3.5 2015-02-26 16:25:40 -05:00
Kevin K
2d546238a2 Initial commit v0.0.3 2015-02-25 08:37:25 -05:00