Skip to content

Commit

Permalink
Auto-completion #75 : expect-based test for auto-completion
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Feb 11, 2022
1 parent 33943d5 commit e779160
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ _makesure_completions() {
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD - 1]}"
cnt="${#COMP_WORDS[@]}"
#echo ">> $cur :: $prev :: $COMP_CWORD"

# DONE auto-complete goals
# DONE auto-complete options
# DONE auto-complete goals from correct file (-f)

if [[ "$prev" == '-f' || "$prev" == '--file' ]]
then
Expand All @@ -20,19 +15,13 @@ _makesure_completions() {

# before we scan for targets, see if a Makesurefile name was
# specified with -f/--file
for ((i = 1; i < ${#COMP_WORDS[@]}; i++)); do
for ((i = 1; i < cnt; i++)); do
if [[ ${COMP_WORDS[i]} == '-f' || ${COMP_WORDS[i]} == '--file' ]]; then
# eval for tilde expansion
# echo
# printf 'f=%s\n' "${COMP_WORDS[i + 1]}"
eval "makesurefile=${COMP_WORDS[i + 1]}"
break
fi
done

# echo
# echo "makesurefile=$makesurefile"

COMPREPLY=($(compgen -W "$(./makesure --file "$makesurefile" -la | awk -F: '
BEGIN {
print "-f --file"
Expand Down

0 comments on commit e779160

Please sign in to comment.