Commit graph

1488 commits

Author SHA1 Message Date
Hernan Grecco
9d757e8678 imp(macros.rs): Added write_nspaces macro (a new version of write_spaces)
`write_nspaces` has three differences with `write_spaces`

  1. Accepts arguments with attribute access (such as self.writer)
  2. The order of the arguments is swapped to make the writer the first
      argument as in other write related macros.
  3. Does not use the `write!` macro under the hood but rather calls
      directly `write`

I have chosen to put the function under a new name to avoid backwards
compatibility problem but it might be better to migrate everything to
`write_nspaces` (and maybe rename it `write_spaces`)
2016-04-13 07:06:22 -03:00
Hernan Grecco
65b3f66753 imp(srs/args): Added longest_filter to AnyArg trait
This function allows providing an extra filter to remove elements when finding
the longest element.
2016-04-13 07:06:22 -03:00
Hernan Grecco
d51945f8b8 imp(parser.rs): Make Parser's create_usage public allowing to have function outside the parser to generate the help 2016-04-13 07:06:22 -03:00
Hernan Grecco
9b23e7ee40 imp(parser.rs): Expose Parser's flags, opts and positionals argument as iterators
Writing the help requires read only access to Parser's flags, opts
and positionals. This commit provides 3 functions returning iterators
over those collections (`iter_*`) allowing to have function outside
the parser to generate the help.
2016-04-13 07:06:22 -03:00
Hernan Grecco
1321630ef5 imp(src/args): Exposes argument display order by introducing a new Trait
This commit introduces a new trait (`DispOrder`) with a single function
(`fn disp_order(&self) -> usize`). It is use to expose the display order
of an argument in a read-only manner.
2016-04-13 07:06:22 -03:00
Roman A. Taycher
d0f1d204a0 minor comment fixes 2016-04-11 22:37:36 -07:00
Roman A. Taycher
ac46864381 move import inside function to avoid conditional compilation warning 2016-04-11 16:49:39 -07:00
Roman A. Taycher
38fb59abf4 feat(Authors Macro): adds a crate_authors macro
Adds a crate_authors! macro that fetches
crate authors from a (recently added)
cargo enviromental variable populated
from the Cargo file. Like the
crate_version macro.

Closes #447
2016-04-11 16:17:44 -07:00
Homu
d9372d09bf Auto merge of #481 - kbknapp:v2.2.6, r=kbknapp
chore: increase version
2016-04-12 02:32:05 +09:00
Kevin K
8a95dace62 chore: increase version 2016-04-11 11:50:38 -07:00
Homu
eb5b29912f Auto merge of #479 - kbknapp:issue-476, r=kbknapp
Issue 476

From #477

Closes #476
2016-04-11 09:50:32 +09:00
Kevin K
c3795ad404 tests(Groups): removes tests causing issues that werent required 2016-04-09 22:33:49 -07:00
panicbit
3019a685ee Fix off-by-one-error in ArgGroup printing 2016-04-10 02:46:51 +02:00
Homu
1dd7e56632 Auto merge of #475 - kbknapp:updates, r=kbknapp
chore: updates deps
2016-04-09 09:52:46 +09:00
Kevin K
00d5a3e0b2 chore: updates deps 2016-04-08 11:40:38 -07:00
Homu
bad00f62ed Auto merge of #474 - kbknapp:issue-472, r=kbknapp
Issue 472
2016-04-03 23:58:42 +09:00
Homu
336d76e030 Auto merge of #473 - SirVer:fix_result, r=kbknapp
Use ::std::result::Result to make macro hygienic.

I ran into an error using

```
struct Error {}

pub type Result<T> = ::std::result::Result<T, Error>;

arg_enum!{
   ....
}
~~~

Attached is a fix.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/kbknapp/clap-rs/473)
<!-- Reviewable:end -->
2016-04-03 10:52:45 +09:00
Kevin K
616e803321 chore: increase version 2016-04-02 20:50:47 -04:00
Kevin K
0e69314e53 test(Help Message): adds test to prevent issue-472 2016-04-02 20:47:27 -04:00
Kevin K
71acf1d576 fix(Help Message): fixes bug where arg name is printed twice
Closes #472
2016-04-02 20:35:49 -04:00
Holger Rapp
4c676c06e8 Use ::std::result::Result to make macro hygienic. 2016-04-01 22:03:29 +02:00
Homu
fa02d3b33b Auto merge of #471 - kbknapp:issue-470, r=kbknapp
Issue 470

Relates to [multirust-rs 190](https://github.com/rust-lang-nursery/multirust-rs/issues/190)
2016-03-30 12:02:42 +09:00
Kevin K
e923c2c153 chore: increase version' 2016-03-29 22:32:15 -04:00
Kevin K
baf0e18095 tests(Empty Values): adds tests for empty values 2016-03-29 22:31:40 -04:00
Kevin K
885d166f04 fix(Empty Values): fixes bug where empty values weren't stored
Passing empty values, such as `--feature ""` now stores the empty string
correctly as a value (assuming empty values are allowed as per the arg
configuration)

Closes #470
2016-03-29 22:25:13 -04:00
Kevin K
d4b5545099 fix: fixes compiling with debug cargo feature 2016-03-29 22:24:34 -04:00
Homu
157f981b09 Auto merge of #467 - kbknapp:issue-466, r=kbknapp
fix(Help Subcommand): fixes issue where help and version flags weren'…

…t properly displayed

Closes #466
2016-03-29 11:38:05 +09:00
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