diff --git a/Makefile b/Makefile index b09ffe679..534e7f7ea 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ # bill@newbreedsoftware.com # http://www.tuxpaint.org/ -# June 14, 2002 - July 1, 2009 +# June 14, 2002 - September 9, 2009 # The version number, for release: @@ -129,6 +129,8 @@ DEVDOC_PREFIX:=$(DESTDIR)$(PREFIX)/share/doc/tuxpaint-dev MAN_PREFIX:=$(DESTDIR)$(PREFIX)/share/man DEVMAN_PREFIX:=$(DESTDIR)$(PREFIX)/share/man +# BASH tab-completion file: +COMPLETIONDIR:=$(DESTDIR)/etc/bash_completion.d # 'System-wide' Config file: ifeq ($(PREFIX),/usr) @@ -406,6 +408,7 @@ install: install-bin install-data install-man install-doc \ install-icon install-gettext install-im install-importscript \ install-default-config install-example-stamps \ install-example-starters \ + install-bash-completion \ $(ARCH_INSTALL) @echo @echo "--------------------------------------------------------------" @@ -468,6 +471,7 @@ bdist-win32: LOCALE_PREFIX:=locale \ IM_PREFIX:=im \ CONFDIR:=. \ + COMPLETIONDIR:=. \ INCLUDE_PREFIX:=plugins/include \ MAGIC_PREFIX:=plugins strip -s tuxpaint.exe @@ -479,6 +483,7 @@ bdist-win32: LOCALE_PREFIX:=./win32/bdist/locale \ IM_PREFIX:=./win32/bdist/im \ CONFDIR:=./win32/bdist \ + COMPLETIONDIR:=./win32/bdist \ INCLUDE_PREFIX:=./win32/bdist/plugins/include \ MAGIC_PREFIX:=./win32/bdist/plugins \ windows_ARCH_INSTALL:=install-dlls @@ -545,6 +550,7 @@ uninstall: uninstall-i18n -rm $(MAN_PREFIX)/man1/tuxpaint-import.1.gz -rm $(MAN_PREFIX)/man1/tp-magic-config.1.gz -rm -f -r $(CONFDIR) + -rm $(COMPLETIONDIR)/tuxpaint-completion.bash -rm -r $(MAGIC_PREFIX) -rm -r $(INCLUDE_PREFIX)/tuxpaint -rm $(BIN_PREFIX)/tp-magic-config @@ -560,6 +566,15 @@ install-default-config: @cp src/tuxpaint.conf $(CONFDIR) @chmod 644 $(CONFDIR)/tuxpaint.conf +# Install BASH completion file: +.PHONY: install-bash-completion +install-bash-completion: + @echo + @echo "...Installing BASH completion file..." + @install -d $(COMPLETIONDIR) + @cp src/tuxpaint-completion.bash $(COMPLETIONDIR) + @chmod 644 $(COMPLETIONDIR)/tuxpaint-completion.bash + # Install example stamps .PHONY: install-example-stamps diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index de98b10f1..92aec9d7f 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -8,7 +8,7 @@ http://www.tuxpaint.org/ $Id$ -2009.September.1 (0.9.22) +2009.September.9 (0.9.22) * New Magic Tools: ---------------- * Blinds - Close window blinds over your picture. @@ -44,6 +44,11 @@ $Id$ sans glitches.) (SF.net bug #2837177) + * Created a BASH tab-completion file for Tux Paint, so that + command-line options are easier to discover (without necessarily + needing to consult the man page, 'Options' documentation, or --usage + output). + * New Starters: ------------- * Elephant diff --git a/src/tuxpaint-completion.bash b/src/tuxpaint-completion.bash new file mode 100644 index 000000000..61a779685 --- /dev/null +++ b/src/tuxpaint-completion.bash @@ -0,0 +1,72 @@ +# tuxpaint(1) completion +# put this file in /etc/bash_completion.d/ +# Bill Kendrick ; http://www.tuxpaint.org/ +# Based on inkscape's completion file, by allali@univ-mlv.fr +# +# $Id$ + +# FIXME: See http://www.debian-administration.org/articles/316 for an intro +# to how we should be doing this... -bjk 2009.09.09 + +have tuxpaint && +_tuxpaint() +{ + local cur + + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '\ + -h --help \ + -v --version -vv --version-verbose \ + -c --copying \ + -u --usage \ + -w --windowed -f --fullscreen \ + --native \ + --disablescreensaver --allowscreensaver \ + --orient=landscape --orient=portrait \ + -b --startblank --startlast \ + --sound -q --nosound \ + -x --noquit --quit + -p --print --noprint \ + --complexshapes -s --simpleshapes \ + -m --mixedcase -u --uppercase \ + --fancycursors --nofancycursors \ + --hidecursor --showcursor \ + --mouse --keyboard \ + --dontgrab --grab \ + --noshortcuts --shortcuts \ + --wheelmouse --nowheelmouse \ + --nobuttondistinction --buttondistinction \ + --outlines --nooutlines \ + --stamps --nostamps \ + --sysfonts --nosysfonts \ + --nostampcontrols --stampcontrols \ + --nomagiccontrols --magiccontrols \ + --mirrorstamps --dontmirrorstamps \ + --stampsize=0 --stampsize=1 \ + --stampsize=2 --stampsize=3 \ + --stampsize=4 --stampsize=5 \ + --stampsize=6 --stampsize=7 \ + --stampsize=8 --stampsize=9 --stampsize=default \ + --saveoverask --saveover --saveovernew \ + --nosave --save \ + --autosave --noautosave \ + --savedir --datadir \ + --printdelay= \ + --altprintmod --altprintalways --altprintnever \ + --papersize \ + -l --lang -L --locale \ + --nosysconfig \ + --nolockfile \ + --colorfile' -- $cur ) ) +# We don't accept filenames on the command-line yet -bjk 2009.09.09 +# else +# _filedir '@(ai|ani|bmp|cur|dia|eps|gif|ggr|ico|jpe|jpeg|jpg|pbm|pcx|pdf|pgm|png|ppm|pnm|ps|ras|sk|svg|svgz|targa|tga|tif|tiff|txt|wbmp|wmf|xbm|xpm)' +# +# FIXME: Allwo tab completion to show options after --lang (though may need to add support for --lang= for that to work?) -bjk 2009.09.09 + fi + +} +[ "${have:-}" ] && complete -F _tuxpaint $filenames tuxpaint