Commit graph

915 commits

Author SHA1 Message Date
Kevin K
a8257ea0ff
fix(Help Message): fixes long_about not being usable
Closes #1043
2017-09-13 11:41:25 -07:00
Tuomas Siipola
87e019fc84
fix: escape special characters in zsh and fish completions 2017-09-12 18:27:29 +03:00
Kevin K
79f8977ff1 Merge pull request #1022 from Phlosioneer/master
Fix documentation typo
2017-08-14 22:42:48 -04:00
Phlosioneer
4428cb87f3 Fix documentation type
"Value" was misspelled "vaue"
2017-08-08 21:48:07 -04:00
William Bain
434ea5ba71 fix(Suggestions): output for flag after subcommand 2017-08-05 12:46:50 -04:00
Kevin K
8699dfc37b
style: changes try-bang macro to questionmark 2017-07-29 14:29:22 -04:00
Jordan Danford
4a9acd6d9b Fix documentation for print_long_help, trim whitespace 2017-07-21 09:40:29 -04:00
kennytm
fb7d6231f1 impl Default for Values + OsValues for any lifetime. 2017-07-21 09:40:06 -04:00
Kevin K
d02e24a970 Merge pull request #980 from little-dude/flag
Suggest to use flag after a sub-command
2017-06-16 10:28:41 -04:00
Corentin Henry
e8518cf07d tests(Suggestions): update tests for subcommand suggestions 2017-06-12 08:03:39 -07:00
Corentin Henry
2671ca7260 imp(Suggestions): suggests to use flag after subcommand when applicable
If an invalid flag is found and this flag is a valid flag for a
sub-command, suggest using it after the subcommand

fix https://github.com/kbknapp/clap-rs/issues/927
2017-06-12 08:03:14 -07:00
Corentin Henry
9d5482ebf6 clippy: block_in_if_condition_stmt 2017-06-12 07:56:22 -07:00
Corentin Henry
35306ed9f1 clippy: single_match 2017-06-12 07:56:22 -07:00
Corentin Henry
cda5cfd1a8 clippy: explicit_iter_loop 2017-06-12 07:56:22 -07:00
Corentin Henry
2859af0e52 clippy: block_in_if_condition_stmt 2017-06-12 07:56:22 -07:00
Corentin Henry
2121c6b908 clippy: ignore too_many_arguments 2017-06-12 07:56:22 -07:00
Corentin Henry
f54b9dce74 clippy: ignore useless_let_if_seq 2017-06-12 07:56:22 -07:00
Corentin Henry
97394164c7 clippy: useless_let_if_seq 2017-06-12 07:56:22 -07:00
Corentin Henry
6e96447c50 clippy: or_fun_call 2017-06-12 07:56:22 -07:00
Corentin Henry
23e2f2b07b remove vec_remove!
it is used only once in the whole codebase and is only three lines long
2017-06-12 07:56:22 -07:00
Corentin Henry
80900a388c clippy: op_ref in vec_remove! 2017-06-12 07:56:22 -07:00
Corentin Henry
bc2103c643 clippy: op_ref for _find_by_long! 2017-06-12 07:56:22 -07:00
Corentin Henry
26f8ce01b9 clippy: op_ref in find_by_name! 2017-06-12 07:56:22 -07:00
Corentin Henry
adb253e63d clippy: op_ref 2017-06-12 07:56:22 -07:00
Corentin Henry
1deff7a44a clippy: identity_op 2017-06-12 07:56:19 -07:00
Corentin Henry
8578f56568 clippy: if_same_then_else 2017-06-12 07:53:55 -07:00
Corentin Henry
f86edf48b1 clippy: needless_borrow 2017-06-12 07:53:55 -07:00
Corentin Henry
dfcefea6fa clippy: collapsible_if 2017-06-12 07:53:55 -07:00
Corentin Henry
852e9ceb18 clippy: let_and_return 2017-06-12 07:53:55 -07:00
Corentin Henry
2f0e511ab6 clippy doc_markdown 2017-06-12 07:53:55 -07:00
Corentin Henry
be6ce71d33 fix unused_macros warnings for non-yaml build 2017-06-12 07:53:55 -07:00
Corentin Henry
e29590527a fix dead_code warning 2017-06-12 07:53:55 -07:00
Corentin Henry
548bf64e4a remove unused macros 2017-06-12 07:53:55 -07:00
Vanessa McHale
a6c6e81529 typo fixed 2017-06-10 17:43:09 -04:00
Vanessa McHale
0da5820e3b fixes bug with unicode widths 2017-06-10 17:43:09 -04:00
golem131
77763e1e29 Update bitflags 0.8.0 -> 0.9 2017-06-10 17:38:18 -04:00
Martin Geisler
49f9dc166a refactor: let wrap_help return the wrapped string
Earlier, wrap_help was doing in-place modification on the help text.
With the user of the textwrap crate, this is no longer the case and we
can return the string directly.
2017-05-29 20:48:10 -04:00
Martin Geisler
88f26e083e refactor: let textwrap handle long words
The textwrap crate can handle long words fine. By default they're
broken to avoid lines longer than the specified width, but this can be
disabled.
2017-05-29 20:48:10 -04:00
Martin Geisler
f89a012d09 refactor: simply print help text as-is
This should be equivalent to printing the lines one by one.
2017-05-29 20:48:10 -04:00
Martin Geisler
d31fe0322d refactor: avoid unnecessary '\n' checks when generating help
The code handling help texts with newlines can also handle help texts
without newlines.
2017-05-29 20:48:10 -04:00
Martin Geisler
9486f4c3f5 refactor: simplify initialization of help string 2017-05-29 20:48:10 -04: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
nate
d06f819f42 remove public from Colorizer properties and use ColorizerOption instead. 2017-05-29 13:04:47 -04:00
nate
4293013c26 clean up. fix lint and formatting. 2017-05-29 13:04:47 -04:00
nate
53e3d833f1 refactor to add ColorizeOption 2017-05-29 13:04:47 -04:00
nate
f400fa6e7f refactor color macro. refactor Colorizer to have ColorizerOption. 2017-05-29 13:04:47 -04:00
nate
f915f9ce42 add ColorizeOption and add function "new" for Colorizer
it has logic where checking tty is valid and if TERM is dumb when coloring
a message.
2017-05-29 13:04:47 -04:00
nate
3185511f3b when TERM=dumb, the output is colorless #847
comply to
2017-05-29 13:04:47 -04:00
Jacob Mischka
53c1ffe87f fix: Change who's -> whose 2017-05-29 12:58:18 -04:00
Kevin K
826048cb3c docs(clap_app!): adds using the @group specifier to the macro docs
Closes #932
2017-05-16 07:23:22 -04:00