removed command completion
This commit is contained in:
parent
15bd26f19b
commit
e7fc5934d5
25
Makefile
25
Makefile
|
@ -2,21 +2,6 @@ PREFIX ?= /usr/local
|
||||||
BINDIR ?= $(PREFIX)/bin
|
BINDIR ?= $(PREFIX)/bin
|
||||||
MANDIR ?= $(PREFIX)/share/man
|
MANDIR ?= $(PREFIX)/share/man
|
||||||
|
|
||||||
# Attempt to find bash completion dir in order of preference
|
|
||||||
ifneq ($(wildcard /etc/bash_completion.d/.),)
|
|
||||||
CPLDIR ?= /etc/bash_completion.d
|
|
||||||
endif
|
|
||||||
|
|
||||||
HAS_BREW := $(shell command -v brew 2> /dev/null)
|
|
||||||
ifdef HAS_BREW
|
|
||||||
CPLDIR ?= $$(brew --prefix)/etc/bash_completion.d
|
|
||||||
endif
|
|
||||||
|
|
||||||
HAS_PKGCONFIG := $(shell command -v pkg-config 2> /dev/null)
|
|
||||||
ifdef HAS_PKGCONFIG
|
|
||||||
CPLDIR ?= $$(pkg-config --variable=completionsdir bash-completion 2> /dev/null)
|
|
||||||
endif
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@echo Installing the executable to $(BINDIR)
|
@echo Installing the executable to $(BINDIR)
|
||||||
@mkdir -p $(BINDIR)
|
@mkdir -p $(BINDIR)
|
||||||
|
@ -26,21 +11,11 @@ install:
|
||||||
@mkdir -p $(MANDIR)/man1
|
@mkdir -p $(MANDIR)/man1
|
||||||
@cp -f todo.1 $(MANDIR)/man1/todo.1
|
@cp -f todo.1 $(MANDIR)/man1/todo.1
|
||||||
@chmod 644 $(MANDIR)/man1/todo.1
|
@chmod 644 $(MANDIR)/man1/todo.1
|
||||||
ifdef CPLDIR
|
|
||||||
@echo Installing the command completion to $(CPLDIR)
|
|
||||||
@mkdir -p $(CPLDIR)
|
|
||||||
@cp -f todo.d $(CPLDIR)/todo
|
|
||||||
@chmod 644 $(CPLDIR)/todo
|
|
||||||
endif
|
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
@echo Removing the executable from $(BINDIR)
|
@echo Removing the executable from $(BINDIR)
|
||||||
@rm -f $(BINDIR)/todo
|
@rm -f $(BINDIR)/todo
|
||||||
@echo Removing the manual page from $(MANDIR)/man1
|
@echo Removing the manual page from $(MANDIR)/man1
|
||||||
@rm -f $(BINDIR)/man1/todo.1
|
@rm -f $(BINDIR)/man1/todo.1
|
||||||
ifdef CPLDIR
|
|
||||||
@echo Removing the command completion from $(CPLDIR)
|
|
||||||
@rm -f $(CPLDIR)/todo
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: install uninstall
|
.PHONY: install uninstall
|
||||||
|
|
32
todo.d
32
todo.d
|
@ -1,32 +0,0 @@
|
||||||
_todo() {
|
|
||||||
local iter use cur
|
|
||||||
TODO="${TODO:-${HOME}/todo.txt}"
|
|
||||||
if printf "%s" "$TERM" | grep -Fq screen && test "$TMUX" ; then
|
|
||||||
sessname=$(tmux display -p '#S')
|
|
||||||
if printf "%s" "$sessname" | grep -Eq '^[+-]?[0-9]+$'; then
|
|
||||||
TODOFILE=$TODO
|
|
||||||
else
|
|
||||||
todopath=$(dirname "$TODO")
|
|
||||||
TODOFILE=$todopath/$sessname".txt"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
TODOFILE=$TODO
|
|
||||||
fi
|
|
||||||
cur=${COMP_WORDS[COMP_CWORD]}
|
|
||||||
use=$( awk '{gsub(/ /,"\\ ")}8' "$TODOFILE" )
|
|
||||||
use="${use//\\ /___}"
|
|
||||||
for iter in $use; do
|
|
||||||
if [[ $iter =~ ^$cur ]]; then
|
|
||||||
COMPREPLY+=( "${iter//___/ }" )
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Detect if current shell is ZSH, and if so, load this file in bash
|
|
||||||
# compatibility mode.
|
|
||||||
if [ -n "$ZSH_VERSION" ]; then
|
|
||||||
autoload bashcompinit
|
|
||||||
bashcompinit
|
|
||||||
fi
|
|
||||||
|
|
||||||
complete -o default -o nospace -F _todo todo
|
|
Loading…
Reference in New Issue