1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-12-01 01:03:56 +00:00

Support full list operations in hosts with no subcommand.

This commit is contained in:
William Melody 2017-03-01 20:18:26 -08:00
parent 05ba7bdc03
commit 6c0254895f
2 changed files with 21 additions and 3 deletions

View File

@ -40,7 +40,7 @@ curl -L https://raw.github.com/alphabetum/hosts/master/hosts \
```text ```text
Usage: Usage:
hosts hosts [<search string>]
hosts add <ip> <hostname> [<comment>] hosts add <ip> <hostname> [<comment>]
hosts block <hostname> hosts block <hostname>
hosts disable (<ip> | <hostname> | <search string>) hosts disable (<ip> | <hostname> | <search string>)
@ -81,6 +81,20 @@ hosts help <command name>
## Commands ## Commands
## `hosts`
```text
Usage:
hosts [<search string>]
Description:
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.
Alias for `hosts list`
```
## `hosts add` ## `hosts add`
```text ```text

8
hosts
View File

@ -373,7 +373,11 @@ _main() {
# Pass all comment arguments to the program except for the first ($0). # Pass all comment arguments to the program except for the first ($0).
${_CMD} "${_COMMAND_PARAMETERS[@]:-}" ${_CMD} "${_COMMAND_PARAMETERS[@]:-}"
else else
_die printf "Unknown command: %s\n" "${_CMD}" local _parameters=()
_parameters+=("${_CMD}")
_parameters+=(${_COMMAND_PARAMETERS[@]:-})
"${DEFAULT_COMMAND}" "${_parameters[@]:-}"
fi fi
} }
@ -605,7 +609,7 @@ A program for managing host file entries.
Version: ${_VERSION} Version: ${_VERSION}
Usage: Usage:
${_ME} ${_ME} [<search string>]
${_ME} add <ip> <hostname> [<comment>] ${_ME} add <ip> <hostname> [<comment>]
${_ME} block <hostname> ${_ME} block <hostname>
${_ME} disable (<ip> | <hostname> | <search string>) ${_ME} disable (<ip> | <hostname> | <search string>)