Commit 469277cc authored by Vitaly Lipatov's avatar Vitaly Lipatov

add initial epm bash completion

parent 69f74989
......@@ -29,6 +29,7 @@ install_common:
mkdir -p $(DESTDIR)$(sysconfdir)/bash_completion.d/
install -m 0644 bash_completion/serv $(DESTDIR)$(sysconfdir)/bash_completion.d/serv
install -m 0644 bash_completion/eepm $(DESTDIR)$(sysconfdir)/bash_completion.d/eepm
# shebang.req.files
chmod a+x $(DESTDIR)$(pkgdatadir)/serv-*
......
# eepm(8) completion
# This completes on a list of all available services for the
# 'serv' command, followed by that script's available commands
#
__eepm_list_commands()
{
COMPREPLY=( $(echo "install remove") )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
}
__eepm_list_available_packages()
{
COMPREPLY=( $( cat /var/lib/eepm/available-packages 2>/dev/null ) )
#local USLIST=$(serv ${prev##*/} usage 2>/dev/null | sed -e "y/|/ /" -ne "s/^.*\(u\|U\|msg_u\)sage.*{\(.*\)}.*$/\2/p")
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
#COMPREPLY=( $( compgen -W '$USLIST' -- "$cur" ) )
}
__eepm()
{
local cur prev
COMPREPLY=()
_get_comp_words_by_ref cur prev
[[ ${COMP_WORDS[0]} != "epm" ]] && return 0
# don't complete past 2nd token
#[ $COMP_CWORD -gt 2 ] && return 0
if [[ $COMP_CWORD -eq 1 && $prev == "epm" ]]; then
__eepm_list_commands
return 0
fi
if [[ $COMP_CWORD -eq 2 && $prev == "install" ]]; then
__eepm_list_available_packages
return 0
fi
if [[ $COMP_CWORD -eq 2 && $prev == "remove" ]]; then
__eepm_list_available_packages
return 0
fi
return 0
} &&
complete -F __eepm epm
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment