Update help/usage formatting.

This commit is contained in:
William Melody 2016-01-26 20:25:16 -08:00
parent f8564cfb2f
commit f7c7aef173
8 changed files with 33 additions and 33 deletions

View File

@ -41,16 +41,16 @@ curl -L https://raw.github.com/alphabetum/hosts/master/hosts \
```text
Usage:
hosts
hosts add <ip> <hostname> [comment]
hosts disable ( <ip> | <hostname> | <search string> )
hosts add <ip> <hostname> [<comment>]
hosts disable (<ip> | <hostname> | <search string>)
hosts disabled
hosts edit
hosts enable ( <ip> | <hostname> | <search string> )
hosts enable (<ip> | <hostname> | <search string>)
hosts enabled
hosts file
hosts list [enabled | disabled | <search string>]
hosts show ( <ip> | <hostname> | <search string> )
hosts remove ( <ip> | <hostname> | <search string> ) [--force]
hosts show (<ip> | <hostname> | <search string>)
hosts remove (<ip> | <hostname> | <search string>) [--force]
```
For full usage, run:
@ -67,11 +67,11 @@ hosts help <command name>
## Commands
###### `hosts add <ip> <hostname> [comment]`
###### `hosts add <ip> <hostname> [<comment>]`
Add a given IP address and hostname pair, along with an optional comment.
###### `hosts remove ( <ip> | <hostname> | <search string> ) [--force]`
###### `hosts remove (<ip> | <hostname> | <search string>) [--force]`
Remove one or more records based on a given IP address, hostname, or search
string. When the `--force` option is used, the confirmation prompt is
@ -83,11 +83,11 @@ List the existing IP / hostname pairs, optionally limited to a specified
state. When provided with a seach string, all matching enabled records will
be printed.
###### `hosts show ( <ip> | <hostname> | <search string> )`
###### `hosts show (<ip> | <hostname> | <search string>)`
Print entries matching a given IP address, hostname, or search string.
###### `hosts disable ( <ip> | <hostname> | <search string> )`
###### `hosts disable (<ip> | <hostname> | <search string>)`
Disable one or more records based on a given ip address, hostname, or
search string.
@ -96,7 +96,7 @@ search string.
List all disabled records. This is an alias for `hosts list disabled`.
###### `hosts enable ( <ip> | <hostname> | <search string> )`
###### `hosts enable (<ip> | <hostname> | <search string>)`
Enable one or more disabled records based on a given ip address, hostname,
or search string.

22
hosts
View File

