mirror of
https://github.com/octoleo/hosts.git
synced 2025-01-01 05:31:49 +00:00
Add edit
command
`edit` open the hosts file in the editor specified in the $EDITOR environment variable.
This commit is contained in:
parent
fc60f3a0d7
commit
7607dfd262
@ -8,6 +8,7 @@ A program for managing host file entries.
|
||||
hosts add <ip> <hostname>
|
||||
hosts remove <hostname>
|
||||
hosts list [127.]
|
||||
hosts edit
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
|
13
hosts
13
hosts
@ -666,6 +666,19 @@ list() {
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------ edit
|
||||
|
||||
desc edit <<EOM
|
||||
Usage: $_me edit
|
||||
EOM
|
||||
edit() {
|
||||
if [[ -z "$EDITOR" ]]; then
|
||||
_die printf "\$EDITOR not set.\n"
|
||||
else
|
||||
"$EDITOR" /etc/hosts
|
||||
fi
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------- remove
|
||||
|
||||
desc remove <<EOM
|
||||
|
Loading…
Reference in New Issue
Block a user