mirror of
https://github.com/octoleo/hosts.git
synced 2025-02-11 23:08:30 +00:00
Use __
prefix for variables in loops.
This commit is contained in:
parent
c11f22e558
commit
42a2a9f3d4
20
hosts
20
hosts
@ -863,16 +863,16 @@ completions() {
|
|||||||
_exit_1 printf "Source Git repository not configured.\\n"
|
_exit_1 printf "Source Git repository not configured.\\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for _shell in bash zsh
|
for __shell in bash zsh
|
||||||
do
|
do
|
||||||
local _completion_source="${_my_dir}/etc/${_ME}-completion.${_shell}"
|
local _completion_source="${_my_dir}/etc/${_ME}-completion.${__shell}"
|
||||||
|
|
||||||
if ((_download))
|
if ((_download))
|
||||||
then
|
then
|
||||||
if [[ ! -f "${_completion_source}" ]]
|
if [[ ! -f "${_completion_source}" ]]
|
||||||
then
|
then
|
||||||
_completion_source="$(mktemp)"
|
_completion_source="$(mktemp)"
|
||||||
local _completion_url="${_REPO_RAW_URL}/etc/${_ME}-completion.${_shell}"
|
local _completion_url="${_REPO_RAW_URL}/etc/${_ME}-completion.${__shell}"
|
||||||
|
|
||||||
if ! _download_from "${_completion_url}" "${_completion_source}"
|
if ! _download_from "${_completion_url}" "${_completion_source}"
|
||||||
then
|
then
|
||||||
@ -885,22 +885,22 @@ completions() {
|
|||||||
if [[ ! -f "${_completion_source}" ]]
|
if [[ ! -f "${_completion_source}" ]]
|
||||||
then
|
then
|
||||||
cat <<HEREDOC
|
cat <<HEREDOC
|
||||||
Unable to find source ${_shell} completion script. You can try downloading
|
Unable to find source ${__shell} completion script. You can try downloading
|
||||||
and installing the latest version with the following command (\`sudo\` might
|
and installing the latest version with the following command (\`sudo\` might
|
||||||
be necessary):
|
be necessary):
|
||||||
${_ME} completions install --download
|
${_ME} completions install --download
|
||||||
|
|
||||||
More information: ${_shell}
|
More information: ${__shell}
|
||||||
https://github.com/${_REPO}/blob/master/etc/README.md
|
https://github.com/${_REPO}/blob/master/etc/README.md
|
||||||
HEREDOC
|
HEREDOC
|
||||||
else
|
else
|
||||||
local _completion_path=
|
local _completion_path=
|
||||||
local _completion_target=
|
local _completion_target=
|
||||||
if [[ "${_shell}" == "bash" ]]
|
if [[ "${__shell}" == "bash" ]]
|
||||||
then
|
then
|
||||||
_completion_path="$(_get_bash_completion_path)"
|
_completion_path="$(_get_bash_completion_path)"
|
||||||
_completion_target="${_completion_path}/${_BASH_COMP_NAME}"
|
_completion_target="${_completion_path}/${_BASH_COMP_NAME}"
|
||||||
elif [[ "${_shell}" == "zsh" ]]
|
elif [[ "${__shell}" == "zsh" ]]
|
||||||
then
|
then
|
||||||
_completion_path="/usr/local/share/zsh/site-functions"
|
_completion_path="/usr/local/share/zsh/site-functions"
|
||||||
_completion_target="${_completion_path}/${_ZSH_COMP_NAME}"
|
_completion_target="${_completion_path}/${_ZSH_COMP_NAME}"
|
||||||
@ -935,13 +935,13 @@ HEREDOC
|
|||||||
local _completion_path=
|
local _completion_path=
|
||||||
local _completion_target=
|
local _completion_target=
|
||||||
|
|
||||||
for _shell in bash zsh
|
for __shell in bash zsh
|
||||||
do
|
do
|
||||||
if [[ "${_shell}" == "bash" ]]
|
if [[ "${__shell}" == "bash" ]]
|
||||||
then
|
then
|
||||||
_completion_path="$(_get_bash_completion_path)"
|
_completion_path="$(_get_bash_completion_path)"
|
||||||
_completion_target="${_completion_path}/${_BASH_COMP_NAME}"
|
_completion_target="${_completion_path}/${_BASH_COMP_NAME}"
|
||||||
elif [[ "${_shell}" == "zsh" ]]
|
elif [[ "${__shell}" == "zsh" ]]
|
||||||
then
|
then
|
||||||
_completion_path="/usr/local/share/zsh/site-functions"
|
_completion_path="/usr/local/share/zsh/site-functions"
|
||||||
_completion_target="${_completion_path}/${_ZSH_COMP_NAME}"
|
_completion_target="${_completion_path}/${_ZSH_COMP_NAME}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user