diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-11-27 00:22:29 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-11-27 00:22:29 +0100 |
commit | adc39b533a8d1215205a2f3fba1e12d9c313ab5f (patch) | |
tree | a5abf1fca361e638adf40bfd810e648aa9c73eca | |
parent | m doc (diff) | |
download | adjbacklight-adc39b533a8d1215205a2f3fba1e12d9c313ab5f.tar.gz adjbacklight-adc39b533a8d1215205a2f3fba1e12d9c313ab5f.tar.bz2 adjbacklight-adc39b533a8d1215205a2f3fba1e12d9c313ab5f.tar.xz |
add shell tab-completion
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | Makefile | 62 | ||||
-rw-r--r-- | src/adjbacklight.auto-completion | 19 |
2 files changed, 71 insertions, 10 deletions
@@ -43,10 +43,10 @@ WARN = -Wall -Wextra -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include # compile the package .PHONY: default -default: code info +default: code info shell .PHONY: all -all: code doc +all: code doc shell .PHONY: code code: bin/adjbacklight @@ -89,13 +89,34 @@ bin/%.ps: $(MANUALDIR)%.texinfo cd obj/ps && texi2pdf --ps ../../"$<" < /dev/null mv obj/ps/$*.ps $@ +.PHONY: shell +shell: bash fish zsh + +.PHONY: bash +bash: adjbacklight.bash-completion + +.PHONY: fish +fish: adjbacklight.fish-completion + +.PHONY: zsh +zsh: adjbacklight.zsh-completion + +obj/adjbacklight.auto-completion: src/adjbacklight.auto-completion + @mkdir -p obj + cp "$<" "$@" + sed -i 's/^(adjbacklight$$/($(COMMAND)/' "$@" + +bin/adjbacklight.%sh-completion: obj/adjbacklight.auto-completion + @mkdir -p bin + auto-auto-complete "$*sh" --output "$@" --source "$<" + # install to system .PHONY: install -install: install-base install-info +install: install-base install-info install-shell .PHONY: install-all -install-all: install-base install-doc +install-all: install-base install-doc install-shell .PHONY: install-base install-base: install-cmd install-copyright @@ -110,12 +131,12 @@ install-copyright: install-copying install-license .PHONY: install-copying install-copying: - install -d -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + install -dm755 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" install -m644 -- COPYING "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" .PHONY: install-license install-license: - install -d -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + install -dm755 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" install -m644 -- LICENSE "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" .PHONY: install-doc @@ -123,24 +144,42 @@ install-doc: install-info install-pdf install-dvi install-ps .PHONY: install-info install-info: bin/$(MANUAL).info - install -d -- "$(DESTDIR)$(INFODIR)" + install -dm755 -- "$(DESTDIR)$(INFODIR)" install -m644 -- "$<" "$(DESTDIR)$(INFODIR)/$(PKGNAME).info" .PHONY: install-pdf install-pdf: bin/$(MANUAL).pdf - install -d -- "$(DESTDIR)$(DOCDIR)" + install -dm755 -- "$(DESTDIR)$(DOCDIR)" install -m644 -- "$<" "$(DESTDIR)$(DOCDIR)/$(PKGNAME).pdf" .PHONY: install-dvi install-dvi: bin/$(MANUAL).dvi - install -d -- "$(DESTDIR)$(DOCDIR)" + install -dm755 -- "$(DESTDIR)$(DOCDIR)" install -m644 -- "$<" "$(DESTDIR)$(DOCDIR)/$(PKGNAME).dvi" .PHONY: install-ps install-ps: bin/$(MANUAL).ps - install -d -- "$(DESTDIR)$(DOCDIR)" + install -dm755 -- "$(DESTDIR)$(DOCDIR)" install -m644 -- "$<" "$(DESTDIR)$(DOCDIR)/$(PKGNAME).ps" +.PHONY: install-shell +install-shell: install-bash install-fish install-zsh + +.PHONY: install-bash +install-bash: bin/adjbacklight.bash-completion + install -dm755 -- "$(DESTDIR)$(DATADIR)/bash-completion/completions" + install -m644 "$<" -- "$(DESTDIR)$(DATADIR)/bash-completion/completions/$(COMMAND)" + +.PHONY: install-fish +install-fish: bin/adjbacklight.fish-completion + install -dm755 -- "$(DESTDIR)$(DATADIR)/fish/completions" + install -m644 "$<" -- "$(DESTDIR)$(DATADIR)/fish/completions/$(COMMAND).fish" + +.PHONY: install-zsh +install-zsh: bin/adjbacklight.zsh-completion + install -dm755 -- "$(DESTDIR)$(DATADIR)/zsh/site-functions)" + install -m644 "$<" -- "$(DESTDIR)$(DATADIR)/zsh/site-functions/_$(COMMAND)" + # remove files created by `install` .PHONY: uninstall @@ -153,6 +192,9 @@ uninstall: -rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).pdf" -rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).dvi" -rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).ps" + -rm -- "$(DESTDIR)$(DATADIR)/bash-completion/completions/$(COMMAND)" + -rm -- "$(DESTDIR)$(DATADIR)/fish/completions/$(COMMAND).fish" + -rm -- "$(DESTDIR)$(DATADIR)/zsh/site-functions/_$(COMMAND)" # remove files created by `all` diff --git a/src/adjbacklight.auto-completion b/src/adjbacklight.auto-completion new file mode 100644 index 0000000..aca9796 --- /dev/null +++ b/src/adjbacklight.auto-completion @@ -0,0 +1,19 @@ +(adjbacklight + (default (arg '(+|-|=)LEVEL[%|%%]') (files -0) (description 'Adjust backlight')) + + (unargumented (options -c --copyright --copying) (complete --copying) + (desc 'Display copyright information')) + + (unargumented (options -w --warranty) (complete --warranty) + (desc 'Display warranty disclaimer')) + + (unargumented (options -a --all) (complete --all) + (desc 'Run for all devices, including ACPI devices')) + + (unargumented (options -g --get) (complete --get) + (desc 'Get average brightness on devices')) + + (argumented (options -s --set) (complete --set) (files 'LEVEL[%]') (files -0) + (desc 'Set brightness on devices')) +) + |