Merge #2956

2956: Add DisableColoredHelp setting to improve flexibility r=pksunkara a=pksunkara



Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
diff --git a/Cargo.toml b/Cargo.toml
index 78685a5..5a1c134 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -66,7 +66,7 @@
 textwrap = { version = "0.14.0", default-features = false, features = [] }
 unicase = { version = "2.6", optional = true }
 indexmap = "1.0"
-os_str_bytes = "4.1"
+os_str_bytes = "6.0"
 strsim = { version = "0.10",  optional = true }
 yaml-rust = { version = "0.4.1",  optional = true }
 atty = { version = "0.2",  optional = true }
diff --git a/README.md b/README.md
index b244167..a90cfe2 100644
--- a/README.md
+++ b/README.md
@@ -48,11 +48,11 @@
 
 ## About
 
-`clap` is used to parse *and validate* the string of command line arguments provided by a user at runtime. You provide the list of valid possibilities, and `clap` handles the rest. This means you focus on your *applications* functionality, and less on the parsing and validating of arguments.
+`clap` is used to parse *and validate* the string of command line arguments provided by a user at runtime. You provide the list of valid possibilities, and `clap` handles the rest. This means you focus on your *application's* functionality, and less on the parsing and validating of arguments.
 
 `clap` provides many things 'for free' (with no configuration) including the traditional version and help switches (or flags) along with associated messages. If you are using subcommands, `clap` will also auto-generate a `help` subcommand and separate associated help messages.
 
-Once `clap` parses the user provided string of arguments, it returns the matches along with any applicable values. If the user made an error or typo, `clap` informs them with a friendly message and exits gracefully (or returns a `Result` type and allows you to perform any clean up prior to exit). Because of this, you can make reasonable assumptions in your code about the validity of the arguments prior to your applications main execution.
+Once `clap` parses the user-provided string of arguments, it returns the matches along with any applicable values. If the user made an error or typo, `clap` informs them with a friendly message and exits gracefully (or returns a `Result` type and allows you to perform any clean up prior to exit). Because of this, you can make reasonable assumptions in your code about the validity of the arguments prior to your applications main execution.
 
 ## FAQ
 
@@ -66,10 +66,10 @@
 
 * Generate a CLI simply by defining a struct!
 * **Auto-generated Help, Version, and Usage information**
-  - Can optionally be fully, or partially overridden if you want a custom help, version, or usage statements
+  - Can optionally be fully, or partially overridden if you want custom help, version, or usage statements
 * **Auto-generated completion scripts (Bash, Zsh, Fish, Fig, Elvish and PowerShell)**
   - Using [`clap_generate`](https://github.com/clap-rs/clap/tree/master/clap_generate)
-  - Even works through many multiple levels of subcommands
+  - Even works through multiple levels of subcommands
   - Works with options which only accept certain values
   - Works with subcommand aliases
 * **Flags / Switches** (i.e. bool fields)
@@ -80,7 +80,7 @@
   - Supports multiple values (i.e. `myprog <file>...` such as `myprog file1.txt file2.txt` being two values for the same "file" argument)
   - Supports Specific Value Sets (See below)
   - Can set value parameters (such as the minimum number of values, the maximum number of values, or the exact number of values)
-  - Can set custom validations on values to extend the argument parsing capability to truly custom domains
+  - Can set custom validations on values to extend the argument-parsing capability to truly custom domains
 * **Option Arguments** (i.e. those that take values)
   - Both short and long versions supported (i.e. `-o value`, `-ovalue`, `-o=value` and `--option value` or `--option=value` respectively)
   - Supports multiple values (i.e. `-o <val1> -o <val2>` or `-o <val1> <val2>`)
@@ -88,7 +88,7 @@
   - Supports Specific Value Sets (See below)
   - Supports named values so that the usage/help info appears as `-o <FILE> <INTERFACE>` etc. for when you require specific multiple values
   - Can set value parameters (such as the minimum number of values, the maximum number of values, or the exact number of values)
-  - Can set custom validations on values to extend the argument parsing capability to truly custom domains
+  - Can set custom validations on values to extend the argument-parsing capability to truly custom domains
 * **Sub-Commands** (i.e. `git add <file>` where `add` is a sub-command of `git`)
   - Support their own sub-arguments, and sub-sub-commands independent of the parent
   - Get their own auto-generated Help, Version, and Usage independent of parent
@@ -210,7 +210,7 @@
 // (Full example with detailed comments in examples/01b_quick_example.rs)
 //
 // This example demonstrates clap's "builder pattern" method of creating arguments
-// which the most flexible, but also most verbose.
+// which is the most flexible, but also most verbose.
 use clap::{Arg, App};
 
 fn main() {
diff --git a/clap_generate/src/generators/shells/bash.rs b/clap_generate/src/generators/shells/bash.rs
index 426a44c..cbf9baf 100644
--- a/clap_generate/src/generators/shells/bash.rs
+++ b/clap_generate/src/generators/shells/bash.rs
@@ -33,7 +33,7 @@
     for i in ${{COMP_WORDS[@]}}
     do
         case \"${{i}}\" in
-            {name})
+            \"$1\")
                 cmd=\"{cmd}\"
                 ;;{subcmds}
             *)
diff --git a/clap_generate/tests/completions/bash.rs b/clap_generate/tests/completions/bash.rs
index 1ed1a65..cf38f97 100644
--- a/clap_generate/tests/completions/bash.rs
+++ b/clap_generate/tests/completions/bash.rs
@@ -42,7 +42,7 @@
     for i in ${COMP_WORDS[@]}
     do
         case "${i}" in
-            myapp)
+            "$1")
                 cmd="myapp"
                 ;;
             help)
@@ -139,7 +139,7 @@
     for i in ${COMP_WORDS[@]}
     do
         case "${i}" in
-            my_app)
+            "$1")
                 cmd="my_app"
                 ;;
             help)
@@ -285,7 +285,7 @@
     for i in ${COMP_WORDS[@]}
     do
         case "${i}" in
-            cmd)
+            "$1")
                 cmd="cmd"
                 ;;
             *)
diff --git a/src/parse/matches/arg_matches.rs b/src/parse/matches/arg_matches.rs
index 5f9cd62..a493fbb 100644
--- a/src/parse/matches/arg_matches.rs
+++ b/src/parse/matches/arg_matches.rs
@@ -392,7 +392,6 @@
     /// # Examples
     ///
     /// ```
-    /// # extern crate clap;
     /// # use clap::App;
     /// let matches = App::new("myapp")
     ///               .arg("[length] 'Set the length to use as a pos whole num, i.e. 20'")
@@ -443,7 +442,6 @@
     /// # Examples
     ///
     /// ```
-    /// # extern crate clap;
     /// # use clap::App;
     /// let matches = App::new("myapp")
     ///               .arg("[length] 'Set the length to use as a pos whole num, i.e. 20'")
@@ -481,7 +479,6 @@
     /// # Examples
     ///
     /// ```
-    /// # extern crate clap;
     /// # use clap::App;
     /// let matches = App::new("myapp")
     ///               .arg("[length]... 'A sequence of integers because integers are neat!'")
@@ -534,7 +531,6 @@
     /// # Examples
     ///
     /// ```
-    /// # extern crate clap;
     /// # use clap::App;
     /// let matches = App::new("myapp")
     ///               .arg("[length]... 'A sequence of integers because integers are neat!'")