Skip to content

Commit

Permalink
Merge #2904
Browse files Browse the repository at this point in the history
2904: Prepare release 3.0.0-beta.5 r=pksunkara a=pksunkara



Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
  • Loading branch information
bors[bot] and pksunkara committed Oct 17, 2021
2 parents d3b3395 + 585e995 commit 33d86ef
Show file tree
Hide file tree
Showing 14 changed files with 104 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
if: matrix.features == 'none'
with:
command: test
args: --target ${{ matrix.target }} --no-default-features --features "std cargo" -p clap:3.0.0-beta.4
args: --target ${{ matrix.target }} --no-default-features --features "std cargo" -p clap:3.0.0-beta.5
- name: Test all features
uses: actions-rs/cargo@v1
if: matrix.features == 'all'
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
if: matrix.features == 'none'
with:
command: test
args: --no-default-features --features "std cargo" -p clap:3.0.0-beta.4
args: --no-default-features --features "std cargo" -p clap:3.0.0-beta.5
- name: Test all features
uses: actions-rs/cargo@v1
if: matrix.features == 'all'
Expand Down
86 changes: 74 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,84 @@ TODO: `YamlLoader`
<a name="v3.0.0-rc.0"></a>
## v3.0.0-rc.0


<a name="v3.0.0-beta.5"></a>
## v3.0.0-beta.5 (2021-10-18)

#### BREAKING CHANGES

* **Renamed Features**
* `unicode_help` to `unicode` to encompass more functionality
* **Gated Features**
* **Gated behind features**
* `App::replace` is now gated behind `unstable-replace`

* **Removed `derive` requirement**
* `clap::ArgEnum`
* `clap::Args`
* `clap::FromArgMatches`
* `clap::IntoApp`
* `clap::Subcommand`
* **Renamed Traits**
* `clap::Clap` => `clap::Parser`
* **Renamed Methods**
* `App::generate_usage` => `App::render_usage`
* **Removed Settings**
* `AppSettings::DisableVersionForSubcommands`
* `AppSettings::ColoredHelp`: we are now relying solely on the `color` feature flag and `AppSettings::Color(Auto|Always|Never)`
* `AppSettings::DisableVersionForSubcommands` is now default behaviour
* `AppSettings::ColoredHelp`: we are now relying solely on the `color` feature flag and `App::color` method
* `AppSettings::StrictUtf8` is now default behaviour
* `AppSettings::AllowInvalidUtf8` in favor of `ArgSettings::AllowInvalidUtf8`
* `AppSettings::UnifiedHelpMessage` is now default behaviour
* `AppSettings::ColorAlways` in favor of `App::color`
* `AppSettings::ColorNever` in favor of `App::color`
* `AppSettings::ColorAuto` in favor of `App::color`
* **Removed methods**
* **App**
* `App::get_flags`
* `App::get_positionals_with_no_heading`
* `App::get_flags_with_no_heading`
* `App::get_opts_with_no_heading`
* `App::stop_custom_headings` in favor of `App:help_heading(None)`
* **Error**
* `Error::with_description` in favor of `App::error`
* **ArgEnum**
* `ArgEnum::as_arg` in favor of `ArgEnum::to_arg_value`
* **clap_generate::Generator**
* `Generator::all_subcommands`
* `Generator::find_subcommand_with_path`
* `Generator::subcommands`
* `Generator::shorts_and_visible_aliases`
* `Generator::longs_and_visible_aliases`
* `Generator::flags`
* **Removed**
* `ArgEnum::VARIANTS` in favor of `ArgEnum::value_variants`
* **Deprecated**
* `clap::clap_app!` in favor of other builders
* **Changed**
* `App::get_possible_values` returns `Option<&[ArgValue]>` now
* `RegexRef` is now an enum also allowing `RegexSet` to be used
* `clap_generate::Generator::file_name` and `clap_generate::Generator::generate` now take `&self`
* `clap_generate::generate` and `clap_generate::generate_to` now takes `Generator` as first argument

