From 844e0cd22c9623c566871d2ecb9c50831e2524ba Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 21 Feb 2014 00:51:47 +0100 Subject: fix make uninstall rule + add shell auto completion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- .gitignore | 1 + DEPENDENCIES | 1 + Makefile | 64 +++++++++++++++++++++++++++++++++++++----- completion | 20 +++++++++++++ dist/archlinux/stable/PKGBUILD | 6 ++-- src/__main__.py | 2 +- 6 files changed, 83 insertions(+), 11 deletions(-) create mode 100644 completion diff --git a/.gitignore b/.gitignore index 8c80f61..a978561 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,5 @@ __pycache__/ *.gz *.bz2 *.xz +/blueshift.*sh diff --git a/DEPENDENCIES b/DEPENDENCIES index 61baa53..6e8c675 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -16,4 +16,5 @@ MAKE DEPENDENCIES: sed zip texinfo (opt-out) + auto-auto-complete (opt-out) diff --git a/Makefile b/Makefile index 938f8da..2f68dab 100644 --- a/Makefile +++ b/Makefile @@ -33,10 +33,10 @@ EXAMPLES = comprehensive sleepmode .PHONY: default -default: command info +default: command info shell .PHONY: all -all: command doc +all: command doc shell .PHONY: doc doc: info pdf dvi ps @@ -56,6 +56,18 @@ ps: blueshift.ps .PHONY: command command: bin/blueshift_randr.so bin/blueshift +.PHONY: shell +shell: bash zsh fish + +.PHONY: bash +bash: blueshift.bash + +.PHONY: zsh +zsh: blueshift.zsh + +.PHONY: fish +fish: blueshift.fish + bin/blueshift: obj/blueshift.zip echo '#!/usr/bin/python3' > $@ @@ -109,12 +121,22 @@ obj/blueshift_randr.c: src/blueshift_randr.pyx mv obj/$@ $@ +blueshift.bash: completion + auto-auto-complete bash --output $@ --source $< + +blueshift.zsh: completion + auto-auto-complete zsh --output $@ --source $< + +blueshift.fish: completion + auto-auto-complete fish --output $@ --source $< + + .PHONY: install -install: install-base install-info install-examples +install: install-base install-info install-examples install-shell .PHONY: install -install-all: install-base install-doc +install-all: install-base install-doc install-shell .PHONY: install-base install-base: install-command install-license @@ -161,11 +183,29 @@ install-dvi: blueshift.dvi install -dm755 -- "$(DESTDIR)$(DOCDIR)" install -m644 $< -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).dvi" +.PHONY: install-shell +install-shell: install-bash install-zsh install-fish + +.PHONY: install-bash +install-bash: blueshift.bash + install -dm755 -- "$(DESTDIR)$(DATADIR)/bash-completion/completions" + install -m644 $< -- "$(DESTDIR)$(DATADIR)/bash-completion/completions/$(COMMAND)" + +.PHONY: install-zsh +install-zsh: blueshift.zsh + install -dm755 -- "$(DESTDIR)$(DATADIR)/zsh/site-functions" + install -m644 $< -- "$(DESTDIR)$(DATADIR)/zsh/site-functions/_$(COMMAND)" + +.PHONY: install-fish +install-fish: blueshift.fish + install -dm755 -- "$(DESTDIR)$(DATADIR)/fish/completions" + install -m644 $< -- "$(DESTDIR)$(DATADIR)/fish/completions/$(COMMAND).fish" + .PHONY: uninstall uninstall: - -rm --"$(DESTDIR)$(BINDIR)/$(COMMAND)" - -rm --"$(DESTDIR)$(LIBDIR)/blueshift_randr.so" + -rm -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" + -rm -- "$(DESTDIR)$(LIBDIR)/blueshift_randr.so" -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE" -rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" @@ -173,13 +213,23 @@ uninstall: -rmdir -- "$(DESTDIR)$(DATADIR)/$(PKGNAME)" -rm -- $(foreach E,$(EXAMPLES),"$(DESTDIR)$(DOCDIR)/$(PKGNAME)/examples/$(E)") -rmdir -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME)/examples" + -rmdir -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME)" -rm -- "$(DESTDIR)$(INFODIR)/$(PKGNAME).info" -rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).pdf" -rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).ps" -rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).dvi" + -rm -- "$(DESTDIR)$(DATADIR)/fish/completions/$(COMMAND).fish" + -rmdir -- "$(DESTDIR)$(DATADIR)/fish/completions" + -rmdir -- "$(DESTDIR)$(DATADIR)/fish" + -rm -- "$(DESTDIR)$(DATADIR)/zsh/site-functions/_$(COMMAND)" + -rmdir -- "$(DESTDIR)$(DATADIR)/zsh/site-functions" + -rmdir -- "$(DESTDIR)$(DATADIR)/zsh" + -rm -- "$(DESTDIR)$(DATADIR)/bash-completion/completions/$(COMMAND)" + -rmdir -- "$(DESTDIR)$(DATADIR)/bash-completion/completions" + -rmdir -- "$(DESTDIR)$(DATADIR)/bash-completion" .PHONY: all clean: - -rm -r bin obj src/blueshift_randr.c + -rm -r bin obj src/blueshift_randr.c blueshift.{ba,z,fi}sh diff --git a/completion b/completion new file mode 100644 index 0000000..e63d1af --- /dev/null +++ b/completion @@ -0,0 +1,20 @@ +(blueshift + (multiple unargumented + ((options -p --panic-gate --panicgate) (complete --panicgate) (desc 'Applies the settings directly instead of transitioning into the initial settings')) + ((options -h -? --help) (complete --help) (desc 'Prints help information')) + ((options -C --copying --copyright) (complete --copyright) (desc 'Prints copyright information')) + ((options -W --warranty) (complete --warranty) (desc 'Prints non-warranty information')) + ((options -v --version) (complete --version) (desc 'Prints the name version of the program')) + ((options -r --reset) (complete --reset) (desc 'Transition from the specified settings to clean settings')) + ) + (multiple argumented + ((options -c --configurations) (complete --configurations) (arg SCRIPT) (files -f) (desc 'Select configuration script')) + ((options -g --gamma) (complete --gamma) (arg RGB|R:G:B) (files -0) (desc 'Apply gamma correction to the colour curves')) + ((options -b --brightness) (complete --brightness) (arg RGB|R:G:B) (files -0) (desc 'Change brightness using sRGB')) + ((options +b ++brightness) (complete ++brightness) (arg Y) (files -0) (desc 'Change brightness using CIE xyY')) + ((options -t --temperature) (complete --temperature) (arg KELVIN) (files -0) (desc 'Change colour temperature')) + ((options -l --location) (complete --location) (arg LAT:LON) (files -0) (desc 'Specify your geographical location')) + ((options -o --output --crtc) (complete --output) (arg CRTC) (files -0) (desc 'Select CRTC to apply changes to')) + ) +) + diff --git a/dist/archlinux/stable/PKGBUILD b/dist/archlinux/stable/PKGBUILD index 692a0bf..0d1ee63 100644 --- a/dist/archlinux/stable/PKGBUILD +++ b/dist/archlinux/stable/PKGBUILD @@ -1,14 +1,14 @@ # Maintainer: Mattias Andrée <`base64 -d`(bWFhbmRyZWUK)@member.fsf.org> pkgname=blueshift -pkgver=1.1 -pkgrel=2 +pkgver=1.2 +pkgrel=1 pkgdesc="An extensible and highly configurable alternative to redshift" arch=(i686 x86_64) url="https://github.com/maandree/blueshift" license=('AGPL3') depends=(python3 libxcb argparser) -makedepends=(cython gcc python3 libxcb make coreutils sed zip texinfo) +makedepends=(cython gcc python3 libxcb make coreutils sed zip texinfo auto-auto-complete) install=blueshift.install source=($url/archive/$pkgver.tar.gz) sha256sums=('3bd0dba02dea122d6982653054a87daea1ea3cfef6b08ccf3444e64d09a5fcbc') diff --git a/src/__main__.py b/src/__main__.py index 405bd76..0d22f77 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -25,7 +25,7 @@ from argparser import * PROGRAM_NAME = 'blueshift' -PROGRAM_VERSION = '1.1' +PROGRAM_VERSION = '1.2' ## Set global variables -- cgit v1.2.3-70-g09d2