From cd38ae3915090efeed7426c4a2bab2fa6d376fbe Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 29 Oct 2012 00:34:29 +0100 Subject: files parameter for options --- example | 52 +++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/example b/example index 79151ec..7feb8e4 100644 --- a/example +++ b/example @@ -1,34 +1,36 @@ (ponysay (multiple unargumented - ((options -h --help) (complete --help) (desc 'Show summary of options')) - ((options -v --version) (complete --version) (desc 'Show version of program')) - ((options -c --compress) (complete --compress) (desc 'Compress message')) - ((options -l --list) (complete --list) (desc 'List all MLP:FiM ponies')) - ((options -L --altlist --symlist) (complete --symlist) (desc 'List all MLP:FiM ponies, with symlink mapping')) - ((options +l ++list) (complete ++list) (desc 'List all non-MLP:FiM ponies')) - ((options +K ++altlist ++symlist) (complete ++symlist) (desc 'List all non-MLP:FiM ponies, with symlink mapping')) - ((options -A --all) (complete --all) (desc 'List all ponies')) - ((options +A ++all --altall --symall) (complete --symall) (desc 'List all ponies, with symlink mapping')) - ((options -b --bubblelist --balloonlist) (complete --balloonlist) (desc 'List all balloon styles')) - ((options -o --pony-only --ponyonly) (complete --pony-only) (desc 'Print just the pony')) - ((options -X --256-colours --256colours --x-colours) (desc 'Use xterm colours')) - ((options -V --tty-colours --ttycolours --vt-colours) (desc 'Use linux vt colours')) - ((options -K --kms-colours --kmscolours) (desc 'Utilise kms support')) + ((options -h --help) (complete --help) (desc 'Show summary of options')) + ((options -v --version) (complete --version) (desc 'Show version of program')) + ((options -c --compress) (complete --compress) (desc 'Compress message')) + ((options -l --list) (complete --list) (desc 'List all MLP:FiM ponies')) + ((options -L --altlist --symlist) (complete --symlist) (desc 'List all MLP:FiM ponies, with symlink mapping')) + ((options +l ++list) (complete ++list) (desc 'List all non-MLP:FiM ponies')) + ((options +K ++altlist ++symlist) (complete ++symlist) (desc 'List all non-MLP:FiM ponies, with symlink mapping')) + ((options -A --all) (complete --all) (desc 'List all ponies')) + ((options +A ++all --altall --symall) (complete --symall) (desc 'List all ponies, with symlink mapping')) + ((options -b --bubblelist --balloonlist) (complete --balloonlist) (desc 'List all balloon styles')) + ((options -o --pony-only --ponyonly) (complete --pony-only) (desc 'Print just the pony')) + ((options -X --256-colours --256colours --x-colours) (desc 'Use xterm colours')) + ((options -V --tty-colours --ttycolours --vt-colours) (desc 'Use linux vt colours')) + ((options -K --kms-colours --kmscolours) (desc 'Utilise kms support')) ) + ; in files, -0 mean to not accept files, you can use to before other arguments to disallow them, + ; -a means accept all files, -d → directory, -D → door, -f → regular or pipe, -l → symlink (allowed by default on all), -r → regular (multiple argumented - ((options -f --file --pony) (arg PONY) (complete --file --pony) (suggest pony-f) (desc 'Specify the pony that should printed')) - ((options +f ++file ++pony) (arg PONY) (complete ++file ++pony) (suggest pony+f) (desc 'Specify the extrapony that should printed')) - ((options -q --quote) (arg PONY) (complete --quote) (suggest pony-q) (desc 'Specify the pony that should quote herself')) - ((options -b --bubble --balloon) (arg STYLE) (complete --balloon) (suggest balloon) (desc 'Specify message balloon style')) - ((options -W --wrap) (arg COLUMN) (complete --wrap) (suggest wrap) (desc 'Specify wrapping column')) - ((options +c --colour) (arg ANSI-COLOUR) (complete --colour) (desc 'Specify colour of the balloon, balloon link and message')) - ((options --colour-bubble --colour-balloon) (arg ANSI-COLOUR) (desc 'Specify colour of the balloon')) - ((options --colour-link) (arg ANSI-COLOUR) (desc 'Specify colour of the balloon link')) - ((options --colour-msg --colour-message) (arg ANSI-COLOUR) (desc 'Specify colour of the message')) - ((options --colour-pony) (arg ANSI-COLOUR) (desc 'Specify colour of the pony (if uncoloured)')) - ((options --colour-wrap --colour-hyphen) (arg ANSI-COLOUR) (desc 'Specify addition colour of wrapping hyphen')) + ((options -f --file --pony) (complete --file --pony) (arg PONY) (suggest pony-f) (files -f *.pony) (desc 'Specify the pony that should printed')) + ((options +f ++file ++pony) (complete ++file ++pony) (arg PONY) (suggest pony+f) (files -f *.pony) (desc 'Specify the extrapony that should printed')) + ((options -q --quote) (complete --quote) (arg PONY) (suggest pony-q) (files -f *.pony) (desc 'Specify the pony that should quote herself')) + ((options -b --bubble --balloon) (complete --balloon) (arg STYLE) (suggest balloon) (files -f (case (ponysay *.say) (ponyhink *.think)) (desc 'Specify message balloon style')) + ((options -W --wrap) (complete --wrap) (arg COLUMN) (suggest wrap) (files -0) (desc 'Specify wrapping column')) + ((options +c --colour) (complete --colour) (arg ANSI-COLOUR) (files -0) (desc 'Specify colour of the balloon, balloon link and message')) + ((options --colour-bubble --colour-balloon) (arg ANSI-COLOUR) (files -0) (desc 'Specify colour of the balloon')) + ((options --colour-link) (arg ANSI-COLOUR) (files -0) (desc 'Specify colour of the balloon link')) + ((options --colour-msg --colour-message) (arg ANSI-COLOUR) (files -0) (desc 'Specify colour of the message')) + ((options --colour-pony) (arg ANSI-COLOUR) (files -0) (desc 'Specify colour of the pony (if uncoloured)')) + ((options --colour-wrap --colour-hyphen) (arg ANSI-COLOUR) (files -0) (desc 'Specify addition colour of wrapping hyphen')) ) ; `bind` copies everything that is missing except `options` and `suggest` -- cgit v1.2.3-70-g09d2