Commit graph

1311 commits

Author SHA1 Message Date
Kevin K
34ffba2803 Merge branch 'master' into issue-466 2016-03-28 21:52:50 -04:00
Homu
a65b82269b Auto merge of #468 - Bilalh:patch-1, r=kbknapp
docs: fix spelling in Readme.md
2016-03-29 10:26:11 +09:00
Bilal Syed Hussain
73ad3ff23b docs: fix spelling in Readme.md 2016-03-29 00:57:39 +01:00
Kevin K
cebb889ebc chore: increase version 2016-03-28 11:28:36 -04:00
Kevin K
205b07bf2e fix(Help Subcommand): fixes issue where help and version flags weren't properly displayed
Closes #466
2016-03-28 11:26:56 -04:00
Kevin K
72ccf0cf6e Merge pull request #464 from kbknapp/dep-graph-update
chore: updates dep graph
2016-03-27 16:38:52 -04:00
Kevin K
2a00522dfa chore: updates dep graph
[ci skip]
2016-03-27 16:38:12 -04:00
Kevin K
5d5f4248a3 Merge pull request #463 from kbknapp/issue-456
Issue 456 and 461
2016-03-27 16:29:23 -04:00
Kevin K
f2cf2f8a0d chore: increase version 2016-03-27 16:02:10 -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
6933b8491c fix(Usage Strings): fixes small bug where -- would appear needlessly in usage strings
Closes #461
2016-03-27 14:22:51 -04:00
Homu
96869dfd57 Auto merge of #457 - kbknapp:clippy-update, r=kbknapp
Clippy update
2016-03-23 11:34:23 +09:00
Kevin K
144e7e29d6 chore: clippy run 2016-03-22 21:16:53 -04:00
Kevin K
3d4192b655 chore: pins travis to rustc+clippy working pair on nightly 2016-03-22 21:14:57 -04:00
Homu
afa6b5d66e Auto merge of #454 - kbknapp:issue-453,452, r=kbknapp
Issue 453,452
2016-03-17 22:32:31 +09:00
Kevin K
6322806ea8 tests: updates tests to new verbiage 2016-03-16 19:26:20 -04:00
Kevin K
929ee98ec8 chore: increase version 2016-03-16 19:26:20 -04:00
Kevin K
991aefc10a tests: updates tests to new verions 2016-03-16 10:22:00 -04:00
Kevin K
813d75d06f feat(Help Message): wraps and aligns the help message of subcommands
Subcommand's help strings are now automatically wrapped and aligned just
like other arguments.

Closes #452
2016-03-16 10:17:00 -04:00
Kevin K
1d73b03552 fix(Help Message): fixes a bug where small terminal sizes causing a loop
Now if the terminal size is too small to properly wrap the help text
lines, it will default to just wrapping normalling as it should.

This is determined on a per help text basis, so because the terminal
size is too small for a single argument's help to wrap properly, all
other arguments will still wrap and align correctly. Only the one
affected argument will not align properly.

Closes #453
2016-03-16 08:55:42 -04:00
Homu
cc127f9825 Auto merge of #450 - kbknapp:issue-416, r=kbknapp
Issue 416 - Help subcommand accepts other subcommands as arguments

Merge *after* #449

Closes #416
2016-03-16 05:22:41 +09:00
Kevin K
babfd26622 Merge branch 'master' into issue-416 2016-03-15 08:49:38 -04:00
Homu
f6d1685000 Auto merge of #449 - kbknapp:issue-428-redux, r=kbknapp
Issue 428 redux
2016-03-15 20:48:13 +09:00
Kevin K
c2cc1eb846 chore: updates readme and changelog for new features 2016-03-14 22:44:34 -04:00
Kevin K
2c12757bbd feat(Help Subcommand): adds support passing additional subcommands to help subcommand
The `help` subcommand can now accept other subcommands as arguments to
display their help message. This is similar to how many other CLIs
already perform. For example:

```
$ myprog help mysubcmd
```

Would print the help message for `mysubcmd`. But even more, the `help`
subcommand accepts nested subcommands as well, i.e. a grandchild
subcommand such as

```
$ myprog help child grandchild
```

Would print the help message of `grandchild` where `grandchild` is a
subcommand of `child` and `child` is a subcommand of `myprog`.

Closes #416
2016-03-14 22:41:47 -04:00
Kevin K
031b71733c chore: fixes platform dependant libc calls 2016-03-14 08:00:11 -04:00
Kevin K
d46eaa2cd6 style: fix formatting 2016-03-14 07:53:23 -04:00
Kevin K
f1850c654e chore: shows screenshot without clicking link 2016-03-13 22:14:07 -04:00
Kevin K
387b147820 chore: increase version 2016-03-13 22:10:34 -04:00
Kevin K
675c39f8ba tests: moves app settings tests to the proper place 2016-03-13 22:07:28 -04:00
Kevin K
e428bb6d84 tests: moves some \t tabs to four spaces for consistency 2016-03-13 22:07:28 -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
Homu
df38346557 Auto merge of #446 - kbknapp:issue-444, r=kbknapp
Issue 444
2016-03-11 08:03:44 +09:00
Kevin K
c5c58c86b9 fix(From Usage): fixes a bug where adding empty lines werent ignored 2016-03-10 16:36:23 -05:00
Kevin K
22000a08f7 chore: changes some assertions to debug assertions 2016-03-10 16:33:39 -05:00
Kevin K
ad86e43334 feat(Settings): adds support for automatically deriving custom display order of args
Args and subcommands can now have their display order automatically
derived by using the setting `AppSettings::DeriveDisplayOrder` which
will display the args and subcommands in the order that they were
declared in, instead of alphabetical order which is the default.

