mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
fix: Fix quoting
Co-authored-by: Koichi Muarse <myoga.murase@gmail.com>
This commit is contained in:
committed by
Koichi Murase
parent
475a563280
commit
0c07172c02
@@ -43,10 +43,10 @@ complete -F _django_completion -o default django-admin.py manage.py django-admin
|
||||
_python_django_completion()
|
||||
{
|
||||
if [[ ${COMP_CWORD} -ge 2 ]]; then
|
||||
PYTHON_EXE=$( basename -- ${COMP_WORDS[0]} )
|
||||
PYTHON_EXE=$( basename -- "${COMP_WORDS[0]}" )
|
||||
echo $PYTHON_EXE | command grep -E "python([2-9]\.[0-9])?" >/dev/null 2>&1
|
||||
if [[ $? == 0 ]]; then
|
||||
PYTHON_SCRIPT=$( basename -- ${COMP_WORDS[1]} )
|
||||
PYTHON_SCRIPT=$( basename -- "${COMP_WORDS[1]}" )
|
||||
echo $PYTHON_SCRIPT | command grep -E "manage\.py|django-admin(\.py)?" >/dev/null 2>&1
|
||||
if [[ $? == 0 ]]; then
|
||||
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]:1}" \
|
||||
@@ -58,16 +58,16 @@ _python_django_completion()
|
||||
}
|
||||
|
||||
# Support for multiple interpreters.
|
||||
unset pythons
|
||||
unset -v pythons
|
||||
if _omb_util_command_exists whereis; then
|
||||
python_interpreters=$(whereis python | cut -d " " -f 2-)
|
||||
for python in $python_interpreters; do
|
||||
pythons="${pythons} $(basename -- $python)"
|
||||
_omb_util_split python_interpreters "$(whereis python | cut -d " " -f 2-)"
|
||||
pythons=()
|
||||
for python in "${python_interpreters[@]}"; do
|
||||
pythons+=("$(basename -- "$python")")
|
||||
done
|
||||
pythons=$(echo $pythons | tr " " "\n" | sort -u | tr "\n" " ")
|
||||
pythons=($(printf '%s\n' "${pythons[@]}" | sort -u))
|
||||
else
|
||||
pythons=python
|
||||
pythons=(python)
|
||||
fi
|
||||
|
||||
complete -F _python_django_completion -o default $pythons
|
||||
|
||||
complete -F _python_django_completion -o default "${pythons[@]}"
|
||||
|
@@ -200,7 +200,7 @@ EOF
|
||||
((c++))
|
||||
done
|
||||
if [ -z "$name" ]; then
|
||||
repo=$(basename "$(pwd)")
|
||||
repo=$(basename "$PWD")
|
||||
fi
|
||||
case "$prev" in
|
||||
-d|-h)
|
||||
|
@@ -202,7 +202,7 @@ EOF
|
||||
((c++))
|
||||
done
|
||||
if [ -z "$name" ]; then
|
||||
repo=$(basename "$(pwd)")
|
||||
repo=$(basename "$PWD")
|
||||
fi
|
||||
case "$prev" in
|
||||
-d|-h)
|
||||
|
@@ -83,9 +83,9 @@ function _vagrant {
|
||||
vagrant_state_file=$(__vagrantinvestigate) || return 1
|
||||
if [[ -f $vagrant_state_file ]]
|
||||
then
|
||||
running_vm_list=$(grep 'active' $vagrant_state_file | sed -e 's/"active"://' | tr ',' '\n' | cut -d '"' -f 2 | tr '\n' ' ')
|
||||
running_vm_list=$(grep 'active' "$vagrant_state_file" | sed -e 's/"active"://' | tr ',' '\n' | cut -d '"' -f 2 | tr '\n' ' ')
|
||||
else
|
||||
running_vm_list=$(find $vagrant_state_file -type f -name "id" | awk -F"/" '{print $(NF-2)}')
|
||||
running_vm_list=$(find "$vagrant_state_file" -type f -name "id" | awk -F"/" '{print $(NF-2)}')
|
||||
fi
|
||||
COMPREPLY=($(compgen -W "${running_vm_list}" -- ${cur}))
|
||||
return 0
|
||||
|
@@ -32,7 +32,7 @@ function _vault() {
|
||||
if [[ $prev =~ ^(policies|policy-write|policy-delete) ]]; then
|
||||
local policies=$(vault policies 2> /dev/null)
|
||||
COMPREPLY=($(compgen -W "$policies" -- $cur))
|
||||
elif [ "$(echo $line | wc -w)" -le 2 ]; then
|
||||
elif [ "$(echo "$line" | wc -w)" -le 2 ]; then
|
||||
if [[ "$line" =~ ^vault\ (read|write|delete|list)\ $ ]]; then
|
||||
COMPREPLY=($(compgen -W "$(_vault_mounts)" -- ''))
|
||||
else
|
||||
|
Reference in New Issue
Block a user