Commit graph

160 commits

Author SHA1 Message Date
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
Kevin K
e962f2cece
chore: increase version 2017-12-02 15:34:02 -05:00
Kevin K
8c0cc5c386
style: rustfmt run 2017-11-28 08:57:04 -05:00
Kevin K
ce6ca492c7
docs: changes the demo version to 2.28 to stay in sync 2017-11-28 04:38:37 -05:00
Kevin K
6f4c341241
api: Adds the traits to be used with the clap-derive crate to be able to use Custom Derive
Currently to use these traits clap must be built with the `unstable` feature. This does not
require a nightly compiler. These traits and APIs may change without warning (hence the `unstable`
feature flag). Once they have been stablelized and the `clap-derive` crate is released the
`unstable` feature flag will no longer be required.
2017-11-27 09:55:52 -05:00
Bastien Orivel
a6593410c1 Update bitflags to 1.0 and bump version 2017-11-21 12:39:12 +01:00
Kevin K
67170a8bd7
chore: increase version 2017-10-26 10:09:48 -04:00
Kevin K
0246960bdc
chore: adds term_size as an optional dep 2017-10-26 09:40:21 -04:00
Kevin K
3a471b72ce
docs: fixes some typo mistakes 2017-10-24 20:30:11 -04:00
Kevin K
48e0529bcd
chore: clippy run 2017-10-23 23:03:40 -04:00
Árpád Goretity
ac97edde90 Reorganize optionally depending on term_width 2017-10-06 13:14:01 +02:00
Kevin K
3224e2e1cd Merge pull request #1051 from malbarbo/master
make vec_map optional
2017-10-03 21:49:01 -04:00
Martin Geisler
e67a061bcf docs: add html_root_url attribute
This doc attribute is used by rustdoc when generating documentation
for other crates that depend on this crate. With the html_root_url,
rustdoc will be able to generate correct links into this crate.

See C-HTML-ROOT in the Rust API Guidelines for more information:
https://rust-lang-nursery.github.io/api-guidelines/documentation.html#crate-sets-html_root_url-attribute-c-html-root

A version-sync check was added to ensure that the URL is kept up to
date when the crate version changes.
2017-09-23 12:50:21 +02:00
Marco A L Barbosa
7b2aacde08 make vec_map optional 2017-09-19 15:21:58 -03:00
Kevin K
a8257ea0ff
fix(Help Message): fixes long_about not being usable
Closes #1043
2017-09-13 11:41:25 -07:00
Corentin Henry
2f0e511ab6 clippy doc_markdown 2017-06-12 07:53:55 -07:00
Martin Geisler
b93870c10a feat: use textwrap crate for wrapping help texts
The textwrap crate uses a simpler linear-time algorithm for wrapping
the text. The current algorithm in wrap_help uses several O(n) calls
to String::insert and String::remove, which makes it potentially
quadratic in complexity.

Comparing the 05_ripgrep benchmark at commits textwrap~2 and textwrap
gives this result on my machine:

 name              before ns/iter  after ns/iter  diff ns/iter   diff %
 build_app_long    22,101          21,099               -1,002   -4.53%
 build_app_short   22,138          21,205                 -933   -4.21%
 build_help_long   514,265         284,467            -229,798  -44.68%
 build_help_short  85,720          85,693                  -27   -0.03%
 parse_clean       23,471          22,859                 -612   -2.61%
 parse_complex     29,535          28,919                 -616   -2.09%
 parse_lots        422,815         414,577              -8,238   -1.95%

As part of this commit, the wrapping_newline_chars test was updated.
The old algorithm had a subtle bug where it would break lines too
early. That is, it wrapped the text like

    ARGS:
        <mode>    x, max, maximum   20 characters, contains
                  symbols.
                  l, long           Copy-friendly,
                  14 characters, contains symbols.
                  m, med, medium    Copy-friendly, 8
                  characters, contains symbols.";

when it should really have wrapped it like

    ARGS:
        <mode>    x, max, maximum   20 characters, contains
                  symbols.
                  l, long           Copy-friendly, 14
                  characters, contains symbols.
                  m, med, medium    Copy-friendly, 8
                  characters, contains symbols.";

Notice how the word "14" was incorrectly moved to the next line. There
is clearly room for the word on the line with the "l, long" option
since there is room for "contains" just above it.

I'm not sure why this is, but the algorithm in textwrap handles this
case correctly.
2017-05-29 17:02:57 -04:00
Michael Daffin
71dabba3ea docs: Fix a typo the minimum rust version required 2017-04-07 10:02:00 +01:00
Kevin K
9d4535e1c3
chore: clippy run 2017-03-10 08:24:30 -05:00
Anthony Ramine
f4939ad560 Remove direct dependency on libc
It's not actually used anymore anywhere.
2017-03-05 19:44:16 +01:00
Niklas Claesson
1971209c0c Fix minor documentation bug 2017-02-20 23:13:06 +01:00
Peter Williams
68e03681d8 refactor: use the atty crate for isatty() detection
Not only does this remove some unsafe code from clap itself, `atty` does the
right thing on Windows too. This isn't relevant now since we don't currently
support colorized output on Windows, but will come in handy if/when we
implement that feature (#836).
2017-02-19 11:12:55 -05:00
Brian Bowman
4f30a65b9c docs: fix spelling of "guaranteed" 2017-01-07 20:18:59 -06:00
Kevin K
802cd1bf17
docs: fixes the doc landing page 2016-11-20 21:27:17 -05:00
Kevin K
01e1e33f37
docs: updates the docs landing page 2016-11-20 20:59:00 -05:00
Tshepang Lekhonkhobe
2ebde60d5a doc: some formatting fixes 2016-11-14 20:18:44 +02: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
ee6e987acd
refactor(Completions): moves completing functions into their own modules 2016-10-23 19:31:24 -04:00
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