Commit graph

2783 commits

Author SHA1 Message Date
Toothless204
8b2a9928e8 added check for - 2020-02-02 11:48:35 +00:00
bors[bot]
6422930a18
Merge #1656
1656: Added tests for cargo macros, fixes #1478 r=pksunkara a=pksunkara

When you approve this PR, instead of merging it, please comment "bors r+". I want to test the bors workflow.

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-02-02 09:44:59 +00:00
Pavan Kumar Sunkara
3fa39a55d2 Update changelog to reflect the correct minimum version 2020-02-02 09:31:09 +01:00
Pavan Kumar Sunkara
506f5e4965 Added tests for cargo macros, fixes #1478 2020-02-02 08:50:40 +01:00
Pavan Kumar Sunkara
a81618ab86 Update bors.toml 2020-02-02 08:30:14 +01:00
Pavan Kumar Sunkara
25a16ea762
Merge pull request #1654 from clap-rs/bors
Bors
2020-02-02 07:00:29 +01:00
Dylan DPC
922a531fa6
Update lib.rs 2020-02-02 02:02:10 +01:00
Dylan DPC
6aaeb2718b
Update Cargo.toml 2020-02-02 01:28:19 +01:00
Pavan Kumar Sunkara
9453f74335 Added bors config 2020-02-01 21:50:29 +01:00
Pavan Kumar Sunkara
bd5b5adfb5 Cache stuff on appveyor 2020-02-01 21:24:44 +01:00
Pavan Kumar Sunkara
2c323503aa
Merge pull request #1651 from clap-rs/bump-yaml
Update yaml-rust to 0.4.1
2020-02-01 19:18:23 +01:00
nazarov A. V
dc4d2faf76 Update yaml-rust to 0.4.3 2020-02-01 14:45:52 +03:00
Pavan Kumar Sunkara
4740b1e05b
Merge pull request #1648 from clap-rs/maintain
Some maintainance stuff
2020-02-01 12:23:50 +01:00
Pavan Kumar Sunkara
8199e96268 chore: Update coverage job 2020-02-01 06:55:47 +01:00
Pavan Kumar Sunkara
2a6005657e Apply suggestions from code review
Co-Authored-By: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-02-01 06:55:47 +01:00
Pavan Kumar Sunkara
53eb192c3f fix: CI configs 2020-02-01 06:48:50 +01:00
Pavan Kumar Sunkara
dd75cee72c fix: Clippy should pass 2020-02-01 06:48:50 +01:00
Daniel Eades
d23df44e84 refactor: remove deprecated 'Error::description' method 2020-01-31 18:37:56 +01:00
Pavan Kumar Sunkara
8e4a189ab0 fmt: Use standardized rustfmt rules 2020-01-31 18:37:56 +01:00
Pavan Kumar Sunkara
cfb60f7547 chore: Remove mention bot since it's not working' 2020-01-31 18:37:56 +01:00
Pavan Kumar Sunkara
c799e8d0ca chore: Updated contributing instructions and justfile 2020-01-31 18:37:56 +01:00
Pavan Kumar Sunkara
b3aa4540cb chore: Refactored appveyor config 2020-01-31 12:11:25 +01:00
Pavan Kumar Sunkara
9422677030 chore: Refactored travis config 2020-01-31 12:11:25 +01:00
CreepySkeleton
752262ee9a
Bump rustversion to stable release v1 #1647 2020-01-31 11:46:29 +03:00
lzutao
dbc7988d23
Bump rustversion to stable release v1 2020-01-31 14:58:00 +07:00
CreepySkeleton
8be0a94951
Merge pull request #1638 from pksunkara/derive
Subtree merge clap_derive into this repo
2020-01-31 02:28:58 +03:00
Pavan Kumar Sunkara
e1ae505c23
Merge pull request #1637 from danielthegray/use-USAGE-error-exit-code
imp: Add exitcode::USAGE exit code as suggested in #1327
2020-01-30 20:30:36 +01:00
Pavan Kumar Sunkara
afa9ec5e32 Address review comments
Co-Authored-By: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-01-19 06:08:22 +05:30
Pavan Kumar Sunkara
7e0d820aa6 Run clap_derive tests in CI 2020-01-18 19:04:11 +05:30
Pavan Kumar Sunkara
5e8f424dfe Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30
Daniel Gray
a1445b0f3b imp: Add exitcode::USAGE exit code as suggested in #1327
The reason to do this is described well in issue #1327. It is also a
recommendation of the Rust book itself:
https://rust-cli.github.io/book/in-depth/exit-code.html
2020-01-17 11:20:45 -04:00
Luca Bruno
f3683a9792 output: get rid of an unsafe block (#1636)
* parse: fix build in debug mode

This fixes a build failure in debug mode, as the value to be printed
does not implement Display.

* output: get rid of an unsafe block

This get rid of an unsafe block which is not necessary, and only used
when building in debug mode.
2020-01-17 19:05:18 +05:30
danieleades
af45420027 style: format code with rustfmt (#1632)
> incidentally, how do we feel about adding a rustfmt check to the CI(s)?
yes we should be doing that. you can send another pr that adds the check to the Ci
2020-01-11 23:45:46 +05:30
Jeremy Stucki
2e1acb648c Refactor mkeymap (#1618)
* refactor(mkeymap): Use iterators

* refactor(mkeymap): Implement contains method

* refactor(mkeymap): Deprecate methods

Co-authored-by: Dylan DPC <dylan.dpc@gmail.com>
2020-01-09 23:00:22 +05:30
Pavan Kumar Sunkara
0352bb30c8 Ported all the commits from structopt (#23)
* Automatic naming of fields and subcommands (#143)

* Introduce smarter parsing of doc comments. (#146)

* Fix invalid structopt syntax error message (#154)

There was a typo preventing the probematic attr to be shown to the user.

* Fix spelling: occurences -> occurrences, (#158)

was found in comments and code, but required no user-facing API change.

* Remove line-ending periods from short help. (#161)

* Fix #168

* Support Option<Option<T>> field types (#190)

* Support Option<Vec<T>> field type (#191)

* Fix use of deprecated function

* Fix some clippy lints

* Update deprecated function and provide more info about the parsing error (#193)

* Improve ChangeLog as suggested by @ErichDonGubler (#194)

* [Casing] Change default from verbatim to kebab. (#204)

.. fixes TeXitoi/structopt#202

* Use trybuild for testing expected proc macro errors (#205)

* Custom attributes parser (#198)

* update README.md for 0.3

fix #208

* Small fixes: clippy and typos (#215)

* Add example for environment variables (#160) (#216)

* Support skipping struct fields (#213)

* Now error messages highlight the error location (#225)

* Minor fixes

* Change behavior of `about/author/version` and ad `no_version`

* Emit error about `raw` removal

* Update changelog

* Update keyvalue example (#234)

* Update documentation and changelog (#236)

* Update dependencies (#227)

* Bump minimum rustc version to 1.36

* Fix issues

* Fix structopt-derive permissions (#239)

* Fix #245 (#246)

* Emit dummy impls on error (#248)

* Fix changelog example (#250)

* Do not call .verison() when CARGO_PKG_VERSION is not set

* Update and improve docs

* Propagate span info from origin code to generated code

Most of `quote!` invocations are replaced with `quote_spanned!` ones.
Now everywhere - sometimes it's pointless, sometimes we don't have
any meaningless location to toke a span from, sometimes I just can't
workaround the current implementation - too much changes.

* Fix nightly tests

* Do not mangle `author` string inside `<...>`

* Support `skip = value` syntax

* Fix code formatting

* Fix nightly tests

* Run ui tests only on stable

* Add from_flag parser (#271)

* Clarify docs and error messages (#277)

* Fix parse for OptionVec (#279)

ref pull #191

* Fix #269 and #265 (#278)

* Pass the try_from_str functions a &str instead of a &String. (#282)

In most cases this doesn't matter, as &String is coerced to a &str, but
this fails for generic functions like CString::new.

* Add an example of a negative flag (i.e. --no-verbose)

Question from https://github.com/TeXitoi/structopt/issues/280

* Fix #283 (#284)

Fix #283

* Add `examples/README.md` and do some cleanup

* Handle special types correctly

* cargo clippy

* Handle inter-expansion top-level args properly

* Cleanup tests

* Update proc-macro-error to v0.4

* Offer helpful suggestion on `raw(...)` error

* Add `after_help` example

* Prohibit positional `bool` args

* Add tests/utils.rs

* fixed typo, removed misleading doc

* Remove CHANGELOG additions

* Rust 2018

* Addressed review

Co-authored-by: rnd <bruno.kirschner@online.de>
Co-authored-by: Robin Lambertz <github@roblab.la>
Co-authored-by: florianjacob <accounts+github@florianjacob.de>
Co-authored-by: Ted Driggs <ted.driggs@outlook.com>
Co-authored-by: Guillaume P. <TeXitoi@users.noreply.github.com>
Co-authored-by: Ivan Veselov <veselov@gmail.com>
Co-authored-by: Owen Walpole <owenthewizard@hotmail.com>
Co-authored-by: Robin Stocker <robin.stocker@gmail.com>
Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
Co-authored-by: Ophir LOJKINE <ophir.lojkine@auto-grid.com>
Co-authored-by: kpcyrd <git@rxv.cc>
Co-authored-by: Luiz F. A. de Prá <luizdepra@users.noreply.github.com>
Co-authored-by: Andy Weiss <wvvwwvw@gmail.com>
Co-authored-by: xiaoniu-578fa6bff964d005 <32661032+xiaoniu-578fa6bff964d005@users.noreply.github.com>
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
Co-authored-by: Renê Couto e Silva <31329678+csrene@users.noreply.github.com>
2020-01-07 15:47:23 +05:30
Gregor Pfeifer
8b5ecf92e4 fix: Typos in Arg::conflicts_with_everything` (#1625)
Related to https://github.com/clap-rs/clap/pull/1624
2020-01-06 00:50:15 +05:30
Gregor Pfeifer
6180d42c00 feat: Add Arg::conflicts_with_everything method #1583 (#1624)
* feat: Add `Arg::conflicts_with_everything` method #1583

* fix: Typo in  src/build/arg/mod.rs

Co-Authored-By: Dylan DPC <dylan.dpc@gmail.com>

Co-authored-by: Dylan DPC <dylan.dpc@gmail.com>
2020-01-06 00:16:28 +05:30
Eric Mink
1c3958c56e Clarify documentation usage as help text for subcommands (#1620)
* Clarify documentation usage as help text for subcommands

As outlined in https://github.com/clap-rs/clap/issues/1619 I did not understand why the `SUBCOMMANDS` section of `help` would not print a String `/// A subcommand for controlling testing` for the `Test` subcommand.

This PR updates the README to hopefully make this clearer.

The only change is adding a doc line:
```rust
#[derive(Clap)]
enum SubCommand {
    /// A help message for the Test subcommand
    Test(Test),
}
```

* Move annotation to the variant

Still regarding https://github.com/clap-rs/clap/issues/1619

I think the line that set the version of the subcommand was at the wrong place.
2020-01-04 19:54:33 +05:30
xidaxmb
f402f7a113 imp(usage_parser.rs): add default value support (#1522)
Co-authored-by: Dylan DPC <dylan.dpc@gmail.com>
2020-01-03 17:18:09 +05:30
dylan_DPC
1c79bb5b28 fix subcommand is private bug 2020-01-01 23:28:06 +05:30
Dylan DPC
2622165be3
Merge pull request #21 from deg4uss3r/derive_public_parse_fn
Adding pub to the parse functions
2019-12-27 22:55:56 +05:30
ncaq
fc359e3c46 fixed: failed of multiple_occurrences with env (#1609)
The example code.

~~~rust
use clap::{App, Arg};

fn main() {
  let matches = App::new("My Super Program")
    .arg(
      Arg::with_name("verbose")
        .help("Sets the level of verbosity")
        .short('v')
        .long("verbose")
        .takes_value(false)
        .multiple_occurrences(true)
        .env("VERBOSE"),
    )
    .get_matches();

  match matches.occurrences_of("verbose") {
    0 => println!("0 No verbose info"),
    1 => println!("1 Some verbose info"),
    2 => println!("2 Tons of verbose info"),
    3 | _ => println!("3 >= Don't be crazy"),
  }
}
~~~

It code use multiple_occurrences with env.
But it do not work.
`env` method set require take value.

It result see under.

~~~console
% cargo run -- -v
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/debug/foo -v`
error: The argument '--verbose <verbose>...' requires a value but none was supplied

USAGE:
    foo [OPTIONS]

For more information try --help
~~~

And, structopt or clap_derive may be create similar code.
So I am confused by structopt.

This to fix code small.
2019-12-22 23:03:23 +05:30
dylan_DPC
a2f9fb5f6c update bitflag to avoid cant find macro import on lower (1.0) versions 2019-11-30 02:06:52 +01:00
Matthew Fisher
bb9631eb3f fix(README): fix compiler errors for first example (#1599)
The first example doesn't compile. The Test structure is missing a `struct` statement, and the `.config` field exists as `.file`. Looking at the flag fields, `config` seems like the expected field name.

Using 

```
[dependencies]
clap = { git = "https://github.com/clap-rs/clap", features = ["wrap_help"] }
```

Signed-Off-By: Matthew Fisher <matt.fisher@microsoft.com>
2019-11-30 00:35:26 +01:00
Mara Bos
2a2969aee4 Don't write --version output directly to stdout. (#1602)
Fixes #1390.
2019-11-26 18:39:12 +01:00
Dylan DPC
335f34bee2 fix broken CI 2019-11-11 14:28:30 +01:00
Dylan DPC
dd6c8e08ad use 2018 edition and minor refactors 2019-11-11 12:54:55 +01:00
Dylan DPC
92c2b5df3f
Merge pull request #1593 from Shnatsel/one-less-unsafe
Drop unnecessary `unsafe`
2019-11-06 15:55:12 +01:00
Kevin K
750796b9ca
Merge branch 'master' into one-less-unsafe 2019-11-03 14:21:56 -05:00
Kevin K
2a50c2ef80
Merge pull request #1388 from scampi/issue-861
feat(Error): add a cause field to the Error struct
2019-11-03 14:17:38 -05:00