Closes #444
2016-03-10 16:32:02 -05:00
Homu
3f26d2b107 Auto merge of #443 - kbknapp:issue-442, r=kbknapp
Issue 442
2016-03-10 11:23:39 +09:00
Kevin K
927d1da1c7 chore: ignore failing clippy build 2016-03-09 19:54:42 -05:00
Kevin K
06c729f52f chore: fixes failing nightly lint 2016-03-09 18:40:31 -05:00
Kevin K
4ff0205b85 docs(Groups): explains required ArgGroups better
Closes #439
2016-03-09 20:16:52 -05:00
Kevin K
e41a2f1bea test: fixes failing doc tests 2016-03-09 20:14:35 -05:00
Kevin K
7d2a2ed413 feat(Subcommands): adds support for custom ordering in help messages
Allows custom ordering of subcommands within the help message. Subcommands with a lower
value will be displayed first in the help message. This is helpful when one would like to
emphasise frequently used subcommands, or prioritize those towards the top of the list.
Duplicate values **are** allowed. Subcommands with duplicate display orders will be
displayed in alphabetical order.

**NOTE:** The default is 999 for all subcommands.

```rust
use clap::{App, SubCommand};
let m = App::new("cust-ord")
    .subcommand(SubCommand::with_name("alpha") // typically subcommands are grouped
                                               // alphabetically by name. Subcommands
                                               // without a display_order have a value of
                                               // 999 and are displayed alphabetically with
                                               // all other 999 subcommands
        .about("Some help and text"))
    .subcommand(SubCommand::with_name("beta")
        .display_order(1)   // In order to force this subcommand to appear *first*
                            // all we have to do is give it a value lower than 999.
                            // Any other subcommands with a value of 1 will be displayed
                            // alphabetically with this one...then 2 values, then 3, etc.
        .about("I should be first!"))
    .get_matches_from(vec![
        "cust-ord", "--help"
    ]);
```

The above example displays the following help message

```
cust-ord

USAGE:
    cust-ord [FLAGS] [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    beta    I should be first!
    alpha   Some help and text
```

Closes #442
2016-03-09 19:43:53 -05:00
Kevin K
9803b51e79 feat(Opts and Flags): adds support for custom ordering in help messages
Allows custom ordering of args within the help message. Args with a lower value will be
displayed first in the help message. This is helpful when one would like to emphasise
frequently used args, or prioritize those towards the top of the list. Duplicate values
**are** allowed. Args with duplicate display orders will be displayed in alphabetical
order.

**NOTE:** The default is 999 for all arguments.

**NOTE:** This setting is ignored for positional arguments which are always displayed in
index order.

```rust
use clap::{App, Arg};
let m = App::new("cust-ord")
    .arg(Arg::with_name("a") // typically args are grouped by alphabetically by name
                             // Args without a display_order have a value of 999 and are
                             // displayed alphabetically with all other 999 args
        .long("long-option")
        .short("o")
        .takes_value(true)
        .help("Some help and text"))
    .arg(Arg::with_name("b")
        .long("other-option")
        .short("O")
        .takes_value(true)
        .display_order(1)   // Let's force this arg to appear *first*
                            // all we have to do is give it a value lower than 999
                            // any other args with a value of 1 would be displayed
                            // alphabetically with other 1 args. Then 2, then 3, etc.
        .help("I should be first!"))
    .get_matches_from(vec![
        "cust-ord", "--help"
    ]);
```

The above example displays the following help message

```
cust-ord

USAGE:
    cust-ord [FLAGS] [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -O, --other-option <b>    I should be first!
    -o, --long-option <a>     Some help and text
```
2016-03-09 19:41:43 -05:00
Homu
e2c104c8c5 Auto merge of #441 - kbknapp:vecmap-update, r=kbknapp
Update VecMap to 0.6

@alexbool

This is the new PR for your commit - no further action required, all rebasing is good!
2016-03-09 08:12:42 +09:00
Alexander Bulaev
150784ae20 Update VecMap to 0.6 2016-03-08 19:50:20 -05:00
Kevin K
87441b5f76 Merge pull request #440 from kbknapp/clippy-update
chore: clippy run
2016-03-08 16:23:48 -05:00
Kevin K
1862b7c2f4 Merge branch 'master' into clippy-update 2016-03-08 07:43:08 -05:00
Kevin K
deace34ad2 chore: clippy run 2016-03-08 10:39:43 -05:00
Kevin K
63d3d147b0 Merge pull request #438 from th4t/master
Update README.md
2016-03-08 07:42:50 -05:00
Vladislav Supalov
94c4335adc Update README.md
A tiny typo in the README.
2016-03-06 00:12:14 +01:00