From 6702a740db6abde4010e47b2a13989402d554083 Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 9 Feb 2016 17:22:43 +0100 Subject: [PATCH] [songbook] Nicer formatted help text --- patacrep/songbook/__main__.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/patacrep/songbook/__main__.py b/patacrep/songbook/__main__.py index 3338b099..9de2a520 100644 --- a/patacrep/songbook/__main__.py +++ b/patacrep/songbook/__main__.py @@ -51,6 +51,7 @@ def argument_parser(args): parser = argparse.ArgumentParser( prog="songbook", description="A song book compiler", + formatter_class=argparse.RawTextHelpFormatter, ) parser.add_argument( @@ -65,9 +66,8 @@ def argument_parser(args): parser.add_argument( '--datadir', '-d', nargs='+', type=str, action='append', help=textwrap.dedent("""\ - Data location. Expected (not necessarily required) - subdirectories are 'songs', 'img', 'latex', 'templates'. - """) + Data location. Expected (not necessarily required) subdirectories are 'songs', 'img', 'latex', 'templates'. + """), ) parser.add_argument( @@ -90,20 +90,15 @@ def argument_parser(args): '--steps', '-s', nargs=1, type=str, action=ParseStepsAction, help=textwrap.dedent("""\ - Steps to run. Default is "{steps}". - Available steps are: - "tex" produce .tex file from templates; - "pdf" compile .tex file; - "sbx" compile index files; - "clean" remove temporary files; - any string beginning with '#' (in this case, it will be run - in a shell). Several steps (excepted the custom shell - command) can be combinend in one --steps argument, as a - comma separated string. - - Substring {{basename}} is replaced by the basename of the song - book, and substrings {{aux}}, {{log}}, {{out}}, {{pdf}}, {{sxc}}, {{tex}} - are replaced by ".aux", ".log", and so on. + Steps to run. Default is "{steps}". Available steps are: + - "tex" produce .tex file from templates; + - "pdf" compile .tex file; + - "sbx" compile index files; + - "clean" remove temporary files; + - any string beginning with '#' (in this case, it will be run in a shell). + Several steps (excepted the custom shell command) can be combinend in one --steps argument, as a comma separated string. + + Substring {{basename}} is replaced by the basename of the song book, and substrings {{aux}}, {{log}}, {{out}}, {{pdf}}, {{sxc}}, {{tex}} are replaced by ".aux", ".log", and so on. """.format(steps=','.join(DEFAULT_STEPS))), default=None, )