mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
Refactor "{declare -{f,F} => _omb_util_function_exists}"
Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
This commit is contained in:
@@ -552,7 +552,7 @@ _docker_compose() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
local completions_func=_docker_compose_${command//-/_}
|
local completions_func=_docker_compose_${command//-/_}
|
||||||
declare -F $completions_func >/dev/null && $completions_func
|
_omb_util_function_exists $completions_func && $completions_func
|
||||||
|
|
||||||
eval "$previous_extglob_setting"
|
eval "$previous_extglob_setting"
|
||||||
return 0
|
return 0
|
||||||
|
@@ -243,7 +243,7 @@ _docker_machine() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
local completion_func=_docker_machine_"${command//-/_}"
|
local completion_func=_docker_machine_"${command//-/_}"
|
||||||
if declare -F "${completion_func}" > /dev/null; then
|
if _omb_util_function_exists "${completion_func}"; then
|
||||||
${completion_func}
|
${completion_func}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@@ -394,7 +394,7 @@ __docker_subcommands() {
|
|||||||
subcommand_pos=$counter
|
subcommand_pos=$counter
|
||||||
local subcommand=${words[$counter]}
|
local subcommand=${words[$counter]}
|
||||||
local completions_func=_docker_${command}_${subcommand}
|
local completions_func=_docker_${command}_${subcommand}
|
||||||
declare -F $completions_func >/dev/null && $completions_func
|
_omb_util_function_exists $completions_func && $completions_func
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -2953,7 +2953,7 @@ _docker() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local completions_func=_docker_${command}
|
local completions_func=_docker_${command}
|
||||||
declare -F $completions_func >/dev/null && $completions_func
|
_omb_util_function_exists $completions_func && $completions_func
|
||||||
|
|
||||||
eval "$previous_extglob_setting"
|
eval "$previous_extglob_setting"
|
||||||
return 0
|
return 0
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
# This script complements the completion script that ships with git.
|
# This script complements the completion script that ships with git.
|
||||||
|
|
||||||
# Check that git tab completion is available
|
# Check that git tab completion is available
|
||||||
if declare -F _git > /dev/null; then
|
if _omb_util_function_exists _git; then
|
||||||
# Duplicate and rename the 'list_all_commands' function
|
# Duplicate and rename the 'list_all_commands' function
|
||||||
eval "$(declare -f __git_list_all_commands | \
|
eval "$(declare -f __git_list_all_commands | \
|
||||||
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
|
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
|
||||||
|
@@ -3,12 +3,12 @@
|
|||||||
# This script complements the completion script that ships with git.
|
# This script complements the completion script that ships with git.
|
||||||
|
|
||||||
# If there is no git tab completion, but we have the _completion loader try to load it
|
# If there is no git tab completion, but we have the _completion loader try to load it
|
||||||
if ! declare -F _git > /dev/null && declare -F _completion_loader > /dev/null; then
|
if ! _omb_util_function_exists _git && _omb_util_function_exists _completion_loader; then
|
||||||
_completion_loader git
|
_completion_loader git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check that git tab completion is available
|
# Check that git tab completion is available
|
||||||
if declare -F _git > /dev/null; then
|
if _omb_util_function_exists _git; then
|
||||||
# Duplicate and rename the 'list_all_commands' function
|
# Duplicate and rename the 'list_all_commands' function
|
||||||
eval "$(declare -f __git_list_all_commands | \
|
eval "$(declare -f __git_list_all_commands | \
|
||||||
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
|
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
function_exists()
|
function_exists()
|
||||||
{
|
{
|
||||||
declare -F $1 > /dev/null
|
_omb_util_function_exists $1
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -130,7 +130,7 @@ _packer_completion ()
|
|||||||
# Words containing an equal sign get split into tokens in bash > 4, which
|
# Words containing an equal sign get split into tokens in bash > 4, which
|
||||||
# doesn't come in handy here.
|
# doesn't come in handy here.
|
||||||
# This is handled here. bash < 4 does not split.
|
# This is handled here. bash < 4 does not split.
|
||||||
declare -f _get_comp_words_by_ref >/dev/null && _get_comp_words_by_ref -n = cur
|
_omb_util_function_exists _get_comp_words_by_ref && _get_comp_words_by_ref -n = cur
|
||||||
|
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
local i c=1 command
|
local i c=1 command
|
||||||
@@ -157,7 +157,7 @@ _packer_completion ()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local completion_func="__packer_${command}"
|
local completion_func="__packer_${command}"
|
||||||
declare -f $completion_func >/dev/null && $completion_func
|
_omb_util_function_exists $completion_func && $completion_func
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -o nospace -F _packer_completion packer
|
complete -o nospace -F _packer_completion packer
|
||||||
|
@@ -77,7 +77,7 @@ _omb_theme_PROMPT_COMMAND() {
|
|||||||
printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"
|
printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"
|
||||||
|
|
||||||
# Open the new terminal in the same directory
|
# Open the new terminal in the same directory
|
||||||
declare -f __vte_osc7 > /dev/null && __vte_osc7
|
_omb_util_function_exists __vte_osc7 && __vte_osc7
|
||||||
|
|
||||||
PS1="${_omb_prompt_reset_color}[${DULCIE_USER}@${DULCIE_HOST}$(scm_prompt_info)${_omb_prompt_reset_color} ${DULCIE_WORKINGDIR}]"
|
PS1="${_omb_prompt_reset_color}[${DULCIE_USER}@${DULCIE_HOST}$(scm_prompt_info)${_omb_prompt_reset_color} ${DULCIE_WORKINGDIR}]"
|
||||||
if [[ "${DULCIE_MULTILINE}" -eq "1" ]]; then
|
if [[ "${DULCIE_MULTILINE}" -eq "1" ]]; then
|
||||||
|
Reference in New Issue
Block a user