docs: show the device specifier flags only to the relevant commands

Change-Id: I48b269e7db8d1c69c20ca8e42c08f099558aa0e5
MultiPart: 2/2
diff --git a/doc.go b/doc.go
index 8db83cc..3250314 100644
--- a/doc.go
+++ b/doc.go
@@ -204,9 +204,6 @@
 Manages device nicknames, which are meant to be more human-friendly compared to
 the device serials provided by adb tool.
 
-NOTE: Device specifier flags (-d, -e, -n) are ignored in all 'madb name'
-commands.
-
 Usage:
    madb name [flags] <command>
 
@@ -216,17 +213,6 @@
    list        List all the existing nicknames.
    clear-all   Clear all the existing nicknames.
 
-The madb name flags are:
- -d=false
-   Restrict the command to only run on real devices.
- -e=false
-   Restrict the command to only run on emulators.
- -n=
-   Comma-separated device serials, qualifiers, device indices (e.g., '@1',
-   '@2'), or nicknames (set by 'madb name'). A device index is specified by an
-   '@' sign followed by the index of the device in the output of 'adb devices'
-   command, starting from 1. Command will be run only on specified devices.
-
 Madb name set
 
 Sets a human-friendly nickname that can be used when specifying the device in
@@ -260,17 +246,6 @@
 device qualifier (e.g., 'usb:3-3.4.2') obtained from 'adb devices -l' command
 <nickname> is an alpha-numeric string with no special characters or spaces.
 
-The madb name set flags are:
- -d=false
-   Restrict the command to only run on real devices.
- -e=false
-   Restrict the command to only run on emulators.
- -n=
-   Comma-separated device serials, qualifiers, device indices (e.g., '@1',
-   '@2'), or nicknames (set by 'madb name'). A device index is specified by an
-   '@' sign followed by the index of the device in the output of 'adb devices'
-   command, starting from 1. Command will be run only on specified devices.
-
 Madb name unset
 
 Unsets a nickname assigned by the 'madb name set' command. Either the device
@@ -282,17 +257,6 @@
 There should be only one argument, which is either the device serial or the
 nickname.
 
-The madb name unset flags are:
- -d=false
-   Restrict the command to only run on real devices.
- -e=false
-   Restrict the command to only run on emulators.
- -n=
-   Comma-separated device serials, qualifiers, device indices (e.g., '@1',
-   '@2'), or nicknames (set by 'madb name'). A device index is specified by an
-   '@' sign followed by the index of the device in the output of 'adb devices'
-   command, starting from 1. Command will be run only on specified devices.
-
 Madb name list
 
 Lists all the currently stored nicknames of device serials.
@@ -300,17 +264,6 @@
 Usage:
    madb name list [flags]
 
-The madb name list flags are:
- -d=false
-   Restrict the command to only run on real devices.
- -e=false
-   Restrict the command to only run on emulators.
- -n=
-   Comma-separated device serials, qualifiers, device indices (e.g., '@1',
-   '@2'), or nicknames (set by 'madb name'). A device index is specified by an
-   '@' sign followed by the index of the device in the output of 'adb devices'
-   command, starting from 1. Command will be run only on specified devices.
-
 Madb name clear-all
 
 Clears all the currently stored nicknames of device serials.
@@ -318,17 +271,6 @@
 Usage:
    madb name clear-all [flags]
 
-The madb name clear-all flags are:
- -d=false
-   Restrict the command to only run on real devices.
- -e=false
-   Restrict the command to only run on emulators.
- -n=
-   Comma-separated device serials, qualifiers, device indices (e.g., '@1',
-   '@2'), or nicknames (set by 'madb name'). A device index is specified by an
-   '@' sign followed by the index of the device in the output of 'adb devices'
-   command, starting from 1. Command will be run only on specified devices.
-
 Madb shell - Run the provided adb shell command on all devices and emulators concurrently
 
 Runs the provided adb shell command on all devices and emulators concurrently.
@@ -566,9 +508,6 @@
 For more details on how to obtain the user ID from an Android device, see 'madb
 user help set'.
 
-NOTE: Device specifier flags (-d, -e, -n) are ignored in all 'madb name'
-commands.
-
 Usage:
    madb user [flags] <command>
 
@@ -578,17 +517,6 @@
    list        List all the existing default user IDs.
    clear-all   Clear all the existing default user settings.
 
-The madb user flags are:
- -d=false
-   Restrict the command to only run on real devices.
- -e=false
-   Restrict the command to only run on emulators.
- -n=
-   Comma-separated device serials, qualifiers, device indices (e.g., '@1',
-   '@2'), or nicknames (set by 'madb name'). A device index is specified by an
-   '@' sign followed by the index of the device in the output of 'adb devices'
-   command, starting from 1. Command will be run only on specified devices.
-
 Madb user set
 
 Sets a default user ID to be used for the specified device, when there are
@@ -626,17 +554,6 @@
 obtained from 'adb devices'. <user_id> is one of the user IDs obtained from 'adb
 shell pm list users' command.
 
-The madb user set flags are:
- -d=false
-   Restrict the command to only run on real devices.
- -e=false
-   Restrict the command to only run on emulators.
- -n=
-   Comma-separated device serials, qualifiers, device indices (e.g., '@1',
-   '@2'), or nicknames (set by 'madb name'). A device index is specified by an
-   '@' sign followed by the index of the device in the output of 'adb devices'
-   command, starting from 1. Command will be run only on specified devices.
-
 Madb user unset
 
 Unsets the default user ID assigned by the 'madb user set' command for the
