From 718d769d0cbfa9e22e5f578dcd97c971f79ca9b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Andr=C3=A9e?= Date: Sat, 17 Aug 2013 08:12:05 +0200 Subject: [PATCH] prepare for --help-colour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- CHANGELOG | 4 +++- completion/ponysay | 1 + completion/ponysay-tool | 26 +++++++++++++------------- manuals/ponysay.texinfo | 13 +++++++++++-- src/__main__.py | 1 + src/ponysaytool.py | 1 + 6 files changed, 30 insertions(+), 16 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c83f691a..91245d22 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -32,7 +32,9 @@ Version 3.0.2 Swedish manual page added. - Added manpage for ponysay-tool + Added manpage for ponysay-tool. + + +h (++help, --help-colour) added. Version 3.0.1 diff --git a/completion/ponysay b/completion/ponysay index 9ccd8428..329e00fe 100644 --- a/completion/ponysay +++ b/completion/ponysay @@ -3,6 +3,7 @@ (multiple unargumented ((options -h --help) (complete --help) (desc 'Show summary of options')) + ((option +h ++help --help-colour) (complete --help-colour) (desc 'Show help summary, with colour even if piped')) ((options -v --version) (complete --version) (desc 'Show version of program')) ((options -c --compress --compact) (complete --compact) (desc 'Compress message')) ((options -l --list) (complete --list) (desc 'List all MLP:FiM ponies')) diff --git a/completion/ponysay-tool b/completion/ponysay-tool index f788029d..c8b26810 100644 --- a/completion/ponysay-tool +++ b/completion/ponysay-tool @@ -1,30 +1,30 @@ (ponysay-tool (multple unargumented - ((option -h --help) (complete --help) (desc 'Show help summary')) - ((option -v --version) (complete --version) (desc 'Show version summary')) + ((options -h --help) (complete --help) (desc 'Show help summary')) + ((options +h ++help --help-colour) (complete --help-colour) (desc 'Show help summary, with colour even if piped')) + ((options -v --version) (complete --version) (desc 'Show version summary')) ) - (unargumented (option --kms) (complete --kms) (desc 'Pregenerate kmsponies for current tty palette')) + (unargumented (options --kms) (complete --kms) (desc 'Pregenerate kmsponies for current tty palette')) - (argumented (option --edit) (complete --edit) (arg PONYFILE) (files -f *.pony) (desc 'Edit pony metadata')) + (argumented (options --edit) (complete --edit) (arg PONYFILE) (files -f *.pony) (desc 'Edit pony metadata')) - (argumented (option --edit-rm) (complete --edit-rm) (bind --edit) (desc 'Remove all pony metadata')) + (argumented (options --edit-rm) (complete --edit-rm) (bind --edit) (desc 'Remove all pony metadata')) - (argumented (option --edit-stash) (complete --edit-stash) (bind --edit) (desc 'Print all pony metadata')) + (argumented (options --edit-stash) (complete --edit-stash) (bind --edit) (desc 'Print all pony metadata')) - (argumented (option --edit-apply) (complete --edit-apply) (bind --edit) (desc 'Replace all metadata with stash metadata')) + (argumented (options --edit-apply) (complete --edit-apply) (bind --edit) (desc 'Replace all metadata with stash metadata')) - (argumented (option --dimensions) (complete --dimensions) (arg PONYDIR) (files -d *) (desc 'Generate pony dimension file for a directory')) + (argumented (options --dimensions) (complete --dimensions) (arg PONYDIR) (files -d) (desc 'Generate pony dimension file for a directory')) - (argumented (option --metadata) (complete --metadata) (arg PONYDIR) (files -d *) (desc 'Generate pony metadata collection file for a directory')) + (argumented (options --metadata) (complete --metadata) (arg PONYDIR) (files -d) (desc 'Generate pony metadata collection file for a directory')) - (argumented (option -b --browse) (complete --browse) (arg PONYDIR) (files -d *) (desc 'Browse ponies in a directory') + (argumented (options -b --browse) (complete --browse) (arg PONYDIR) (files -d) (desc 'Browse ponies in a directory') - (argumented (options -r --restrict) (complete --restrict) (arg RESTRICTION) (suggest -r) (files -0) (desc 'Metadata based restriction for --browse')) + (argumented (options -r --restrict) (complete --restrict) (arg RESTRICTION) (suggest -r) (files -0) (desc 'Metadata based restriction for --browse')) - (suggestion -r (verbatim kind=KIND group=GROUP coat=COAT eye=EYE mane=MANE aura=AURA) - ) + (suggestion -r (verbatim kind=KIND group=GROUP coat=COAT eye=EYE mane=MANE aura=AURA)) ) diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index 100ad0fd..f5430b09 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -151,6 +151,13 @@ Parse the following arguments as parts of @code{@var{message}}. @opindex @option{--help} Show summary of options. +@item +h +@itemx ++help +@opindex @option{+h} +@opindex @option{++help} +@opindex @option{--help-colour} +Show summary of options, and use colours even if stdout is piped. + @item -v @itemx --verion @opindex @option{-v} @@ -3278,11 +3285,13 @@ with the comic issue 8 where @file{drhooves} is siting alongside @file{doctor} and in front of @file{celestia} @item -Added manpage for @command{ponysay-tool} -@item Turkish manual page added. @item Swedish manual page added. +@item +@option{+h} (@option{++help}, @option{--help-colour}) added. +@item +Added manpage for @command{ponysay-tool}. @end itemize @heading Version 3.0.1 diff --git a/src/__main__.py b/src/__main__.py index f8fcc55f..2da77b20 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -120,6 +120,7 @@ run `man ponysay`. Ponysay has so much more to offer than described here.''') _F = ['--any-file', '--anyfile', '--any-pony', '--anypony'] __F = [_.replace("pony", "ponie") + 's' for _ in _F] opts.add_argumentless(['-h', '--help'], help = 'Print this help message.') + opts.add_argumentless(['+h', '++help', '--help-colour'], help = 'Print this help message with colours even if piped.') opts.add_argumentless(['-v', '--version'], help = 'Print the version of the program.') opts.add_argumentless(['-l', '--list'], help = 'List pony names.') opts.add_argumentless(['-L', '--symlist', '--altlist'], help = 'List pony names with alternatives.') diff --git a/src/ponysaytool.py b/src/ponysaytool.py index 34a93a11..644886fc 100755 --- a/src/ponysaytool.py +++ b/src/ponysaytool.py @@ -1231,6 +1231,7 @@ opts = ArgParser(program = 'ponysay-tool', opts.add_argumentless(['--no-term-init']) # for debugging opts.add_argumentless(['-h', '--help'], help = 'Print this help message.') +opts.add_argumentless(['+h', '++help', '--help-colour'], help = 'Print this help message with colours even if piped.') opts.add_argumentless(['-v', '--version'], help = 'Print the version of the program.') opts.add_argumentless(['--kms'], help = 'Generate all kmsponies for the current TTY palette') opts.add_argumented( ['--dimensions'], arg = 'PONY-DIR', help = 'Generate pony dimension file for a directory')