burrow command completion working

This commit is contained in:
James Tomasino 2018-01-20 15:20:25 -05:00
parent 5b835cab8c
commit be30f4ab06
3 changed files with 17 additions and 13 deletions

View File

@ -1,7 +1,7 @@
PREFIX ?= /usr PREFIX ?= /usr
BINDIR ?= $(PREFIX)/bin BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man MANDIR ?= $(PREFIX)/share/man
CPLDIR ?= /etc/bash_completion.d CPLDIR ?= $$(pkg-config --variable=completionsdir bash-completion)
install: install:
@echo Installing the executable to $(DESTDIR)$(BINDIR) @echo Installing the executable to $(DESTDIR)$(BINDIR)
@ -13,8 +13,8 @@ install:
@cp -f burrow.1 $(DESTDIR)$(MANDIR)/man1/burrow.1 @cp -f burrow.1 $(DESTDIR)$(MANDIR)/man1/burrow.1
@chmod 644 $(DESTDIR)$(MANDIR)/man1/burrow.1 @chmod 644 $(DESTDIR)$(MANDIR)/man1/burrow.1
@echo Installing the command completion to $(DESTDIR)$(CPLDIR) @echo Installing the command completion to $(DESTDIR)$(CPLDIR)
@cp -f burrow.d $(DESTDIR)$(CPLDIR)/burrow.d @cp -f burrow.d $(DESTDIR)$(CPLDIR)/burrow
@chmod 644 $(DESTDIR)$(CPLDIR)/burrow.d @chmod 644 $(DESTDIR)$(CPLDIR)/burrow
uninstall: uninstall:
@echo Removing the executable from $(DESTDIR)$(BINDIR) @echo Removing the executable from $(DESTDIR)$(BINDIR)
@ -22,6 +22,6 @@ uninstall:
@echo Removing the manual page from $(DESTDIR)$(MANDIR)/man1 @echo Removing the manual page from $(DESTDIR)$(MANDIR)/man1
@rm -f $(DESTDIR)$(BINDIR)/man1/burrow.1 @rm -f $(DESTDIR)$(BINDIR)/man1/burrow.1
@echo Removing the command completion from $(DESTDIR)$(CPLDIR) @echo Removing the command completion from $(DESTDIR)$(CPLDIR)
@rm -f $(DESTDIR)$(CPLDIR)/burrow.d @rm -f $(DESTDIR)$(CPLDIR)/burrow
.PHONY: install uninstall .PHONY: install uninstall

4
burrow
View File

@ -75,6 +75,10 @@ function parseargs() {
show_help show_help
exit 0 exit 0
;; ;;
"SHORTLIST")
echo "phlog recipe create-config update-git"
exit 0
;;
"PHLOG") arg_phlog=1 ;; "PHLOG") arg_phlog=1 ;;
"RECIPE") arg_recipe=1 ;; "RECIPE") arg_recipe=1 ;;
"CREATE-CONFIG") arg_create_config=1 ;; "CREATE-CONFIG") arg_create_config=1 ;;

View File

@ -1,14 +1,14 @@
#!/usr/bin/env bash
_burrow() _burrow()
{ {
local cur prev opts # Get basic autocomplete commands from the function itself
COMPREPLY=() local helplist
cur="${COMP_WORDS[COMP_CWORD]}" helplist=$(burrow shortlist)
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="phlog recipe create-config update-git -v -h"
if [[ ${cur} == -* ]] ; then # Combine all the lists for autocomplete
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) local cur
return 0 cur=${COMP_WORDS[COMP_CWORD]}
fi COMPREPLY=( $( compgen -W "$helplist" -- "$cur" ) )
} }
complete -F _burrow burrow complete -F _burrow burrow