bartib/misc/bartibCompletion.sh
2021-11-08 22:01:54 +01:00

18 lines
368 B
Bash

#!/bin/bash
_bartib_completions()
{
local CWORD=${COMP_WORDS[COMP_CWORD]}
ALL_PROJECTS=`bartib projects`
local IFS=$'\n'
CANDIATE_PROJECTS=($(compgen -W "${ALL_PROJECTS[*]}" -- "$CWORD"))
if [ ${#CANDIATE_PROJECTS[*]} -eq 0 ]; then
COMPREPLY=()
else
COMPREPLY=($(printf "\"%s\"\n" "${CANDIATE_PROJECTS[@]}"))
fi
}
complete -F _bartib_completions bartib