Skip to content

Commit

Permalink
Fix tab completion of directories and filenames (spack#3184)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart authored and diaena committed May 26, 2017
1 parent 00afc38 commit 9c166d7
Showing 1 changed file with 11 additions and 35 deletions.
46 changes: 11 additions & 35 deletions share/spack/spack-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ function _spack_bootstrap {
if $list_options
then
compgen -W "-h --help -r --remote" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}

Expand Down Expand Up @@ -192,8 +190,6 @@ function _spack_compiler_add {
if $list_options
then
compgen -W "-h --help --scope" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}

Expand Down Expand Up @@ -375,8 +371,6 @@ function _spack_flake8 {
then
compgen -W "-h --help -k --keep-temp -o --output
-r --root-relative -U --no-untracked" -- "$cur"
else
compgen -o filenames -- "$cur"
fi
}

Expand Down Expand Up @@ -452,8 +446,6 @@ function _spack_md5 {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -o filenames -- "$cur"
fi
}

Expand All @@ -470,8 +462,6 @@ function _spack_mirror_add {
if $list_options
then
compgen -W "-h --help --scope" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}

Expand Down Expand Up @@ -613,8 +603,6 @@ function _spack_python {
if $list_options
then
compgen -W "-h --help -c" -- "$cur"
else
compgen -o filenames -- "$cur"
fi
}

Expand All @@ -635,17 +623,13 @@ function _spack_repo_add {
if $list_options
then
compgen -W "-h --help --scope" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}

function _spack_repo_create {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}

Expand Down Expand Up @@ -813,17 +797,13 @@ function _spack_view_hardlink {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}

function _spack_view_remove {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}

Expand All @@ -841,8 +821,6 @@ function _spack_view_statlink {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}

Expand All @@ -855,8 +833,6 @@ function _spack_view_symlink {
if $list_options
then
compgen -W "-h --help" -- "$cur"
else
compgen -o dirnames -- "$cur"
fi
}

Expand Down Expand Up @@ -894,18 +870,18 @@ function _tests {
# Testing functions

function _test_vars {
echo "-----------------------------------------------------" >> temp
echo "Full line: '$COMP_LINE'" >> temp
echo >> temp
echo "-----------------------------------------------------" >> temp
echo "Full line: '$COMP_LINE'" >> temp
echo >> temp
echo "Word list w/ flags: $(_pretty_print COMP_WORDS[@])" >> temp
echo "# words w/ flags: '${#COMP_WORDS[@]}'" >> temp
echo "Cursor index w/ flags: '$COMP_CWORD'" >> temp
echo >> temp
echo "# words w/ flags: '${#COMP_WORDS[@]}'" >> temp
echo "Cursor index w/ flags: '$COMP_CWORD'" >> temp
echo >> temp
echo "Word list w/out flags: $(_pretty_print COMP_WORDS_NO_FLAGS[@])" >> temp
echo "# words w/out flags: '${#COMP_WORDS_NO_FLAGS[@]}'" >> temp
echo "Cursor index w/out flags: '$COMP_CWORD_NO_FLAGS'" >> temp
echo >> temp
echo "Subfunction: '$subfunction'" >> temp
echo "# words w/out flags: '${#COMP_WORDS_NO_FLAGS[@]}'" >> temp
echo "Cursor index w/out flags: '$COMP_CWORD_NO_FLAGS'" >> temp
echo >> temp
echo "Subfunction: '$subfunction'" >> temp
if $list_options
then
echo "List options: 'True'" >> temp
Expand All @@ -929,4 +905,4 @@ function _pretty_print {
done
}

complete -F _bash_completion_spack spack
complete -o default -F _bash_completion_spack spack

0 comments on commit 9c166d7

Please sign in to comment.