#### Features

* **Added**
* `clap::ArgValue` to denote information about possible values for args
* `clap::ColorChoice` to specify color setting for the app
* **Added Settings**
* `AppSettings::AllowInvalidUtf8ForExternalSubcommands`
* `AppSettings::Multicall` behind `unstable-multicall` feature
* `ArgSettings::AllowInvalidUtf8`
* **Added Methods**
* **ArgEnum**
* `ArgEnum::value_variants`
* `ArgEnum::to_arg_value`
* **App**
* `App::color`
* `App::error`
* `App::get_long_about`
* `App::get_help_heading`
* **Arg**
* `Arg::is_positional`
* Allow positionals to occur multiple times

<a name="v3.0.0-beta.4"></a>
## v3.0.0-beta.4 (2021-08-14)
Expand All @@ -34,25 +102,18 @@ Added `unicode_help`, `env` features.
* `Arg::hide_env_values`
* **ArgSettings**
* `ArgSettings::HideEnvValues`

* **Removed Methods**
* **Arg**
* `Arg::settings` in favor of `Arg::setting(Setting1 | Setting2)`
* `Arg::multiple` in favour of `Arg::multiple_values` and `Arg::multiple_occurrences`
* **Renamed Settings**
* `AppSettings::DisableHelpFlags` => `AppSettings::DisableHelpFlag`
* `AppSettings::DisableVersion` => `AppSettings::DisableVersionFlag`
* `AppSettings::VersionlessSubcommands` => `AppSettings::DisableVersionForSubcommands`
* `AppSettings::VersionlessSubcommands` => `AppSettings::DisableVersionForSubcommands` (changed again 3.0.0-beta.5)
* **Renamed Variants**
* **ErrorKind**
* `ErrorKind::MissingArgumentOrSubcommand` => `ErrorKind::DisplayHelpOnMissingArgumentOrSubcommand`
* **Changed**
* `AppSettings::StrictUtf8` is now default and it and `AppSettings::AllowInvalidUtf8` are replaced by
* `AppSettings::AllowInvalidUtf8ForExternalSubcommands`
* This only applies to the subcommand args. Before we paniced if the
subcommand itself was invalid but now we will report an error up to the
user.
* `ArgSettings::AllowInvalidUtf8`
* Allowing empty values is the default again with `ArgSettings::AllowEmptyValues` changing to
`ArgSettings::ForbidEmptyValues`
* `AppSettings::GlobalVersion` renamed to `AppSettings::PropagateVersion` and it is not applied
Expand All @@ -78,6 +139,7 @@ Added `unicode_help`, `env` features.

