Improve exit status documentation.

This commit is contained in:
William Melody 2020-09-11 17:13:40 -07:00
parent 0201480ffb
commit c74671613b
3 changed files with 35 additions and 15 deletions

View File

@ -417,7 +417,7 @@ Description:
Add a given IP address and hostname pair, along with an optional comment. Add a given IP address and hostname pair, along with an optional comment.
Exit status: Exit status:
0 Success. 0 Entry successfully added.
1 Invalid parameters or entry exists. 1 Invalid parameters or entry exists.
``` ```
@ -462,7 +462,7 @@ Description:
for IPv4 and both `fe80::1%lo0` and `::1` for IPv6. for IPv4 and both `fe80::1%lo0` and `::1` for IPv6.
Exit status: Exit status:
0 Success. 0 <hostname> successfully blocked.
1 Invalid parameters or entry exists. 1 Invalid parameters or entry exists.
``` ```
@ -483,6 +483,10 @@ Options:
Description: Description:
Manage completion scripts. For more information, visit: Manage completion scripts. For more information, visit:
https://github.com/xwmx/hosts/blob/master/etc/README.md https://github.com/xwmx/hosts/blob/master/etc/README.md
Exit status:
0 Completions successfully installed.
1 Invalid parameters or other error.
``` ```
### `hosts disable` ### `hosts disable`
@ -496,7 +500,7 @@ Description:
search string. search string.
Exit status: Exit status:
0 Success. 0 Entry successfully disabled.
1 Invalid parameters or entry not found. 1 Invalid parameters or entry not found.
``` ```
@ -531,7 +535,7 @@ Description:
or search string. or search string.
Exit status: Exit status:
0 Success. 0 Entry successfully enabled.
1 Invalid parameters or entry not found. 1 Invalid parameters or entry not found.
``` ```
@ -593,7 +597,7 @@ Description:
IP and hostname pair will be removed. IP and hostname pair will be removed.
Exit status: Exit status:
0 Success. 0 Entry successfully removed.
1 Invalid parameters or entry not found. 1 Invalid parameters or entry not found.
``` ```
@ -605,6 +609,10 @@ Usage:
Description: Description:
Search entries for <search string>. Search entries for <search string>.
Exit status:
0 One or more matching entries found.
1 Invalid parameters or entry not found.
``` ```
### `hosts show` ### `hosts show`
@ -617,7 +625,7 @@ Description:
Print entries matching a given IP address, hostname, or search string. Print entries matching a given IP address, hostname, or search string.
Exit status: Exit status:
0 Success. 0 One or more matching entries found.
1 Invalid parameters or entry not found. 1 Invalid parameters or entry not found.
``` ```
@ -644,7 +652,7 @@ Description:
Unblock one or more hostnames by removing the entries from the hosts file. Unblock one or more hostnames by removing the entries from the hosts file.
Exit status: Exit status:
0 Success. 0 <hostname> successfully unblocked.
1 Invalid parameters or entry not found 1 Invalid parameters or entry not found
``` ```

22
hosts
View File

@ -543,7 +543,7 @@ Description:
Add a given IP address and hostname pair, along with an optional comment. Add a given IP address and hostname pair, along with an optional comment.
Exit status: Exit status:
0 Success. 0 Entry successfully added.
1 Invalid parameters or entry exists. 1 Invalid parameters or entry exists.
HEREDOC HEREDOC
add() { add() {
@ -774,7 +774,7 @@ Description:
for IPv4 and both \`fe80::1%lo0\` and \`::1\` for IPv6. for IPv4 and both \`fe80::1%lo0\` and \`::1\` for IPv6.
Exit status: Exit status:
0 Success. 0 <hostname> successfully blocked.
1 Invalid parameters or entry exists. 1 Invalid parameters or entry exists.
HEREDOC HEREDOC
block() { block() {
@ -807,6 +807,10 @@ Options:
Description: Description:
Manage completion scripts. For more information, visit: Manage completion scripts. For more information, visit:
https://github.com/${_REPO}/blob/master/etc/README.md https://github.com/${_REPO}/blob/master/etc/README.md
Exit status:
0 Completions successfully installed.
1 Invalid parameters or other error.
HEREDOC HEREDOC
completions() { completions() {
local _BASH_COMP_NAME="hosts" local _BASH_COMP_NAME="hosts"
@ -1064,7 +1068,7 @@ Description:
search string. search string.
Exit status: Exit status:
0 Success. 0 Entry successfully disabled.
1 Invalid parameters or entry not found. 1 Invalid parameters or entry not found.
HEREDOC HEREDOC
disable() { disable() {
@ -1163,7 +1167,7 @@ Description:
or search string. or search string.
Exit status: Exit status:
0 Success. 0 Entry successfully enabled.
1 Invalid parameters or entry not found. 1 Invalid parameters or entry not found.
HEREDOC HEREDOC
enable() { enable() {
@ -1306,7 +1310,7 @@ Description:
IP and hostname pair will be removed. IP and hostname pair will be removed.
Exit status: Exit status:
0 Success. 0 Entry successfully removed.
1 Invalid parameters or entry not found. 1 Invalid parameters or entry not found.
HEREDOC HEREDOC
remove() { remove() {
@ -1448,6 +1452,10 @@ Usage:
Description: Description:
Search entries for <search string>. Search entries for <search string>.
Exit status:
0 One or more matching entries found.
1 Invalid parameters or entry not found.
HEREDOC HEREDOC
search() { search() {
if [[ -z "${1:-}" ]] if [[ -z "${1:-}" ]]
@ -1469,7 +1477,7 @@ Description:
Print entries matching a given IP address, hostname, or search string. Print entries matching a given IP address, hostname, or search string.
Exit status: Exit status:
0 Success. 0 One or more matching entries found.
1 Invalid parameters or entry not found. 1 Invalid parameters or entry not found.
HEREDOC HEREDOC
show() { show() {
@ -1541,7 +1549,7 @@ Description:
Unblock one or more hostnames by removing the entries from the hosts file. Unblock one or more hostnames by removing the entries from the hosts file.
Exit status: Exit status:
0 Success. 0 <hostname> successfully unblocked.
1 Invalid parameters or entry not found. 1 Invalid parameters or entry not found.
HEREDOC HEREDOC
unblock() { unblock() {

View File

@ -34,7 +34,11 @@ Usage:
hosts search <search string> hosts search <search string>
Description: Description:
Search entries for <search string>." Search entries for <search string>.
Exit status:
0 One or more matching entries found.
1 Invalid parameters or entry not found."
_compare "'${_expected}'" "'${output}'" _compare "'${_expected}'" "'${output}'"
[[ "${output}" == "${_expected}" ]] [[ "${output}" == "${_expected}" ]]
} }