mirror of https://github.com/octoleo/hosts.git
Expand per-command usage info.
Including descriptions of each command, since the functionality might not always be immediately obvious.
This commit is contained in:
parent
bafa955308
commit
235be1f151
31
hosts
31
hosts
|
@ -637,7 +637,11 @@ commands() {
|
||||||
# ------------------------------------------------------------------------- add
|
# ------------------------------------------------------------------------- add
|
||||||
|
|
||||||
desc add <<EOM
|
desc add <<EOM
|
||||||
Usage: $_me add <ip> <hostname>
|
Usage:
|
||||||
|
$_me add <ip> <hostname>
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Add a given IP address and hostname pair.
|
||||||
EOM
|
EOM
|
||||||
add() {
|
add() {
|
||||||
local ip=${1:-}
|
local ip=${1:-}
|
||||||
|
@ -659,7 +663,12 @@ add() {
|
||||||
# ------------------------------------------------------------------------ list
|
# ------------------------------------------------------------------------ list
|
||||||
|
|
||||||
desc list <<EOM
|
desc list <<EOM
|
||||||
Usage: $_me list [127.]
|
Usage:
|
||||||
|
$_me list [127.]
|
||||||
|
|
||||||
|
Description:
|
||||||
|
List the existing IP / hostname pairs. When provided with the beginning of
|
||||||
|
an IP address, lists the pairs with matching IP addresses.
|
||||||
EOM
|
EOM
|
||||||
list() {
|
list() {
|
||||||
if [[ -n "$1" ]]; then
|
if [[ -n "$1" ]]; then
|
||||||
|
@ -674,7 +683,11 @@ list() {
|
||||||
# ------------------------------------------------------------------------ edit
|
# ------------------------------------------------------------------------ edit
|
||||||
|
|
||||||
desc edit <<EOM
|
desc edit <<EOM
|
||||||
Usage: $_me edit
|
Usage:
|
||||||
|
$_me edit
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Open the /etc/hosts file in your \$EDITOR.
|
||||||
EOM
|
EOM
|
||||||
edit() {
|
edit() {
|
||||||
if [[ -z "$EDITOR" ]]; then
|
if [[ -z "$EDITOR" ]]; then
|
||||||
|
@ -687,7 +700,11 @@ edit() {
|
||||||
# ------------------------------------------------------------------------ file
|
# ------------------------------------------------------------------------ file
|
||||||
|
|
||||||
desc file <<EOM
|
desc file <<EOM
|
||||||
Usage: $_me file
|
Usage:
|
||||||
|
$_me file
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Print the entire contents of the /etc/hosts file.
|
||||||
EOM
|
EOM
|
||||||
file() {
|
file() {
|
||||||
cat /etc/hosts
|
cat /etc/hosts
|
||||||
|
@ -696,7 +713,11 @@ file() {
|
||||||
# ---------------------------------------------------------------------- remove
|
# ---------------------------------------------------------------------- remove
|
||||||
|
|
||||||
desc remove <<EOM
|
desc remove <<EOM
|
||||||
Usage: $_me remove <hostname>
|
Usage:
|
||||||
|
$_me remove <hostname>
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Remove all IP / hostname pairs for a given hostname.
|
||||||
EOM
|
EOM
|
||||||
remove() {
|
remove() {
|
||||||
local hostname=${1:-}
|
local hostname=${1:-}
|
||||||
|
|
Loading…
Reference in New Issue