refactor: 'reverts' a breaking change until further discussion and approval has taken place

This commit is contained in:
Kevin K 2017-01-05 19:26:16 -05:00
parent 15b3f32e5d
commit 9d88f19181
No known key found for this signature in database
GPG key ID: 17218E4B3692F01A
3 changed files with 7 additions and 47 deletions

View file

@ -1,40 +1,4 @@
<a name="v2.20.0"></a>
## v2.20.0 (2017-01-04)
## There is a Minor Breaking Change
This update contains a minor breaking. Why is the major version not bumped? The following items:
* it's to fix a bug in the original code
* the fix for end users is trivial and not always required
* it's a niche feature that few use.
* I've checked most of the major projects that I'm aware of and none are using this method
**Details:** `App::write_help` now requires `&mut self` instead of `&self`. That's it.
This means if you use
```rust
let app = /* .. */;
app.write_help(/* .. */);
```
Change your code to:
```rust
let mut app = // all else remains the same
```
Note `mut` app.
However, if you used
```rust
let app = // no semi-colon
.write_help(/* .. */);
```
No change is required
#### New Settings
@ -68,9 +32,6 @@ No change is required
#### Bug Fixes
* **Options:** fixes a critical bug where options weren't forced to have a value ([5a5f2b1e](https://github.com/kbknapp/clap-rs/commit/5a5f2b1e9f598a0d0280ef3e98abbbba2bc41132), closes [#665](https://github.com/kbknapp/clap-rs/issues/665))
* fixes an issue where the full help message wasn't written when doing `App::write_help` ([20842ed8](https://github.com/kbknapp/clap-rs/commit/20842ed8c29facd5dd8a971046965c144daba667), closes [#801](https://github.com/kbknapp/clap-rs/issues/801))
* *BREAKING CHANGE**: This is a breaking change, but because of the following three items, it's not bumping the major version: it's due to a bug, the fix is trivial and not always required, and it's a niche feature that few use. `App::write_to` requires `&mut self` instead of `&self`.
* This means if you use `let app = /* .. */; app.write_help(/* .. */);` you need to now do `let mut app = // snip`. ALL other forms don't need to change.
* fixes a bug where calling the help of a subcommand wasn't ignoring required args of parent commands ([d3d34a2b](https://github.com/kbknapp/clap-rs/commit/d3d34a2b51ef31004055b0ab574f766d801c3adf), closes [#789](https://github.com/kbknapp/clap-rs/issues/789))
* **Help Subcommand:** fixes a bug where the help subcommand couldn't be overriden ([d34ec3e0](https://github.com/kbknapp/clap-rs/commit/d34ec3e032d03e402d8e87af9b2942fe2819b2da), closes [#787](https://github.com/kbknapp/clap-rs/issues/787))
* **Low Index Multiples:** fixes a bug which caused combinations of LowIndexMultiples and `Arg::allow_hyphen_values` to fail parsing ([26c670ca](https://github.com/kbknapp/clap-rs/commit/26c670ca16d2c80dc26d5c1ce83380ace6357318))

View file

@ -47,8 +47,6 @@ Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
Here's the highlights for v2.20.0
**NOTICE:** This release contains a technically breaking change in a *very* niche feature that few use (`App::write_help`). The fix is *very* trivial and not always required. See the full CHANGELOG.md for details.
* **ArgsNegateSubcommands:** disables args being allowed between subcommands
* **DontCollapseArgsInUsage:** disables the collapsing of positional args into `[ARGS]` in the usage string
* **DisableHelpSubcommand:** disables building the `help` subcommand
@ -64,7 +62,6 @@ Here's the highlights for v2.20.0
* **app_from_crate!:** Combines `crate_version!`, `crate_name!`, `crate_description!`, and `crate_authors!` into a single macro call to build a default `App` instance from the `Cargo.toml` fields
* **no_cargo:** adds a `no_cargo` feature to disable Cargo-env-var-dependent macros for those *not* using `cargo` to build their crates
* **Options:** fixes a critical bug where options weren't forced to have a value
* fixes an issue where the full help message wasn't written when doing `App::write_help`
* fixes a bug where calling the help of a subcommand wasn't ignoring required args of parent commands
* **Help Subcommand:** fixes a bug where the help subcommand couldn't be overriden
* **Low Index Multiples:** fixes a bug which caused combinations of LowIndexMultiples and `Arg::allow_hyphen_values` to fail parsing

View file

@ -1028,14 +1028,16 @@ impl<'a, 'b> App<'a, 'b> {
/// app.write_help(&mut out).expect("failed to write to stdout");
/// ```
/// [`io::Write`]: https://doc.rust-lang.org/std/io/trait.Write.html
pub fn write_help<W: Write>(&mut self, w: &mut W) -> ClapResult<()> {
pub fn write_help<W: Write>(&self, w: &mut W) -> ClapResult<()> {
// PENDING ISSUE: 808
// https://github.com/kbknapp/clap-rs/issues/808
// If there are global arguments, or settings we need to propgate them down to subcommands
// before parsing incase we run into a subcommand
self.p.propogate_globals();
self.p.propogate_settings();
self.p.derive_display_order();
// self.p.propogate_globals();
// self.p.propogate_settings();
// self.p.derive_display_order();
// self.p.create_help_and_version();
self.p.create_help_and_version();
Help::write_app_help(w, self)
}