Auto merge of #898 - kbknapp:issues-896,895, r=kbknapp

Issues 896,895
This commit is contained in:
Homu 2017-03-13 03:17:34 +09:00
commit 1b2e7ad4e4
8 changed files with 105 additions and 58 deletions

View file

@ -1,3 +1,14 @@
<a name="v2.21.1"></a>
### v2.21.1 (2017-03-12)
#### Bug Fixes
* **ArgRequiredElseHelp:** fixes the precedence of this error to prioritize over other error messages ([74b751ff](https://github.com/kbknapp/clap-rs/commit/74b751ff2e3631e337b7946347c1119829a41c53), closes [#895](https://github.com/kbknapp/clap-rs/issues/895))
* **Positionals:** fixes some regression bugs resulting from old asserts in debug mode. ([9a3bc98e](https://github.com/kbknapp/clap-rs/commit/9a3bc98e9b55e7514b74b73374c5ac8b6e5e0508), closes [#896](https://github.com/kbknapp/clap-rs/issues/896))
<a name="v2.21.0"></a>
## v2.21.0 (2017-03-09)

View file

@ -1,56 +1,64 @@
The following is a list of contributors in alphabetical order:
[<img alt="afiune" src="https://avatars.githubusercontent.com/u/5712253?v=3&s=117" width="117">](https://github.com/afiune) |[<img alt="alex-gulyas" src="https://avatars.githubusercontent.com/u/8698329?v=3&s=117" width="117">](https://github.com/alex-gulyas) |[<img alt="alexbool" src="https://avatars.githubusercontent.com/u/1283792?v=3&s=117" width="117">](https://github.com/alexbool) |[<img alt="AluisioASG" src="https://avatars.githubusercontent.com/u/1904165?v=3&s=117" width="117">](https://github.com/AluisioASG) |[<img alt="archer884" src="https://avatars.githubusercontent.com/u/679494?v=3&s=117" width="117">](https://github.com/archer884) |[<img alt="Arnavion" src="https://avatars.githubusercontent.com/u/1096010?v=3&s=117" width="117">](https://github.com/Arnavion) |
[<img alt="afiune" src="https://avatars3.githubusercontent.com/u/5712253?v=3&s=117" width="117">](https://github.com/afiune) |[<img alt="alex-gulyas" src="https://avatars3.githubusercontent.com/u/8698329?v=3&s=117" width="117">](https://github.com/alex-gulyas) |[<img alt="alexbool" src="https://avatars0.githubusercontent.com/u/1283792?v=3&s=117" width="117">](https://github.com/alexbool) |[<img alt="AluisioASG" src="https://avatars1.githubusercontent.com/u/1904165?v=3&s=117" width="117">](https://github.com/AluisioASG) |[<img alt="andete" src="https://avatars1.githubusercontent.com/u/689017?v=3&s=117" width="117">](https://github.com/andete) |[<img alt="archer884" src="https://avatars2.githubusercontent.com/u/679494?v=3&s=117" width="117">](https://github.com/archer884) |
:---: |:---: |:---: |:---: |:---: |:---: |
[afiune](https://github.com/afiune) |[alex-gulyas](https://github.com/alex-gulyas) |[alexbool](https://github.com/alexbool) |[AluisioASG](https://github.com/AluisioASG) |[archer884](https://github.com/archer884) |[Arnavion](https://github.com/Arnavion) |
[afiune](https://github.com/afiune) |[alex-gulyas](https://github.com/alex-gulyas) |[alexbool](https://github.com/alexbool) |[AluisioASG](https://github.com/AluisioASG) |[andete](https://github.com/andete) |[archer884](https://github.com/archer884) |
[<img alt="Bilalh" src="https://avatars.githubusercontent.com/u/171602?v=3&s=117" width="117">](https://github.com/Bilalh) |[<img alt="birkenfeld" src="https://avatars.githubusercontent.com/u/144359?v=3&s=117" width="117">](https://github.com/birkenfeld) |[<img alt="bradurani" src="https://avatars.githubusercontent.com/u/4195952?v=3&s=117" width="117">](https://github.com/bradurani) |[<img alt="brennie" src="https://avatars.githubusercontent.com/u/156585?v=3&s=117" width="117">](https://github.com/brennie) |[<img alt="brianp" src="https://avatars.githubusercontent.com/u/179134?v=3&s=117" width="117">](https://github.com/brianp) |[<img alt="BurntSushi" src="https://avatars.githubusercontent.com/u/456674?v=3&s=117" width="117">](https://github.com/BurntSushi) |
[<img alt="Arnavion" src="https://avatars1.githubusercontent.com/u/1096010?v=3&s=117" width="117">](https://github.com/Arnavion) |[<img alt="Bilalh" src="https://avatars3.githubusercontent.com/u/171602?v=3&s=117" width="117">](https://github.com/Bilalh) |[<img alt="birkenfeld" src="https://avatars3.githubusercontent.com/u/144359?v=3&s=117" width="117">](https://github.com/birkenfeld) |[<img alt="bradurani" src="https://avatars3.githubusercontent.com/u/4195952?v=3&s=117" width="117">](https://github.com/bradurani) |[<img alt="brennie" src="https://avatars0.githubusercontent.com/u/156585?v=3&s=117" width="117">](https://github.com/brennie) |[<img alt="brianp" src="https://avatars2.githubusercontent.com/u/179134?v=3&s=117" width="117">](https://github.com/brianp) |
:---: |:---: |:---: |:---: |:---: |:---: |
[Bilalh](https://github.com/Bilalh) |[birkenfeld](https://github.com/birkenfeld) |[bradurani](https://github.com/bradurani) |[brennie](https://github.com/brennie) |[brianp](https://github.com/brianp) |[BurntSushi](https://github.com/BurntSushi) |
[Arnavion](https://github.com/Arnavion) |[Bilalh](https://github.com/Bilalh) |[birkenfeld](https://github.com/birkenfeld) |[bradurani](https://github.com/bradurani) |[brennie](https://github.com/brennie) |[brianp](https://github.com/brianp) |
[<img alt="Byron" src="https://avatars.githubusercontent.com/u/63622?v=3&s=117" width="117">](https://github.com/Byron) |[<img alt="casey" src="https://avatars.githubusercontent.com/u/1945?v=3&s=117" width="117">](https://github.com/casey) |[<img alt="cite-reader" src="https://avatars.githubusercontent.com/u/4196987?v=3&s=117" width="117">](https://github.com/cite-reader) |[<img alt="cstorey" src="https://avatars.githubusercontent.com/u/743059?v=3&s=117" width="117">](https://github.com/cstorey) |[<img alt="daboross" src="https://avatars.githubusercontent.com/u/1152146?v=3&s=117" width="117">](https://github.com/daboross) |[<img alt="davidszotten" src="https://avatars.githubusercontent.com/u/412005?v=3&s=117" width="117">](https://github.com/davidszotten) |
[<img alt="BurntSushi" src="https://avatars0.githubusercontent.com/u/456674?v=3&s=117" width="117">](https://github.com/BurntSushi) |[<img alt="Byron" src="https://avatars1.githubusercontent.com/u/63622?v=3&s=117" width="117">](https://github.com/Byron) |[<img alt="casey" src="https://avatars1.githubusercontent.com/u/1945?v=3&s=117" width="117">](https://github.com/casey) |[<img alt="cite-reader" src="https://avatars2.githubusercontent.com/u/4196987?v=3&s=117" width="117">](https://github.com/cite-reader) |[<img alt="crazymerlyn" src="https://avatars2.githubusercontent.com/u/6919679?v=3&s=117" width="117">](https://github.com/crazymerlyn) |[<img alt="cstorey" src="https://avatars0.githubusercontent.com/u/743059?v=3&s=117" width="117">](https://github.com/cstorey) |
:---: |:---: |:---: |:---: |:---: |:---: |
[Byron](https://github.com/Byron) |[casey](https://github.com/casey) |[cite-reader](https://github.com/cite-reader) |[cstorey](https://github.com/cstorey) |[daboross](https://github.com/daboross) |[davidszotten](https://github.com/davidszotten) |
[BurntSushi](https://github.com/BurntSushi) |[Byron](https://github.com/Byron) |[casey](https://github.com/casey) |[cite-reader](https://github.com/cite-reader) |[crazymerlyn](https://github.com/crazymerlyn) |[cstorey](https://github.com/cstorey) |
[<img alt="Deedasmi" src="https://avatars.githubusercontent.com/u/5093293?v=3&s=117" width="117">](https://github.com/Deedasmi) |[<img alt="dguo" src="https://avatars.githubusercontent.com/u/2763135?v=3&s=117" width="117">](https://github.com/dguo) |[<img alt="dotdash" src="https://avatars.githubusercontent.com/u/230962?v=3&s=117" width="117">](https://github.com/dotdash) |[<img alt="flying-sheep" src="https://avatars.githubusercontent.com/u/291575?v=3&s=117" width="117">](https://github.com/flying-sheep) |[<img alt="Geogi" src="https://avatars.githubusercontent.com/u/1818316?v=3&s=117" width="117">](https://github.com/Geogi) |[<img alt="glowing-chemist" src="https://avatars.githubusercontent.com/u/17074682?v=3&s=117" width="117">](https://github.com/glowing-chemist) |
[<img alt="daboross" src="https://avatars2.githubusercontent.com/u/1152146?v=3&s=117" width="117">](https://github.com/daboross) |[<img alt="davidszotten" src="https://avatars0.githubusercontent.com/u/412005?v=3&s=117" width="117">](https://github.com/davidszotten) |[<img alt="Deedasmi" src="https://avatars3.githubusercontent.com/u/5093293?v=3&s=117" width="117">](https://github.com/Deedasmi) |[<img alt="dguo" src="https://avatars3.githubusercontent.com/u/2763135?v=3&s=117" width="117">](https://github.com/dguo) |[<img alt="dotdash" src="https://avatars2.githubusercontent.com/u/230962?v=3&s=117" width="117">](https://github.com/dotdash) |[<img alt="eddyb" src="https://avatars1.githubusercontent.com/u/77424?v=3&s=117" width="117">](https://github.com/eddyb) |
:---: |:---: |:---: |:---: |:---: |:---: |
[Deedasmi](https://github.com/Deedasmi) |[dguo](https://github.com/dguo) |[dotdash](https://github.com/dotdash) |[flying-sheep](https://github.com/flying-sheep) |[Geogi](https://github.com/Geogi) |[glowing-chemist](https://github.com/glowing-chemist) |
[daboross](https://github.com/daboross) |[davidszotten](https://github.com/davidszotten) |[Deedasmi](https://github.com/Deedasmi) |[dguo](https://github.com/dguo) |[dotdash](https://github.com/dotdash) |[eddyb](https://github.com/eddyb) |
[<img alt="gohyda" src="https://avatars.githubusercontent.com/u/10263838?v=3&s=117" width="117">](https://github.com/gohyda) |[<img alt="GrappigPanda" src="https://avatars.githubusercontent.com/u/2055372?v=3&s=117" width="117">](https://github.com/GrappigPanda) |[<img alt="grossws" src="https://avatars.githubusercontent.com/u/171284?v=3&s=117" width="117">](https://github.com/grossws) |[<img alt="hexjelly" src="https://avatars.githubusercontent.com/u/435283?v=3&s=117" width="117">](https://github.com/hexjelly) |[<img alt="hgrecco" src="https://avatars.githubusercontent.com/u/278566?v=3&s=117" width="117">](https://github.com/hgrecco) |[<img alt="homu" src="https://avatars.githubusercontent.com/u/10212162?v=3&s=117" width="117">](https://github.com/homu) |
[<img alt="flying-sheep" src="https://avatars3.githubusercontent.com/u/291575?v=3&s=117" width="117">](https://github.com/flying-sheep) |[<img alt="frewsxcv" src="https://avatars1.githubusercontent.com/u/416575?v=3&s=117" width="117">](https://github.com/frewsxcv) |[<img alt="Geogi" src="https://avatars2.githubusercontent.com/u/1818316?v=3&s=117" width="117">](https://github.com/Geogi) |[<img alt="glowing-chemist" src="https://avatars3.githubusercontent.com/u/17074682?v=3&s=117" width="117">](https://github.com/glowing-chemist) |[<img alt="gohyda" src="https://avatars0.githubusercontent.com/u/10263838?v=3&s=117" width="117">](https://github.com/gohyda) |[<img alt="GrappigPanda" src="https://avatars3.githubusercontent.com/u/2055372?v=3&s=117" width="117">](https://github.com/GrappigPanda) |
:---: |:---: |:---: |:---: |:---: |:---: |
[gohyda](https://github.com/gohyda) |[GrappigPanda](https://github.com/GrappigPanda) |[grossws](https://github.com/grossws) |[hexjelly](https://github.com/hexjelly) |[hgrecco](https://github.com/hgrecco) |[homu](https://github.com/homu) |
[flying-sheep](https://github.com/flying-sheep) |[frewsxcv](https://github.com/frewsxcv) |[Geogi](https://github.com/Geogi) |[glowing-chemist](https://github.com/glowing-chemist) |[gohyda](https://github.com/gohyda) |[GrappigPanda](https://github.com/GrappigPanda) |
[<img alt="hoodie" src="https://avatars.githubusercontent.com/u/260370?v=3&s=117" width="117">](https://github.com/hoodie) |[<img alt="huonw" src="https://avatars.githubusercontent.com/u/1203825?v=3&s=117" width="117">](https://github.com/huonw) |[<img alt="idmit" src="https://avatars.githubusercontent.com/u/2546728?v=3&s=117" width="117">](https://github.com/idmit) |[<img alt="iliekturtles" src="https://avatars.githubusercontent.com/u/5081378?v=3&s=117" width="117">](https://github.com/iliekturtles) |[<img alt="james-darkfox" src="https://avatars.githubusercontent.com/u/637155?v=3&s=117" width="117">](https://github.com/james-darkfox) |[<img alt="japaric" src="https://avatars.githubusercontent.com/u/5018213?v=3&s=117" width="117">](https://github.com/japaric) |
[<img alt="grossws" src="https://avatars1.githubusercontent.com/u/171284?v=3&s=117" width="117">](https://github.com/grossws) |[<img alt="hexjelly" src="https://avatars3.githubusercontent.com/u/435283?v=3&s=117" width="117">](https://github.com/hexjelly) |[<img alt="hgrecco" src="https://avatars3.githubusercontent.com/u/278566?v=3&s=117" width="117">](https://github.com/hgrecco) |[<img alt="homu" src="https://avatars2.githubusercontent.com/u/10212162?v=3&s=117" width="117">](https://github.com/homu) |[<img alt="hoodie" src="https://avatars2.githubusercontent.com/u/260370?v=3&s=117" width="117">](https://github.com/hoodie) |[<img alt="huonw" src="https://avatars2.githubusercontent.com/u/1203825?v=3&s=117" width="117">](https://github.com/huonw) |
:---: |:---: |:---: |:---: |:---: |:---: |
[hoodie](https://github.com/hoodie) |[huonw](https://github.com/huonw) |[idmit](https://github.com/idmit) |[iliekturtles](https://github.com/iliekturtles) |[james-darkfox](https://github.com/james-darkfox) |[japaric](https://github.com/japaric) |
[grossws](https://github.com/grossws) |[hexjelly](https://github.com/hexjelly) |[hgrecco](https://github.com/hgrecco) |[homu](https://github.com/homu) |[hoodie](https://github.com/hoodie) |[huonw](https://github.com/huonw) |
[<img alt="jespino" src="https://avatars.githubusercontent.com/u/290303?v=3&s=117" width="117">](https://github.com/jespino) |[<img alt="jimmycuadra" src="https://avatars.githubusercontent.com/u/122457?v=3&s=117" width="117">](https://github.com/jimmycuadra) |[<img alt="joshtriplett" src="https://avatars.githubusercontent.com/u/162737?v=3&s=117" width="117">](https://github.com/joshtriplett) |[<img alt="jtdowney" src="https://avatars.githubusercontent.com/u/44654?v=3&s=117" width="117">](https://github.com/jtdowney) |[<img alt="kbknapp" src="https://avatars.githubusercontent.com/u/6942134?v=3&s=117" width="117">](https://github.com/kbknapp) |[<img alt="Keats" src="https://avatars.githubusercontent.com/u/680355?v=3&s=117" width="117">](https://github.com/Keats) |
[<img alt="idmit" src="https://avatars2.githubusercontent.com/u/2546728?v=3&s=117" width="117">](https://github.com/idmit) |[<img alt="ignatenkobrain" src="https://avatars2.githubusercontent.com/u/2866862?v=3&s=117" width="117">](https://github.com/ignatenkobrain) |[<img alt="iliekturtles" src="https://avatars0.githubusercontent.com/u/5081378?v=3&s=117" width="117">](https://github.com/iliekturtles) |[<img alt="james-darkfox" src="https://avatars0.githubusercontent.com/u/637155?v=3&s=117" width="117">](https://github.com/james-darkfox) |[<img alt="japaric" src="https://avatars0.githubusercontent.com/u/5018213?v=3&s=117" width="117">](https://github.com/japaric) |[<img alt="jespino" src="https://avatars3.githubusercontent.com/u/290303?v=3&s=117" width="117">](https://github.com/jespino) |
:---: |:---: |:---: |:---: |:---: |:---: |
[jespino](https://github.com/jespino) |[jimmycuadra](https://github.com/jimmycuadra) |[joshtriplett](https://github.com/joshtriplett) |[jtdowney](https://github.com/jtdowney) |[kbknapp](https://github.com/kbknapp) |[Keats](https://github.com/Keats) |
[idmit](https://github.com/idmit) |[ignatenkobrain](https://github.com/ignatenkobrain) |[iliekturtles](https://github.com/iliekturtles) |[james-darkfox](https://github.com/james-darkfox) |[japaric](https://github.com/japaric) |[jespino](https://github.com/jespino) |
[<img alt="matthiasbeyer" src="https://avatars.githubusercontent.com/u/427866?v=3&s=117" width="117">](https://github.com/matthiasbeyer) |[<img alt="mernen" src="https://avatars.githubusercontent.com/u/6412?v=3&s=117" width="117">](https://github.com/mernen) |[<img alt="messense" src="https://avatars.githubusercontent.com/u/1556054?v=3&s=117" width="117">](https://github.com/messense) |[<img alt="mgeisler" src="https://avatars.githubusercontent.com/u/89623?v=3&s=117" width="117">](https://github.com/mgeisler) |[<img alt="mineo" src="https://avatars.githubusercontent.com/u/78236?v=3&s=117" width="117">](https://github.com/mineo) |[<img alt="musoke" src="https://avatars.githubusercontent.com/u/16665084?v=3&s=117" width="117">](https://github.com/musoke) |
[<img alt="jimmycuadra" src="https://avatars1.githubusercontent.com/u/122457?v=3&s=117" width="117">](https://github.com/jimmycuadra) |[<img alt="joshtriplett" src="https://avatars1.githubusercontent.com/u/162737?v=3&s=117" width="117">](https://github.com/joshtriplett) |[<img alt="jtdowney" src="https://avatars2.githubusercontent.com/u/44654?v=3&s=117" width="117">](https://github.com/jtdowney) |[<img alt="kbknapp" src="https://avatars2.githubusercontent.com/u/6942134?v=3&s=117" width="117">](https://github.com/kbknapp) |[<img alt="Keats" src="https://avatars1.githubusercontent.com/u/680355?v=3&s=117" width="117">](https://github.com/Keats) |[<img alt="malbarbo" src="https://avatars0.githubusercontent.com/u/1678126?v=3&s=117" width="117">](https://github.com/malbarbo) |
:---: |:---: |:---: |:---: |:---: |:---: |
[jimmycuadra](https://github.com/jimmycuadra) |[joshtriplett](https://github.com/joshtriplett) |[jtdowney](https://github.com/jtdowney) |[kbknapp](https://github.com/kbknapp) |[Keats](https://github.com/Keats) |[malbarbo](https://github.com/malbarbo) |
[<img alt="matthiasbeyer" src="https://avatars3.githubusercontent.com/u/427866?v=3&s=117" width="117">](https://github.com/matthiasbeyer) |[<img alt="mernen" src="https://avatars3.githubusercontent.com/u/6412?v=3&s=117" width="117">](https://github.com/mernen) |[<img alt="messense" src="https://avatars3.githubusercontent.com/u/1556054?v=3&s=117" width="117">](https://github.com/messense) |[<img alt="mgeisler" src="https://avatars3.githubusercontent.com/u/89623?v=3&s=117" width="117">](https://github.com/mgeisler) |[<img alt="mineo" src="https://avatars2.githubusercontent.com/u/78236?v=3&s=117" width="117">](https://github.com/mineo) |[<img alt="musoke" src="https://avatars3.githubusercontent.com/u/16665084?v=3&s=117" width="117">](https://github.com/musoke) |
:---: |:---: |:---: |:---: |:---: |:---: |
[matthiasbeyer](https://github.com/matthiasbeyer) |[mernen](https://github.com/mernen) |[messense](https://github.com/messense) |[mgeisler](https://github.com/mgeisler) |[mineo](https://github.com/mineo) |[musoke](https://github.com/musoke) |
[<img alt="mvaude" src="https://avatars.githubusercontent.com/u/9532611?v=3&s=117" width="117">](https://github.com/mvaude) |[<img alt="N-006" src="https://avatars.githubusercontent.com/u/399312?v=3&s=117" width="117">](https://github.com/N-006) |[<img alt="nabijaczleweli" src="https://avatars.githubusercontent.com/u/6709544?v=3&s=117" width="117">](https://github.com/nabijaczleweli) |[<img alt="nelsonjchen" src="https://avatars.githubusercontent.com/u/5363?v=3&s=117" width="117">](https://github.com/nelsonjchen) |[<img alt="Nemo157" src="https://avatars.githubusercontent.com/u/81079?v=3&s=117" width="117">](https://github.com/Nemo157) |[<img alt="nicompte" src="https://avatars.githubusercontent.com/u/439369?v=3&s=117" width="117">](https://github.com/nicompte) |
[<img alt="mvaude" src="https://avatars2.githubusercontent.com/u/9532611?v=3&s=117" width="117">](https://github.com/mvaude) |[<img alt="N-006" src="https://avatars3.githubusercontent.com/u/399312?v=3&s=117" width="117">](https://github.com/N-006) |[<img alt="nabijaczleweli" src="https://avatars0.githubusercontent.com/u/6709544?v=3&s=117" width="117">](https://github.com/nabijaczleweli) |[<img alt="nelsonjchen" src="https://avatars2.githubusercontent.com/u/5363?v=3&s=117" width="117">](https://github.com/nelsonjchen) |[<img alt="Nemo157" src="https://avatars2.githubusercontent.com/u/81079?v=3&s=117" width="117">](https://github.com/Nemo157) |[<img alt="NickeZ" src="https://avatars1.githubusercontent.com/u/492753?v=3&s=117" width="117">](https://github.com/NickeZ) |
:---: |:---: |:---: |:---: |:---: |:---: |
[mvaude](https://github.com/mvaude) |[N-006](https://github.com/N-006) |[nabijaczleweli](https://github.com/nabijaczleweli) |[nelsonjchen](https://github.com/nelsonjchen) |[Nemo157](https://github.com/Nemo157) |[nicompte](https://github.com/nicompte) |
[mvaude](https://github.com/mvaude) |[N-006](https://github.com/N-006) |[nabijaczleweli](https://github.com/nabijaczleweli) |[nelsonjchen](https://github.com/nelsonjchen) |[Nemo157](https://github.com/Nemo157) |[NickeZ](https://github.com/NickeZ) |
[<img alt="nvzqz" src="https://avatars.githubusercontent.com/u/10367662?v=3&s=117" width="117">](https://github.com/nvzqz) |[<img alt="ogham" src="https://avatars.githubusercontent.com/u/503760?v=3&s=117" width="117">](https://github.com/ogham) |[<img alt="panicbit" src="https://avatars.githubusercontent.com/u/628445?v=3&s=117" width="117">](https://github.com/panicbit) |[<img alt="pixelistik" src="https://avatars.githubusercontent.com/u/170929?v=3&s=117" width="117">](https://github.com/pixelistik) |[<img alt="rnelson" src="https://avatars.githubusercontent.com/u/118361?v=3&s=117" width="117">](https://github.com/rnelson) |[<img alt="rtaycher" src="https://avatars.githubusercontent.com/u/324733?v=3&s=117" width="117">](https://github.com/rtaycher) |
[<img alt="nicompte" src="https://avatars1.githubusercontent.com/u/439369?v=3&s=117" width="117">](https://github.com/nicompte) |[<img alt="nox" src="https://avatars3.githubusercontent.com/u/123095?v=3&s=117" width="117">](https://github.com/nox) |[<img alt="nvzqz" src="https://avatars3.githubusercontent.com/u/10367662?v=3&s=117" width="117">](https://github.com/nvzqz) |[<img alt="ogham" src="https://avatars0.githubusercontent.com/u/503760?v=3&s=117" width="117">](https://github.com/ogham) |[<img alt="panicbit" src="https://avatars1.githubusercontent.com/u/628445?v=3&s=117" width="117">](https://github.com/panicbit) |[<img alt="pixelistik" src="https://avatars2.githubusercontent.com/u/170929?v=3&s=117" width="117">](https://github.com/pixelistik) |
:---: |:---: |:---: |:---: |:---: |:---: |
[nvzqz](https://github.com/nvzqz) |[ogham](https://github.com/ogham) |[panicbit](https://github.com/panicbit) |[pixelistik](https://github.com/pixelistik) |[rnelson](https://github.com/rnelson) |[rtaycher](https://github.com/rtaycher) |
[nicompte](https://github.com/nicompte) |[nox](https://github.com/nox) |[nvzqz](https://github.com/nvzqz) |[ogham](https://github.com/ogham) |[panicbit](https://github.com/panicbit) |[pixelistik](https://github.com/pixelistik) |
[<img alt="Seeker14491" src="https://avatars.githubusercontent.com/u/6490497?v=3&s=117" width="117">](https://github.com/Seeker14491) |[<img alt="shepmaster" src="https://avatars.githubusercontent.com/u/174509?v=3&s=117" width="117">](https://github.com/shepmaster) |[<img alt="SirVer" src="https://avatars.githubusercontent.com/u/140115?v=3&s=117" width="117">](https://github.com/SirVer) |[<img alt="sru" src="https://avatars.githubusercontent.com/u/2485892?v=3&s=117" width="117">](https://github.com/sru) |[<img alt="SShrike" src="https://avatars.githubusercontent.com/u/4061736?v=3&s=117" width="117">](https://github.com/SShrike) |[<img alt="starkat99" src="https://avatars.githubusercontent.com/u/8295111?v=3&s=117" width="117">](https://github.com/starkat99) |
[<img alt="pkgw" src="https://avatars3.githubusercontent.com/u/59598?v=3&s=117" width="117">](https://github.com/pkgw) |[<img alt="porglezomp" src="https://avatars2.githubusercontent.com/u/1690225?v=3&s=117" width="117">](https://github.com/porglezomp) |[<img alt="rnelson" src="https://avatars0.githubusercontent.com/u/118361?v=3&s=117" width="117">](https://github.com/rnelson) |[<img alt="rtaycher" src="https://avatars3.githubusercontent.com/u/324733?v=3&s=117" width="117">](https://github.com/rtaycher) |[<img alt="Seeker14491" src="https://avatars1.githubusercontent.com/u/6490497?v=3&s=117" width="117">](https://github.com/Seeker14491) |[<img alt="shepmaster" src="https://avatars3.githubusercontent.com/u/174509?v=3&s=117" width="117">](https://github.com/shepmaster) |
:---: |:---: |:---: |:---: |:---: |:---: |
[Seeker14491](https://github.com/Seeker14491) |[shepmaster](https://github.com/shepmaster) |[SirVer](https://github.com/SirVer) |[sru](https://github.com/sru) |[SShrike](https://github.com/SShrike) |[starkat99](https://github.com/starkat99) |
[pkgw](https://github.com/pkgw) |[porglezomp](https://github.com/porglezomp) |[rnelson](https://github.com/rnelson) |[rtaycher](https://github.com/rtaycher) |[Seeker14491](https://github.com/Seeker14491) |[shepmaster](https://github.com/shepmaster) |
[<img alt="SuperFluffy" src="https://avatars.githubusercontent.com/u/701177?v=3&s=117" width="117">](https://github.com/SuperFluffy) |[<img alt="swatteau" src="https://avatars.githubusercontent.com/u/5521255?v=3&s=117" width="117">](https://github.com/swatteau) |[<img alt="tanakh" src="https://avatars.githubusercontent.com/u/109069?v=3&s=117" width="117">](https://github.com/tanakh) |[<img alt="th4t" src="https://avatars.githubusercontent.com/u/2801030?v=3&s=117" width="117">](https://github.com/th4t) |[<img alt="tormol" src="https://avatars.githubusercontent.com/u/10460821?v=3&s=117" width="117">](https://github.com/tormol) |[<img alt="tshepang" src="https://avatars.githubusercontent.com/u/588486?v=3&s=117" width="117">](https://github.com/tshepang) |
[<img alt="SirVer" src="https://avatars3.githubusercontent.com/u/140115?v=3&s=117" width="117">](https://github.com/SirVer) |[<img alt="sru" src="https://avatars0.githubusercontent.com/u/2485892?v=3&s=117" width="117">](https://github.com/sru) |[<img alt="SShrike" src="https://avatars2.githubusercontent.com/u/4061736?v=3&s=117" width="117">](https://github.com/SShrike) |[<img alt="starkat99" src="https://avatars2.githubusercontent.com/u/8295111?v=3&s=117" width="117">](https://github.com/starkat99) |[<img alt="SuperFluffy" src="https://avatars3.githubusercontent.com/u/701177?v=3&s=117" width="117">](https://github.com/SuperFluffy) |[<img alt="swatteau" src="https://avatars0.githubusercontent.com/u/5521255?v=3&s=117" width="117">](https://github.com/swatteau) |
:---: |:---: |:---: |:---: |:---: |:---: |
[SuperFluffy](https://github.com/SuperFluffy) |[swatteau](https://github.com/swatteau) |[tanakh](https://github.com/tanakh) |[th4t](https://github.com/th4t) |[tormol](https://github.com/tormol) |[tshepang](https://github.com/tshepang) |
[SirVer](https://github.com/SirVer) |[sru](https://github.com/sru) |[SShrike](https://github.com/SShrike) |[starkat99](https://github.com/starkat99) |[SuperFluffy](https://github.com/SuperFluffy) |[swatteau](https://github.com/swatteau) |
[<img alt="tspiteri" src="https://avatars.githubusercontent.com/u/18604588?v=3&s=117" width="117">](https://github.com/tspiteri) |[<img alt="untitaker" src="https://avatars.githubusercontent.com/u/837573?v=3&s=117" width="117">](https://github.com/untitaker) |[<img alt="Vinatorul" src="https://avatars.githubusercontent.com/u/6770624?v=3&s=117" width="117">](https://github.com/Vinatorul) |[<img alt="vks" src="https://avatars.githubusercontent.com/u/33460?v=3&s=117" width="117">](https://github.com/vks) |[<img alt="volks73" src="https://avatars.githubusercontent.com/u/1915469?v=3&s=117" width="117">](https://github.com/volks73) |[<img alt="wdv4758h" src="https://avatars.githubusercontent.com/u/2716047?v=3&s=117" width="117">](https://github.com/wdv4758h) |
[<img alt="tanakh" src="https://avatars1.githubusercontent.com/u/109069?v=3&s=117" width="117">](https://github.com/tanakh) |[<img alt="th4t" src="https://avatars1.githubusercontent.com/u/2801030?v=3&s=117" width="117">](https://github.com/th4t) |[<img alt="tormol" src="https://avatars0.githubusercontent.com/u/10460821?v=3&s=117" width="117">](https://github.com/tormol) |[<img alt="tshepang" src="https://avatars3.githubusercontent.com/u/588486?v=3&s=117" width="117">](https://github.com/tshepang) |[<img alt="tspiteri" src="https://avatars3.githubusercontent.com/u/18604588?v=3&s=117" width="117">](https://github.com/tspiteri) |[<img alt="untitaker" src="https://avatars3.githubusercontent.com/u/837573?v=3&s=117" width="117">](https://github.com/untitaker) |
:---: |:---: |:---: |:---: |:---: |:---: |
[tspiteri](https://github.com/tspiteri) |[untitaker](https://github.com/untitaker) |[Vinatorul](https://github.com/Vinatorul) |[vks](https://github.com/vks) |[volks73](https://github.com/volks73) |[wdv4758h](https://github.com/wdv4758h) |
[tanakh](https://github.com/tanakh) |[th4t](https://github.com/th4t) |[tormol](https://github.com/tormol) |[tshepang](https://github.com/tshepang) |[tspiteri](https://github.com/tspiteri) |[untitaker](https://github.com/untitaker) |
[<img alt="Vinatorul" src="https://avatars2.githubusercontent.com/u/6770624?v=3&s=117" width="117">](https://github.com/Vinatorul) |[<img alt="vks" src="https://avatars1.githubusercontent.com/u/33460?v=3&s=117" width="117">](https://github.com/vks) |[<img alt="volks73" src="https://avatars2.githubusercontent.com/u/1915469?v=3&s=117" width="117">](https://github.com/volks73) |[<img alt="wdv4758h" src="https://avatars2.githubusercontent.com/u/2716047?v=3&s=117" width="117">](https://github.com/wdv4758h) |
:---: |:---: |:---: |:---: |
[Vinatorul](https://github.com/Vinatorul) |[vks](https://github.com/vks) |[volks73](https://github.com/volks73) |[wdv4758h](https://github.com/wdv4758h) |

View file

@ -1,7 +1,7 @@
[package]
name = "clap"
version = "2.21.0"
version = "2.21.1"
authors = ["Kevin K. <kbknapp@gmail.com>"]
exclude = ["examples/*", "clap-test/*", "tests/*", "benches/*", "*.png", "clap-perf/*", "*.dot"]
repository = "https://github.com/kbknapp/clap-rs.git"

View file

@ -45,6 +45,11 @@ Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
## What's New
Here's the highlights for v2.21.1
* fixes the precedence of this error to prioritize over other error messages
* fixes some regression bugs resulting from old asserts in debug mode.
Here's the highlights for v2.21.0
* adds the ability to mark a positional argument as 'last' which means it should be used with `--` syntax and can be accessed early to effectivly skip other positional args

View file

@ -455,31 +455,30 @@ impl<'a, 'b> Parser<'a, 'b>
// Or the second to last has a terminator or .last(true) set
let ok = last.is_set(ArgSettings::Required) ||
(second_to_last.v.terminator.is_some() ||
second_to_last.b.is_set(ArgSettings::Last));
second_to_last.b.is_set(ArgSettings::Last)) ||
last.is_set(ArgSettings::Last);
assert!(ok,
"When using a positional argument with .multiple(true) that is *not the \
last* positional argument, the last positional argument (i.e the one \
with the highest index) *must* have .required(true) or .last(true) set.");
let num = self.positionals.len() - 1;
let ok = self.positionals
.get(num)
.unwrap()
.is_set(ArgSettings::Multiple);
let ok = second_to_last.is_set(ArgSettings::Multiple) || last.is_set(ArgSettings::Last);
assert!(ok,
"Only the last positional argument, or second to last positional \
argument may be set to .multiple(true)");
self.settings.set(AS::LowIndexMultiplePositional);
let count = self.positionals
.values()
.filter(|p| p.b.settings.is_set(ArgSettings::Multiple) && p.v.num_vals.is_none())
.count();
let ok = count <= 1 ||
(last.is_set(ArgSettings::Last) && last.is_set(ArgSettings::Multiple) &&
second_to_last.is_set(ArgSettings::Multiple) &&
count == 2);
assert!(ok,
"Only one positional argument with .multiple(true) set is allowed per \
command, unless the second one also has .last(true) set");
}
let ok = self.positionals
.values()
.filter(|p| p.b.settings.is_set(ArgSettings::Multiple) && p.v.num_vals.is_none())
.map(|_| 1)
.sum::<u64>() <= 1;
assert!(ok,
"Only one positional argument with .multiple(true) set is allowed per \
command");
if self.is_set(AS::AllowMissingPositional) {
// Check that if a required positional argument is found, all positions with a lower
@ -677,7 +676,6 @@ impl<'a, 'b> Parser<'a, 'b>
// allow wrong self convention due to self.valid_neg_num = true and it's a private method
#[cfg_attr(feature = "lints", allow(wrong_self_convention))]
#[inline]
fn is_new_arg(&mut self, arg_os: &OsStr, needs_val_of: Option<&'a str>) -> bool {
debugln!("Parser::is_new_arg: arg={:?}, Needs Val of={:?}",
arg_os,
@ -743,6 +741,13 @@ impl<'a, 'b> Parser<'a, 'b>
debugln!("Parser::get_matches_with;");
// Verify all positional assertions pass
debug_assert!(self.verify_positionals());
if self.positionals.values().any(|a| {
a.b.is_set(ArgSettings::Multiple) &&
(a.index as usize != self.positionals.len())
}) &&
self.positionals.values().last().map_or(false, |p| !p.is_set(ArgSettings::Last)) {
self.settings.set(AS::LowIndexMultiplePositional);
}
let has_args = self.has_args();
// Next we create the `--help` and `--version` arguments and add them if
@ -761,6 +766,11 @@ impl<'a, 'b> Parser<'a, 'b>
self.unset(AS::ValidNegNumFound);
// Is this a new argument, or values from a previous option?
let starts_new_arg = self.is_new_arg(&arg_os, needs_val_of);
if arg_os.starts_with(b"--") && arg_os.len_() == 2 {
debugln!("Parser::get_matches_with: setting TrailingVals=true");
self.set(AS::TrailingValues);
continue;
}
// Has the user already passed '--'? Meaning only positional args follow
if !self.is_set(AS::TrailingValues) {
@ -792,15 +802,6 @@ impl<'a, 'b> Parser<'a, 'b>
}
} else {
if arg_os.starts_with(b"--") {
if arg_os.len_() == 2 {
// The user has passed '--' which means only positional args follow no
// matter what they start with
debugln!("Parser::get_matches_with: found '--'");
debugln!("Parser::get_matches_with: setting TrailingVals=true");
self.set(AS::TrailingValues);
continue;
}
needs_val_of = try!(self.parse_long_arg(matcher, &arg_os));
if !(needs_val_of.is_none() && self.is_set(AS::AllowLeadingHyphen)) {
continue;

View file

@ -49,13 +49,6 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> {
}
}
try!(self.validate_blacklist(matcher));
if !(self.0.is_set(AS::SubcommandsNegateReqs) && subcmd_name.is_some()) && !reqs_validated {
try!(self.validate_required(matcher));
}
try!(self.validate_matched_args(matcher));
matcher.usage(usage::create_usage_with_title(self.0, &[]));
if matcher.is_empty() && matcher.subcommand_name().is_none() &&
self.0.is_set(AS::ArgRequiredElseHelp) {
let mut out = vec![];
@ -66,6 +59,13 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> {
info: None,
});
}
try!(self.validate_blacklist(matcher));
if !(self.0.is_set(AS::SubcommandsNegateReqs) && subcmd_name.is_some()) && !reqs_validated {
try!(self.validate_required(matcher));
}
try!(self.validate_matched_args(matcher));
matcher.usage(usage::create_usage_with_title(self.0, &[]));
Ok(())
}

View file

@ -110,6 +110,18 @@ fn arg_required_else_help() {
assert_eq!(err.kind, ErrorKind::MissingArgumentOrSubcommand);
}
#[test]
fn arg_required_else_help_over_reqs() {
let result = App::new("arg_required")
.setting(AppSettings::ArgRequiredElseHelp)
.arg(Arg::with_name("test")
.index(1).required(true))
.get_matches_from_safe(vec![""]);
assert!(result.is_err());
let err = result.err().unwrap();
assert_eq!(err.kind, ErrorKind::MissingArgumentOrSubcommand);
}
#[cfg(not(feature = "suggestions"))]
#[test]
fn infer_subcommands_fail_no_args() {

View file

@ -234,3 +234,13 @@ fn last_positional_no_double_dash() {
assert!(r.is_err());
assert_eq!(r.unwrap_err().kind, ErrorKind::UnknownArgument);
}
#[test]
fn last_positional_second_to_last_mult() {
let r = App::new("test")
.arg_from_usage("<TARGET> 'some target'")
.arg_from_usage("[CORPUS]... 'some corpus'")
.arg(Arg::from_usage("[ARGS]... 'some file'").last(true))
.get_matches_from_safe(vec!["test", "tgt", "crp1", "crp2", "--", "arg"]);
assert!(r.is_ok(), "{:?}", r.unwrap_err().kind);
}