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

View File

@ -34,7 +34,11 @@ Usage:
hosts search <search string>
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}'"
[[ "${output}" == "${_expected}" ]]
}