@ -551,7 +551,7 @@ _print_desc() {
desc "version" <<EOM
Usage:
$_ME ( version | --version )
$_ME (version | --version)
Description:
Display the current program version.
@ -587,16 +587,16 @@ Version: $_VERSION
Usage:
$_ME
$_ME add <ip> <hostname> [comment]
$_ME disable ( <ip> | <hostname> | <search string> )
$_ME add <ip> <hostname> [<comment>]
$_ME disable (<ip> | <hostname> | <search string>)
$_ME disabled
$_ME edit
$_ME enable ( <ip> | <hostname> | <search string> )
$_ME enable (<ip> | <hostname> | <search string>)
$_ME enabled
$_ME file
$_ME list [enabled | disabled | <search string>]
$_ME show ( <ip> | <hostname> | <search string> )
$_ME remove ( <ip> | <hostname> | <search string> ) [--force]
$_ME show (<ip> | <hostname> | <search string>)
$_ME remove (<ip> | <hostname> | <search string>) [--force]
$_ME -h | --help
$_ME --version
@ -667,7 +667,7 @@ commands() {
desc "add" <<EOM
Usage:
$_ME add <ip> <hostname> [comment]
$_ME add <ip> <hostname> [<comment>]
Description:
Add a given IP address and hostname pair, along with an optional comment.
@ -725,7 +725,7 @@ add() {
desc "disable" <<EOM
Usage:
$_ME disable ( <ip> | <hostname> | <search string> )
$_ME disable (<ip> | <hostname> | <search string>)
Description:
Disable one or more records based on a given ip address, hostname, or
@ -811,7 +811,7 @@ edit() {
desc "enable" <<EOM
Usage:
$_ME enable ( <ip> | <hostname> | <search string> )
$_ME enable (<ip> | <hostname> | <search string>)
Description:
Enable one or more disabled records based on a given ip address, hostname,
@ -931,7 +931,7 @@ list() {
desc "remove" <<EOM
Usage:
$_ME remove ( <ip> | <hostname> | <search string> ) [--force]
$_ME remove (<ip> | <hostname> | <search string>) [--force]
$_ME remove <ip> <hostname>
Options:
@ -1066,7 +1066,7 @@ remove() {
desc "show" <<EOM
Usage:
$_ME show ( <ip> | <hostname> | <search string> )
$_ME show (<ip> | <hostname> | <search string>)
Description:
Print entries matching a given IP address, hostname, or search string.

View File

@ -25,7 +25,7 @@ load test_helper
printf "\$status: %s\n" "$status"
printf "\$output: '%s'\n" "$output"
[[ "${lines[0]}" == "Usage:" ]]
[[ "${lines[1]}" == " hosts add <ip> <hostname> [comment]" ]]
[[ "${lines[1]}" == " hosts add <ip> <hostname> [<comment>]" ]]
}
# `hosts add <ip>` ############################################################
@ -52,7 +52,7 @@ load test_helper
printf "\$output: '%s'\n" "$output"
[[ "${lines[0]}" == "Please include a hostname" ]]
[[ "${lines[1]}" == "Usage:" ]]
[[ "${lines[2]}" == " hosts add <ip> <hostname> [comment]" ]]
[[ "${lines[2]}" == " hosts add <ip> <hostname> [<comment>]" ]]
}
# `hosts add <ip> <hostname>` #################################################
@ -123,5 +123,5 @@ load test_helper
printf "\$status: %s\n" "$status"
printf "\$output: '%s'\n" "$output"
[[ "${lines[0]}" == "Usage:" ]]
[[ "${lines[1]}" == " hosts add <ip> <hostname> [comment]" ]]
[[ "${lines[1]}" == " hosts add <ip> <hostname> [<comment>]" ]]
}

View File

@ -25,7 +25,7 @@ load test_helper
printf "\$status: %s\n" "$status"
printf "\$output: '%s'\n" "$output"
[[ "${lines[0]}" == "Usage:" ]]
[[ "${lines[1]}" == " hosts disable ( <ip> | <hostname> | <search string> )" ]]
[[ "${lines[1]}" == " hosts disable (<ip> | <hostname> | <search string>)" ]]
}
# `hosts disable <ip>` ########################################################
@ -154,5 +154,5 @@ load test_helper
printf "\$status: %s\n" "$status"
printf "\$output: '%s'\n" "$output"
[[ "${lines[0]}" == "Usage:" ]]
[[ "${lines[1]}" == " hosts disable ( <ip> | <hostname> | <search string> )" ]]
[[ "${lines[1]}" == " hosts disable (<ip> | <hostname> | <search string>)" ]]
}

View File

@ -25,7 +25,7 @@ load test_helper
printf "\$status: %s\n" "$status"
printf "\$output: '%s'\n" "$output"
[[ "${lines[0]}" == "Usage:" ]]
[[ "${lines[1]}" == " hosts enable ( <ip> | <hostname> | <search string> )" ]]
[[ "${lines[1]}" == " hosts enable (<ip> | <hostname> | <search string>)" ]]
}
# `hosts enable <ip>` #########################################################
@ -201,5 +201,5 @@ load test_helper
printf "\$status: %s\n" "$status"
printf "\$output: '%s'\n" "$output"
[[ "${lines[0]}" == "Usage:" ]]
[[ "${lines[1]}" == " hosts enable ( <ip> | <hostname> | <search string> )" ]]
[[ "${lines[1]}" == " hosts enable (<ip> | <hostname> | <search string>)" ]]
}

View File

@ -25,7 +25,7 @@ load test_helper
printf "\$status: %s\n" "$status"
printf "\$output: '%s'\n" "$output"
[[ "${lines[0]}" == "Usage:" ]]
[[ "${lines[1]}" == " hosts remove ( <ip> | <hostname> | <search string> ) [--force]" ]]
[[ "${lines[1]}" == " hosts remove (<ip> | <hostname> | <search string>) [--force]" ]]
}
# `hosts remove <invalid> --force` ############################################
@ -223,5 +223,5 @@ Removed:
printf "\$status: %s\n" "$status"
printf "\$output: '%s'\n" "$output"
[[ "${lines[0]}" == "Usage:" ]]
[[ "${lines[1]}" == " hosts remove ( <ip> | <hostname> | <search string> ) [--force]" ]]
[[ "${lines[1]}" == " hosts remove (<ip> | <hostname> | <search string>) [--force]" ]]
}

View File

@ -16,7 +16,7 @@ load test_helper
printf "\$status: %s\n" "$status"
printf "\$output: '%s'\n" "$output"
[[ "${lines[0]}" == "Usage:" ]]
[[ "${lines[1]}" == " hosts show ( <ip> | <hostname> | <search string> )" ]]
[[ "${lines[1]}" == " hosts show (<ip> | <hostname> | <search string>)" ]]
}
# `hosts show <ip>` #########################################################
@ -95,5 +95,5 @@ load test_helper
printf "\$status: %s\n" "$status"
printf "\$output: '%s'\n" "$output"
[[ "${lines[0]}" == "Usage:" ]]
[[ "${lines[1]}" == " hosts show ( <ip> | <hostname> | <search string> )" ]]
[[ "${lines[1]}" == " hosts show (<ip> | <hostname> | <search string>)" ]]
}

View File

@ -36,5 +36,5 @@ load test_helper
printf "\$status: %s\n" "$status"
printf "\$output: '%s'\n" "$output"
[[ "${lines[0]}" == "Usage:" ]]
[[ "${lines[1]}" == " hosts ( version | --version )" ]]
[[ "${lines[1]}" == " hosts (version | --version)" ]]
}