mirror of
https://git.sr.ht/~leon_plickat/wlopm
synced 2024-12-25 13:08:21 +01:00
add bash completion
This commit is contained in:
parent
dffcf3d8fc
commit
54230d76e6
4
Makefile
4
Makefile
@ -3,6 +3,7 @@ SCANNER := wayland-scanner
|
|||||||
PREFIX=/usr/local
|
PREFIX=/usr/local
|
||||||
BINDIR=$(PREFIX)/bin
|
BINDIR=$(PREFIX)/bin
|
||||||
MANDIR=$(PREFIX)/share/man
|
MANDIR=$(PREFIX)/share/man
|
||||||
|
BASHCOMPDIR=$(PREFIX)/share/bash-completion/completions
|
||||||
|
|
||||||
CFLAGS+=-Wall -Werror -Wextra -Wpedantic -Wno-unused-parameter -Wconversion -Wformat-security -Wformat -Wsign-conversion -Wfloat-conversion -Wunused-result -Wno-strict-prototypes
|
CFLAGS+=-Wall -Werror -Wextra -Wpedantic -Wno-unused-parameter -Wconversion -Wformat-security -Wformat -Wsign-conversion -Wfloat-conversion -Wunused-result -Wno-strict-prototypes
|
||||||
LIBS=-lwayland-client
|
LIBS=-lwayland-client
|
||||||
@ -25,13 +26,14 @@ install: wlopm
|
|||||||
install wlopm $(DESTDIR)$(BINDIR)
|
install wlopm $(DESTDIR)$(BINDIR)
|
||||||
install -d $(DESTDIR)$(MANDIR)/man1
|
install -d $(DESTDIR)$(MANDIR)/man1
|
||||||
install -m 644 wlopm.1 $(DESTDIR)$(MANDIR)/man1
|
install -m 644 wlopm.1 $(DESTDIR)$(MANDIR)/man1
|
||||||
|
install bash-completion $(DESTDIR)$(BASHCOMPDIR)/wlopm
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
$(RM) $(DESTDIR)$(BINDIR)/wlopm
|
$(RM) $(DESTDIR)$(BINDIR)/wlopm
|
||||||
$(RM) $(DESTDIR)$(MANDIR)/man1/wlopm.1
|
$(RM) $(DESTDIR)$(MANDIR)/man1/wlopm.1
|
||||||
|
$(RM) $(DESTDIR)$(BASHCOMPDIR)/wlopm
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) wlopm $(GEN) $(OBJ)
|
$(RM) wlopm $(GEN) $(OBJ)
|
||||||
|
|
||||||
.PHONY: clean install
|
.PHONY: clean install
|
||||||
|
|
||||||
|
14
bash-completion
Normal file
14
bash-completion
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
function __wlopm_completion ()
|
||||||
|
{
|
||||||
|
case "${COMP_WORDS[-2]}" in
|
||||||
|
"--on"|"--off"|"--toggle")
|
||||||
|
OPTS="$(wlopm | cut -d' ' -f1 | tr '\n' ' ')"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
OPTS="-h --help -j --json -v --version --on --off --toggle"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[${COMP_CWORD}]}"))
|
||||||
|
}
|
||||||
|
complete -F __wlopm_completion wlopm
|
Loading…
Reference in New Issue
Block a user