mirror of
https://github.com/octoleo/hosts.git
synced 2024-12-28 20:12:42 +00:00
Use _exit_1
with non-help error messages.
This commit is contained in:
parent
8f2553b5a3
commit
1d948837d0
15
hosts
15
hosts
@ -816,8 +816,7 @@ backups() {
|
||||
exit 1
|
||||
elif [[ ! -e "${_hosts_dirname}/${_filename}" ]]
|
||||
then
|
||||
printf "Backup not found: %s\\n" "${_filename:-}"
|
||||
exit 1
|
||||
_exit_1 printf "Backup not found: %s\\n" "${_filename:-}"
|
||||
fi
|
||||
|
||||
diff -u "${HOSTS_PATH}" "${_hosts_dirname}/${_filename}"
|
||||
@ -837,8 +836,7 @@ backups() {
|
||||
rm "${_hosts_dirname}/${_filename:-}" &&
|
||||
printf "Backup deleted: %s\\n" "${_hosts_dirname}/${_filename:-}"
|
||||
else
|
||||
printf "Backup not found: %s\\n" "${_filename:-}"
|
||||
exit 1
|
||||
_exit_1 printf "Backup not found: %s\\n" "${_filename:-}"
|
||||
fi
|
||||
;;
|
||||
restore)
|
||||
@ -848,8 +846,7 @@ backups() {
|
||||
exit 1
|
||||
elif [[ ! -e "${_hosts_dirname}/${_filename}" ]]
|
||||
then
|
||||
printf "Backup not found: %s\\n" "${_filename:-}"
|
||||
exit 1
|
||||
_exit_1 printf "Backup not found: %s\\n" "${_filename:-}"
|
||||
fi
|
||||
|
||||
_verify_write_permissions
|
||||
@ -869,8 +866,7 @@ backups() {
|
||||
exit 1
|
||||
elif [[ ! -e "${_hosts_dirname}/${_filename}" ]]
|
||||
then
|
||||
printf "Backup not found: %s\\n" "${_filename:-}"
|
||||
exit 1
|
||||
_exit_1 printf "Backup not found: %s\\n" "${_filename:-}"
|
||||
fi
|
||||
|
||||
cat "${_hosts_dirname}/${_filename:-}"
|
||||
@ -1279,8 +1275,7 @@ remove() {
|
||||
|
||||
if [[ -z "${_target_records:-}" ]]
|
||||
then
|
||||
printf "No matching records found.\\n"
|
||||
exit 1
|
||||
_exit_1 printf "No matching records found.\\n"
|
||||
fi
|
||||
|
||||
if ! ((_force_skip_prompt))
|
||||
|
@ -53,7 +53,7 @@ load test_helper
|
||||
run "${_HOSTS}" remove 127.0.0.3 --force
|
||||
printf "\${status}: %s\\n" "${status}"
|
||||
printf "\${output}: '%s'\\n" "${output}"
|
||||
[[ ${output} == "No matching records found." ]]
|
||||
[[ ${output} == "${_ERROR_PREFIX}No matching records found." ]]
|
||||
}
|
||||
|
||||
# `hosts remove <ip> --force` #################################################
|
||||
|
@ -49,7 +49,7 @@ load test_helper
|
||||
run "${_HOSTS}" unblock example.net
|
||||
printf "\${status}: %s\\n" "${status}"
|
||||
printf "\${output}: '%s'\\n" "${output}"
|
||||
[[ ${output} == "No matching records found." ]]
|
||||
[[ ${output} == "${_ERROR_PREFIX}No matching records found." ]]
|
||||
}
|
||||
|
||||
# `hosts unblock <hostname>` ###########################################
|
||||
|
Loading…
Reference in New Issue
Block a user