Added a basic BASH tab-completion file to expose Tux Paint command-line options.

This commit is contained in:
William Kendrick 2009-09-09 19:16:40 +00:00
parent b9cdca070c
commit e5a5b22b89
3 changed files with 94 additions and 2 deletions

View file

@ -4,7 +4,7 @@
# bill@newbreedsoftware.com # bill@newbreedsoftware.com
# http://www.tuxpaint.org/ # http://www.tuxpaint.org/
# June 14, 2002 - July 1, 2009 # June 14, 2002 - September 9, 2009
# The version number, for release: # The version number, for release:
@ -129,6 +129,8 @@ DEVDOC_PREFIX:=$(DESTDIR)$(PREFIX)/share/doc/tuxpaint-dev
MAN_PREFIX:=$(DESTDIR)$(PREFIX)/share/man MAN_PREFIX:=$(DESTDIR)$(PREFIX)/share/man
DEVMAN_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: # 'System-wide' Config file:
ifeq ($(PREFIX),/usr) 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-icon install-gettext install-im install-importscript \
install-default-config install-example-stamps \ install-default-config install-example-stamps \
install-example-starters \ install-example-starters \
install-bash-completion \
$(ARCH_INSTALL) $(ARCH_INSTALL)
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@ -468,6 +471,7 @@ bdist-win32:
LOCALE_PREFIX:=locale \ LOCALE_PREFIX:=locale \
IM_PREFIX:=im \ IM_PREFIX:=im \
CONFDIR:=. \ CONFDIR:=. \
COMPLETIONDIR:=. \
INCLUDE_PREFIX:=plugins/include \ INCLUDE_PREFIX:=plugins/include \
MAGIC_PREFIX:=plugins MAGIC_PREFIX:=plugins
strip -s tuxpaint.exe strip -s tuxpaint.exe
@ -479,6 +483,7 @@ bdist-win32:
LOCALE_PREFIX:=./win32/bdist/locale \ LOCALE_PREFIX:=./win32/bdist/locale \
IM_PREFIX:=./win32/bdist/im \ IM_PREFIX:=./win32/bdist/im \
CONFDIR:=./win32/bdist \ CONFDIR:=./win32/bdist \
COMPLETIONDIR:=./win32/bdist \
INCLUDE_PREFIX:=./win32/bdist/plugins/include \ INCLUDE_PREFIX:=./win32/bdist/plugins/include \
MAGIC_PREFIX:=./win32/bdist/plugins \ MAGIC_PREFIX:=./win32/bdist/plugins \
windows_ARCH_INSTALL:=install-dlls windows_ARCH_INSTALL:=install-dlls
@ -545,6 +550,7 @@ uninstall: uninstall-i18n
-rm $(MAN_PREFIX)/man1/tuxpaint-import.1.gz -rm $(MAN_PREFIX)/man1/tuxpaint-import.1.gz
-rm $(MAN_PREFIX)/man1/tp-magic-config.1.gz -rm $(MAN_PREFIX)/man1/tp-magic-config.1.gz
-rm -f -r $(CONFDIR) -rm -f -r $(CONFDIR)
-rm $(COMPLETIONDIR)/tuxpaint-completion.bash
-rm -r $(MAGIC_PREFIX) -rm -r $(MAGIC_PREFIX)
-rm -r $(INCLUDE_PREFIX)/tuxpaint -rm -r $(INCLUDE_PREFIX)/tuxpaint
-rm $(BIN_PREFIX)/tp-magic-config -rm $(BIN_PREFIX)/tp-magic-config
@ -560,6 +566,15 @@ install-default-config:
@cp src/tuxpaint.conf $(CONFDIR) @cp src/tuxpaint.conf $(CONFDIR)
@chmod 644 $(CONFDIR)/tuxpaint.conf @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 # Install example stamps
.PHONY: install-example-stamps .PHONY: install-example-stamps

View file

@ -8,7 +8,7 @@ http://www.tuxpaint.org/
$Id$ $Id$
2009.September.1 (0.9.22) 2009.September.9 (0.9.22)
* New Magic Tools: * New Magic Tools:
---------------- ----------------
* Blinds - Close window blinds over your picture. * Blinds - Close window blinds over your picture.
@ -44,6 +44,11 @@ $Id$
sans glitches.) sans glitches.)
(SF.net bug #2837177) (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: * New Starters:
------------- -------------
* Elephant * Elephant

View file

@ -0,0 +1,72 @@
# tuxpaint(1) completion
# put this file in /etc/bash_completion.d/
# Bill Kendrick <bill@newbreedsoftware.com>; 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