@@ -652,17 +569,6 @@
 <device_serial> is the unique serial number for the device, which can be
 obtained from 'adb devices'.
 
-The madb user unset flags are:
- -d=false
-   Restrict the command to only run on real devices.
- -e=false
-   Restrict the command to only run on emulators.
- -n=
-   Comma-separated device serials, qualifiers, device indices (e.g., '@1',
-   '@2'), or nicknames (set by 'madb name'). A device index is specified by an
-   '@' sign followed by the index of the device in the output of 'adb devices'
-   command, starting from 1. Command will be run only on specified devices.
-
 Madb user list
 
 Lists all the currently stored default user IDs for devices.
@@ -670,17 +576,6 @@
 Usage:
    madb user list [flags]
 
-The madb user list flags are:
- -d=false
-   Restrict the command to only run on real devices.
- -e=false
-   Restrict the command to only run on emulators.
- -n=
-   Comma-separated device serials, qualifiers, device indices (e.g., '@1',
-   '@2'), or nicknames (set by 'madb name'). A device index is specified by an
-   '@' sign followed by the index of the device in the output of 'adb devices'
-   command, starting from 1. Command will be run only on specified devices.
-
 Madb user clear-all
 
 Clears all the currently stored default user IDs for devices.
@@ -691,17 +586,6 @@
 Usage:
    madb user clear-all [flags]
 
-The madb user clear-all flags are:
- -d=false
-   Restrict the command to only run on real devices.
- -e=false
-   Restrict the command to only run on emulators.
- -n=
-   Comma-separated device serials, qualifiers, device indices (e.g., '@1',
-   '@2'), or nicknames (set by 'madb name'). A device index is specified by an
-   '@' sign followed by the index of the device in the output of 'adb devices'
-   command, starting from 1. Command will be run only on specified devices.
-
 Madb version - Print the madb version number
 
 Prints the madb version number to the console.
@@ -714,17 +598,6 @@
 Usage:
    madb version [flags]
 
-The madb version flags are:
- -d=false
-   Restrict the command to only run on real devices.
- -e=false
-   Restrict the command to only run on emulators.
- -n=
-   Comma-separated device serials, qualifiers, device indices (e.g., '@1',
-   '@2'), or nicknames (set by 'madb name'). A device index is specified by an
-   '@' sign followed by the index of the device in the output of 'adb devices'
-   command, starting from 1. Command will be run only on specified devices.
-
 Madb help - Display help for commands or topics
 
 Help with no args displays the usage of the parent command.
diff --git a/name.go b/name.go
index 69337ba..1da7f52 100644
--- a/name.go
+++ b/name.go
@@ -14,14 +14,13 @@
 )
 
 var cmdMadbName = &cmdline.Command{
-	Children: []*cmdline.Command{cmdMadbNameSet, cmdMadbNameUnset, cmdMadbNameList, cmdMadbNameClearAll},
-	Name:     "name",
-	Short:    "Manage device nicknames",
+	Children:         []*cmdline.Command{cmdMadbNameSet, cmdMadbNameUnset, cmdMadbNameList, cmdMadbNameClearAll},
+	Name:             "name",
+	DontInheritFlags: true,
+	Short:            "Manage device nicknames",
 	Long: `
 Manages device nicknames, which are meant to be more human-friendly compared to
 the device serials provided by adb tool.
-
-NOTE: Device specifier flags (-d, -e, -n) are ignored in all 'madb name' commands.
 `,
 }
 
diff --git a/user.go b/user.go
index 94bd2fa..651f5ea 100644
--- a/user.go
+++ b/user.go
@@ -15,9 +15,10 @@
 
 // TODO(youngseokyoon): add a helper command that wraps "madb exec shell pm list users" to show all available users.
 var cmdMadbUser = &cmdline.Command{
-	Children: []*cmdline.Command{cmdMadbUserSet, cmdMadbUserUnset, cmdMadbUserList, cmdMadbUserClearAll},
-	Name:     "user",
-	Short:    "Manage default user settings for each device",
+	Children:         []*cmdline.Command{cmdMadbUserSet, cmdMadbUserUnset, cmdMadbUserList, cmdMadbUserClearAll},
+	Name:             "user",
+	DontInheritFlags: true,
+	Short:            "Manage default user settings for each device",
 	Long: `
 Manages default user settings for each device.
 
@@ -41,8 +42,6 @@
     madb uninstall
 
 For more details on how to obtain the user ID from an Android device, see 'madb user help set'.
-
-NOTE: Device specifier flags (-d, -e, -n) are ignored in all 'madb name' commands.
 `,
 }
 
diff --git a/version_cmd.go b/version_cmd.go
index 5bfcea8..698fdb3 100644
--- a/version_cmd.go
+++ b/version_cmd.go
@@ -11,15 +11,17 @@
 )
 
 var cmdMadbVersion = &cmdline.Command{
-	Runner: cmdline.RunnerFunc(runCmdMadbVersion),
-	Name:   "version",
-	Short:  "Print the madb version number",
+	Runner:           cmdline.RunnerFunc(runCmdMadbVersion),
+	Name:             "version",
+	DontInheritFlags: true,
+	Short:            "Print the madb version number",
 	Long: `
 Prints the madb version number to the console.
 
 If this version of madb binary is an official release, this command will show the version number.
 Otherwise, the version will be in the form of "<version>-develop", where the version indicates the
-most recent stable release version prior to this version of madb binary.`,
+most recent stable release version prior to this version of madb binary.
+`,
 }
 
 func runCmdMadbVersion(env *cmdline.Env, args []string) error {