* **Added**
* `clap_generate::Shell`
* `clap::Args` behind `derive` feature
* **Added Methods**
* **App**
* `App::license`
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clap"
version = "3.0.0-beta.4"
version = "3.0.0-beta.5"
edition = "2018"
authors = [
"Kevin K. <kbknapp@gmail.com>",
Expand Down Expand Up @@ -60,7 +60,7 @@ name = "06_rustup"
path = "benches/06_rustup.rs"

[dependencies]
clap_derive = { path = "./clap_derive", version = "=3.0.0-beta.4", optional = true }
clap_derive = { path = "./clap_derive", version = "=3.0.0-beta.5", optional = true }
bitflags = "1.2"
textwrap = { version = "0.14.0", default-features = false, features = [] }
unicase = { version = "2.6", optional = true }
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ It is a simple-to-use, efficient, and full-featured library for parsing command
* [Questions & Discussions](https://github.com/clap-rs/clap/discussions)
* [Website](https://clap.rs/)

We are currently hard at work trying to release `3.0`. We have a `3.0.0-beta.4` prerelease out but we do not give any guarantees that its API is stable. We do not have a changelog yet which will be written down after we are sure about the API stability. We recommend users to not update to the prerelease version yet and to wait for the official `3.0`.
We are currently hard at work trying to release `3.0`. We have a `3.0.0-beta.5` prerelease out but we do not give any guarantees that its API is stable. We do not have a changelog yet which will be written down after we are sure about the API stability. We recommend users to not update to the prerelease version yet and to wait for the official `3.0`.

> If you're looking for the readme & examples for `clap v2.33` - find it on [github](https://github.com/clap-rs/clap/tree/v2.33.0), [crates.io](https://crates.io/crates/clap/2.33.0), [docs.rs](https://docs.rs/clap/2.33.0/clap/).
Expand All @@ -28,8 +28,7 @@ We are currently hard at work trying to release `3.0`. We have a `3.0.0-beta.4`
1. [Using Derive Macros](#using-derive-macros)
2. [Using Builder Pattern](#using-builder-pattern)
3. [Using YAML](#using-yaml)
4. [Using Macros](#using-macros)
5. [Running it](#running-it)
4. [Running it](#running-it)
5. [Try it!](#try-it)
1. [Pre-Built Test](#pre-built-test)
2. [Build Your Own Binary](#build-your-own-binary)
Expand Down Expand Up @@ -126,7 +125,7 @@ Add `clap` to your `Cargo.toml`

```toml
[dependencies]
clap = "3.0.0-beta.4"
clap = "3.0.0-beta.5"
```

#### Using Derive Macros
Expand Down Expand Up @@ -350,7 +349,7 @@ Simply add the `yaml` feature flag to your `Cargo.toml`.

```toml
[dependencies]
clap = { version = "3.0.0-beta.4", features = ["yaml"] }
clap = { version = "3.0.0-beta.5", features = ["yaml"] }
```

Finally we create our `main.rs` file just like we would have with the previous two examples:
Expand Down Expand Up @@ -426,7 +425,7 @@ For full usage, add `clap` as a dependency in your `Cargo.toml` to use from crat

```toml
[dependencies]
clap = "3.0.0-beta.4"
clap = "3.0.0-beta.5"
```

Define a list of valid arguments for your program (see the [documentation][docs] or [examples][examples] directory of this repo)
Expand All @@ -451,7 +450,7 @@ To disable these, add this to your `Cargo.toml`:

```toml
[dependencies.clap]
version = "3.0.0-beta.4"
version = "3.0.0-beta.5"
default-features = false
features = ["std"]
```
Expand All @@ -460,7 +459,7 @@ You can also selectively enable only the features you'd like to include, by addi

```toml
[dependencies.clap]
version = "3.0.0-beta.4"
version = "3.0.0-beta.5"
default-features = false

# Cherry-pick the features you'd like to use
Expand Down Expand Up @@ -522,7 +521,7 @@ In order to keep from being surprised of breaking changes, it is **highly** reco

```toml
[dependencies]
clap = "~3.0.0-beta.4"
clap = "~3.0.0-beta.5"
```

This will cause *only* the patch version to be updated upon a `cargo update` call, and therefore cannot break due to new features, or bumped minimum versions of Rust.
Expand Down
2 changes: 1 addition & 1 deletion clap_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clap_derive"
version = "3.0.0-beta.4"
version = "3.0.0-beta.5"
edition = "2018"
authors = [
"Guillaume Pinot <texitoi@texitoi.eu>",
Expand Down
2 changes: 1 addition & 1 deletion clap_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// MIT/Apache 2.0 license.

#![doc(html_logo_url = "https://clap.rs/images/media/clap.png")]
#![doc(html_root_url = "https://docs.rs/clap_derive/3.0.0-beta.4")]
#![doc(html_root_url = "https://docs.rs/clap_derive/3.0.0-beta.5")]

//! This crate is custom derive for clap. It should not be used
//! directly. See [clap documentation](http://docs.rs/clap)
Expand Down
4 changes: 2 additions & 2 deletions clap_generate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clap_generate"
version = "3.0.0-beta.4"
version = "3.0.0-beta.5"
edition = "2018"
authors = [
"Kevin K. <kbknapp@gmail.com>",
Expand Down Expand Up @@ -30,7 +30,7 @@ readme = "README.md"
bench = false

[dependencies]
clap = { path = "../", version = "=3.0.0-beta.4", default-features = false, features = ["std"] }
clap = { path = "../", version = "=3.0.0-beta.5", default-features = false, features = ["std"] }

[dev-dependencies]
pretty_assertions = "0.7"
Expand Down
2 changes: 1 addition & 1 deletion clap_generate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// for more information.

#![doc(html_logo_url = "https://clap.rs/images/media/clap.png")]
#![doc(html_root_url = "https://docs.rs/clap_generate/3.0.0-beta.4")]
#![doc(html_root_url = "https://docs.rs/clap_generate/3.0.0-beta.5")]
#![doc = include_str!("../README.md")]
#![deny(missing_docs, trivial_casts, unused_allocation, trivial_numeric_casts)]
#![forbid(unsafe_code)]
Expand Down
6 changes: 3 additions & 3 deletions clap_generate_fig/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clap_generate_fig"
version = "3.0.0-beta.4"
version = "3.0.0-beta.5"
edition = "2018"
authors = [
"Clap Maintainers"
Expand Down Expand Up @@ -30,8 +30,8 @@ readme = "README.md"
bench = false

[dependencies]
clap = { path = "../", version = "=3.0.0-beta.4" }
clap_generate = { path = "../clap_generate", version = "3.0.0-beta.4" }
clap = { path = "../", version = "=3.0.0-beta.5" }
clap_generate = { path = "../clap_generate", version = "=3.0.0-beta.5" }

[dev-dependencies]
pretty_assertions = "0.7"
Expand Down
2 changes: 1 addition & 1 deletion clap_generate_fig/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! Generates [Fig](https://github.com/withfig/autocomplete) completions for [`clap`](https://github.com/clap-rs/clap) based CLIs

#![doc(html_logo_url = "https://clap.rs/images/media/clap.png")]
#![doc(html_root_url = "https://docs.rs/clap_generate_fig/3.0.0-beta.4")]
#![doc(html_root_url = "https://docs.rs/clap_generate_fig/3.0.0-beta.5")]
#![deny(missing_docs, trivial_casts, unused_allocation, trivial_numeric_casts)]
#![forbid(unsafe_code)]
#![allow(clippy::needless_doctest_main)]
Expand Down
1 change: 1 addition & 0 deletions clap_up/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pub fn runner() -> Runner {
["version_short", "mut_arg"],
["help_message", "mut_arg"],
["help_short", "mut_arg"],
["generate_usage", "render_usage"],
],
)
.rename_methods(
Expand Down
6 changes: 6 additions & 0 deletions src/build/arg/arg_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ impl<'help> From<&'help str> for ArgValue<'help> {
}
}

impl<'help> From<&'help &'help str> for ArgValue<'help> {
fn from(s: &'help &'help str) -> Self {
Self::new(s)
}
}

/// Getters
impl<'help> ArgValue<'help> {
/// Get the name of the argument value
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// notice may not be copied, modified, or distributed except according to those terms.

#![doc(html_logo_url = "https://clap.rs/images/media/clap.png")]
#![doc(html_root_url = "https://docs.rs/clap/3.0.0-beta.4")]
#![doc(html_root_url = "https://docs.rs/clap/3.0.0-beta.5")]
#![doc = include_str!("../README.md")]
//! <https://github.com/clap-rs/clap>
#![crate_type = "lib"]
Expand Down
2 changes: 1 addition & 1 deletion tests/require.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ fn required_if_val_present_fail_error_output() {
Arg::new("target")
.takes_value(true)
.required(true)
.possible_values(["file", "stdout"])
.possible_values(&["file", "stdout"])
.long("target"),
)
.arg(
Expand Down

0 comments on commit 33d86ef

Please sign in to comment.