Matt Kantor
059503e54d
Make {before-help} and {after-help} template tags include padding.
...
Previously there were separate tags for this, {before-help-padded} and
{after-help-padded}. Those have been removed and the default ones
given their behavior.
2020-08-14 09:14:10 -07:00
Matt Kantor
a87320ae88
Use a template to produce the default help message.
...
This makes some changes to the template system:
- Template tags for optional items (like {author}) now expand to
nothing when the value is unset instead of a default string (like
"unknown author").
- Many template tags now emit line-wrapped output to match
write_default_help.
- Items with long variants now expand to the appropriate thing for -h
vs --help.
- The now-obsolete {long-about} tag has been removed.
- A few new tags have been added.
These are externally-visible changes, but if this makes it into 3.0
that's probably reasonable?
Note that line-wrapping can have some odd edge cases since it does not
account for preceding/trailing characters on the same line as the tag.
This is already the case in master, but will affect some additional
tags with this changeset. See #2065 for details.
Closes #2002 .
2020-08-13 17:52:48 -07:00
bors[bot]
ca6c84fa8a
Merge #1961
...
1961: V3 docs r=CreepySkeleton a=pksunkara
Co-authored-by: Kevin K <kbknapp@gmail.com>
Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-08-12 14:58:09 +00:00
bors[bot]
2df656c98d
Merge #1998
...
1998: Relax some restrictions on validators r=pksunkara a=CreepySkeleton
Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-12 14:35:39 +00:00
Pavan Kumar Sunkara
c2e3b719ae
Apply suggestions from code review
...
Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-12 15:50:15 +02:00
CreepySkeleton
39fadbf7c8
Rebase
2020-08-12 16:40:19 +03:00
CreepySkeleton
6169bb8e79
Fix buggy tests
2020-08-12 06:12:44 +03:00
CreepySkeleton
32414fbdff
Fix and rearrange debug asserts
2020-08-12 06:12:42 +03:00
CreepySkeleton
619658e17a
Add test
2020-08-12 02:39:59 +03:00
CreepySkeleton
18a58af3ac
Allow validators to be FnMut
2020-08-12 02:39:59 +03:00
CreepySkeleton
790a0f5e62
Make sure that App & Arg & ArgGroup implement Send + Sync
...
Also relaxes 'static restriction on validators.
2020-08-12 02:39:59 +03:00
bors[bot]
9185366420
Merge #2058
...
2058: Add blank line between items in long help r=pksunkara a=mkantor
Co-authored-by: Matt Kantor <the.matt.kantor@gmail.com>
2020-08-11 23:30:48 +00:00
Matt Kantor
0d8ebeb36b
Fix doc comment for Arg::long_about.
2020-08-11 15:30:30 -07:00
Matt Kantor
f7e2fbf150
Print an empty line after multi-line argument help.
...
Fixes #1642 .
2020-08-11 15:30:30 -07:00
Matt Kantor
bf34c04060
Add a test for --help with long argument help.
2020-08-11 15:30:30 -07:00
Pavan Kumar Sunkara
5c0947f160
Add derive traits only if derive feature is enabled
2020-08-11 16:30:02 +02:00
Pavan Kumar Sunkara
9b22f19995
Update more docs
2020-08-11 16:08:05 +02:00
Kevin K
89fcc755e4
wip: doc updates for App
...
Still more to do in this file, hence the wip status
2020-08-11 15:41:00 +02:00
Kevin K
aa694c893f
docs(FromArgMatches): initial draft
2020-08-11 15:21:58 +02:00
Kevin K
763f0a0363
wip: Clap trait docs
2020-08-11 15:21:57 +02:00
Kevin K
609202e2a0
wip: clap_derive docs
2020-08-11 15:21:57 +02:00
Kevin K
c76f526773
adds ctags to the gitignore
2020-08-11 15:21:57 +02:00
bors[bot]
da92a32d10
Merge #2048
...
2048: Change the ret tyte of Argmatches::subcommand r=pksunkara a=CreepySkeleton
Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-11 00:20:35 +00:00
bors[bot]
6492ae2353
Merge #1793
...
1793: Add hinting of arg value types for zsh/fish completion r=CreepySkeleton a=intgr
Co-authored-by: Marti Raudsepp <marti@juffo.org>
2020-08-07 18:14:01 +00:00
Marti Raudsepp
64ee0f8009
Add hinting of arg value types for zsh/fish completion
...
Adds new method/attribute `Arg::value_hint`, taking a `ValueHint` enum
as argument. The hint can denote accepted values, for example: paths,
usernames, hostnames, commands, etc.
This initial implementation supports hints for the zsh and fish
completion generators, support for other shells can be added later.
2020-08-06 22:17:31 +03:00
CreepySkeleton
f0044d205d
Remove a redundant lifetime
2020-08-05 22:33:51 +03:00
CreepySkeleton
e6cc49ecde
Adjust derive
2020-08-05 17:07:13 +03:00
CreepySkeleton
e9759a241b
Adjust examples and tests
2020-08-05 17:07:13 +03:00
CreepySkeleton
6dcf93be00
Change the return type of ArgMatches::subcommand()
2020-08-05 13:35:42 +03:00
bors[bot]
a4bc1f2abc
Merge #2038
...
2038: Improve iterator use r=CreepySkeleton a=nnethercote
Co-authored-by: Nicholas Nethercote <nnethercote@mozilla.com>
2020-07-29 02:14:00 +00:00
Nicholas Nethercote
ed46e8962c
refactor: Combine two large and very similar expressions.
2020-07-29 10:35:36 +10:00
Nicholas Nethercote
7fb397d905
refactor: Simplify some it.any(...)
calls.
2020-07-29 10:35:34 +10:00
Nicholas Nethercote
be535e28cf
refactor: Avoid unnecessary uses of enumerate()
.
2020-07-29 10:35:31 +10:00
Nicholas Nethercote
d8c775eb26
refactor: Replace it.filter(...).find(...)
with it.find(...)
.
2020-07-29 10:35:27 +10:00
Nicholas Nethercote
217b111bd7
refactor: Replace it.find(...).is_none()
with !it.any(...)
.
2020-07-29 10:35:22 +10:00
bors[bot]
dbdd63b350
Merge #2016
...
2016: imp(errors): Provide the missing required arguments as info r=CreepySkeleton a=nickelc
Co-authored-by: Constantin Nickel <constantin.nickel@gmail.com>
2020-07-26 08:08:35 +00:00
bors[bot]
dda961b715
Merge #2027
...
2027: style: rename ErrorKind::{VersionDisplayed, HelpDisplayed} to present tense r=CreepySkeleton a=siyopao
Co-authored-by: Craig Pastro <siyopao@gmail.com>
2020-07-26 07:36:52 +00:00
bors[bot]
dd5e6b2313
Merge #2025
...
2025: Make lifetimes descriptive r=pksunkara a=CreepySkeleton
Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-07-21 16:30:08 +00:00
CreepySkeleton
37c1631f06
Make lifetimes descriptive
2020-07-21 18:59:07 +03:00
bors[bot]
1d57aa2ffb
Merge #2030
...
2030: style: replacing yml with yaml for consistency r=pksunkara a=marcospb19
Co-authored-by: João Marcos <marcospb19@hotmail.com>
2020-07-21 13:11:15 +00:00
bors[bot]
aab97614ed
Merge #2020
...
2020: Implementation of feature request #1918 r=pksunkara a=leo-lb
Co-authored-by: Léo Le Bouter <lle-bout@zaclys.net>
2020-07-21 09:47:23 +00:00
João Marcos
24760bc261
style: replacing yml with yaml for consistency
2020-07-20 20:58:34 -03:00
Léo Le Bouter
eabe8b67b4
Implementation of feature request #1918
2020-07-20 15:35:40 +02:00
Craig Pastro
866f2edbed
style: rename ErrorKind::{VersionDisplayed, HelpDisplayed} to present tense
2020-07-20 10:27:07 +09:00
bors[bot]
dc363d0b91
Merge #2008
...
2008: feat: Added {before/after}_help_long to App struct, closed #1903 r=pksunkara a=Blaxar
Co-authored-by: Blaxar Waldarax <blaxar.waldarax@gmail.com>
2020-07-19 12:28:09 +00:00
Blaxar Waldarax
748aea39f3
feat: Added {before/after}_help_long to App struct, closed #1903
2020-07-19 13:59:53 +02:00
bors[bot]
1dd3fcb954
Merge #2019
...
2019: tests(validators): Add tests for `clap_app!` macro and `FromStr` trait validator r=pksunkara a=nickelc
Co-authored-by: Constantin Nickel <constantin.nickel@gmail.com>
2020-07-19 10:28:03 +00:00
bors[bot]
caa7bc6a15
Merge #2024
...
2024: Fix various typos in docs & code r=pksunkara a=intgr
Co-authored-by: Marti Raudsepp <marti@juffo.org>
2020-07-19 10:04:37 +00:00
Marti Raudsepp
594c535ba2
Fix various typos in docs & code
...
Most errors detected and fixed with Topy (https://github.com/intgr/topy ),
all verified by hand.
2020-07-19 03:10:28 +03:00
Constantin Nickel
066d745653
tests(validators): Add tests for clap_app!
macro and FromStr
trait
2020-07-18 17:47:11 +02:00