From 8fbf229e1e919ce1b05911ab3272dc02b30c94cb Mon Sep 17 00:00:00 2001 From: chfw Date: Sat, 28 Sep 2019 12:13:52 +0100 Subject: [PATCH 1/4] :wheel_chair: group the ever growing cli options --- moban/constants.py | 2 +- moban/main.py | 91 +++++++++++++++++++++++++--------------------- 2 files changed, 51 insertions(+), 42 deletions(-) diff --git a/moban/constants.py b/moban/constants.py index d726f084..9b4277e5 100644 --- a/moban/constants.py +++ b/moban/constants.py @@ -7,7 +7,7 @@ # Configurations PROGRAM_NAME = "moban" PROGRAM_DESCRIPTION = ( - "Yet another jinja2 cli command for static " + "text generation" + "Static text generator using any template, any data and any location." ) DEFAULT_YAML_SUFFIX = ".yml" # .moban.yml, default moban configuration file diff --git a/moban/main.py b/moban/main.py index 96f3e569..2489ea66 100644 --- a/moban/main.py +++ b/moban/main.py @@ -89,80 +89,89 @@ def create_parser(): prog=constants.PROGRAM_NAME, description=constants.PROGRAM_DESCRIPTION ) parser.add_argument( - "-cd", - "--%s" % constants.LABEL_CONFIG_DIR, - help="the directory for configuration file lookup", + "-c", "--%s" % constants.LABEL_CONFIG, help="the dictionary file" ) parser.add_argument( - "-c", "--%s" % constants.LABEL_CONFIG, help="the dictionary file" + "-t", "--%s" % constants.LABEL_TEMPLATE, help="the template file" + ) + parser.add_argument( + "-o", "--%s" % constants.LABEL_OUTPUT, help="the output file" ) parser.add_argument( + constants.POSITIONAL_LABEL_TEMPLATE, + metavar="template", + type=str, + nargs="?", + help="string templates", + ) + advanced = parser.add_argument_group( + "Advanced options", "For better control" + ) + advanced.add_argument( "-td", "--%s" % constants.LABEL_TMPL_DIRS, nargs="*", - help="the directories for template file lookup", + help="add more directories for template file lookup", ) - parser.add_argument( - "-t", "--%s" % constants.LABEL_TEMPLATE, help="the template file" + advanced.add_argument( + "-cd", + "--%s" % constants.LABEL_CONFIG_DIR, + help="the directory for configuration file lookup", ) - parser.add_argument( - "-o", "--%s" % constants.LABEL_OUTPUT, help="the output file" + advanced.add_argument( + "-m", "--%s" % constants.LABEL_MOBANFILE, help="custom moban file" ) - parser.add_argument( - "--%s" % constants.LABEL_TEMPLATE_TYPE, + advanced.add_argument( + "-g", "--%s" % constants.LABEL_GROUP, help="a subset of targets" + ) + advanced.add_argument( + "--%s" % constants.LABEL_TEMPLATE_TYPE.replace("_", "-"), help="the template type, default is jinja2", ) - parser.add_argument( + advanced.add_argument( + "-d", + "--%s" % constants.LABEL_DEFINE, + nargs="+", + help=( + "to supply additional or override predefined variables," + + " format: VAR=VALUEs" + ), + ) + advanced.add_argument( + "-e", + "--%s" % constants.LABEL_EXTENSION, + nargs="+", + help="to to TEMPLATE_TYPE=EXTENSION_NAME", + ) + advanced.add_argument( "-f", action="store_true", dest=constants.LABEL_FORCE, default=False, help="force moban to template all files despite of .moban.hashes", ) - parser.add_argument( + developer = parser.add_argument_group( + "Developer options", "For debugging and development" + ) + developer.add_argument( "--%s" % constants.LABEL_EXIT_CODE, action="store_true", dest=constants.LABEL_EXIT_CODE, default=False, help="tell moban to change exit code", ) - parser.add_argument( - "-m", "--%s" % constants.LABEL_MOBANFILE, help="custom moban file" - ) - parser.add_argument( - "-g", "--%s" % constants.LABEL_GROUP, help="a subset of targets" - ) - parser.add_argument( - constants.POSITIONAL_LABEL_TEMPLATE, - metavar="template", - type=str, - nargs="?", - help="string templates", - ) - parser.add_argument( + developer.add_argument( "-V", "--%s" % constants.LABEL_VERSION, action="version", version="%(prog)s {v}".format(v=__version__), ) - parser.add_argument( + developer.add_argument( "-v", action="count", dest=constants.LABEL_VERBOSE, default=0, - help="show verbose", - ) - parser.add_argument( - "-d", - "--%s" % constants.LABEL_DEFINE, - nargs="+", - help="to take a list of VAR=VALUEs", - ) - parser.add_argument( - "-e", - "--%s" % constants.LABEL_EXTENSION, - nargs="+", - help="to add an extension to TEMPLATE_TYPE=EXTENSION_NAME", + help="show verbose, try -v, -vv", ) return parser From 3ff80fbe2a3e944441fcd2fd46b08581895bb0ac Mon Sep 17 00:00:00 2001 From: chfw Date: Sat, 28 Sep 2019 12:17:08 +0100 Subject: [PATCH 2/4] :books: update change log --- .moban.cd/changelog.yml | 6 ++++++ CHANGELOG.rst | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/.moban.cd/changelog.yml b/.moban.cd/changelog.yml index b3584f87..c8911b40 100644 --- a/.moban.cd/changelog.yml +++ b/.moban.cd/changelog.yml @@ -1,6 +1,12 @@ name: moban organisation: moremoban releases: + - changes: + - action: Updated + details: + - "Command options have been grouped. --template_type became --template-type" + date: 25.09.2019 + version: 0.6.3 - changes: - action: Added details: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bf1a2951..b4e895a9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,14 @@ Change log 0.6.3 - 25.09.2019 -------------------------------------------------------------------------------- +Updated +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +#. Command options have been grouped. --template_type became --template-type + +0.6.3 - 25.09.2019 +-------------------------------------------------------------------------------- + Added ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From 4580d6491eb856b9ac0760ee6df72db1f1a84272 Mon Sep 17 00:00:00 2001 From: chfw Date: Sat, 28 Sep 2019 12:18:23 +0100 Subject: [PATCH 3/4] :books: minor update on the help text for -c --- moban/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moban/main.py b/moban/main.py index 2489ea66..e855d5a5 100644 --- a/moban/main.py +++ b/moban/main.py @@ -89,7 +89,7 @@ def create_parser(): prog=constants.PROGRAM_NAME, description=constants.PROGRAM_DESCRIPTION ) parser.add_argument( - "-c", "--%s" % constants.LABEL_CONFIG, help="the dictionary file" + "-c", "--%s" % constants.LABEL_CONFIG, help="the data file" ) parser.add_argument( "-t", "--%s" % constants.LABEL_TEMPLATE, help="the template file" From ad65ee7fe06c1acd01a1c81a2b077867113e4f62 Mon Sep 17 00:00:00 2001 From: chfw Date: Sat, 28 Sep 2019 12:18:33 +0100 Subject: [PATCH 4/4] :books: pump up the version number --- .moban.cd/changelog.yml | 4 ++-- .moban.cd/moban.yml | 4 ++-- CHANGELOG.rst | 2 +- docs/conf.py | 2 +- moban/_version.py | 2 +- setup.py | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.moban.cd/changelog.yml b/.moban.cd/changelog.yml index c8911b40..34a1b424 100644 --- a/.moban.cd/changelog.yml +++ b/.moban.cd/changelog.yml @@ -5,8 +5,8 @@ releases: - action: Updated details: - "Command options have been grouped. --template_type became --template-type" - date: 25.09.2019 - version: 0.6.3 + date: tbd + version: 0.6.4 - changes: - action: Added details: diff --git a/.moban.cd/moban.yml b/.moban.cd/moban.yml index 5853522c..2432172b 100644 --- a/.moban.cd/moban.yml +++ b/.moban.cd/moban.yml @@ -4,8 +4,8 @@ organisation: moremoban author: C. W. contact: wangc_2011@hotmail.com license: MIT -version: 0.6.3 -current_version: 0.6.3 +version: 0.6.4 +current_version: 0.6.4 release: 0.6.3 branch: master master: index diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b4e895a9..f973bb29 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,7 @@ Change log ================================================================================ -0.6.3 - 25.09.2019 +0.6.4 - tbd -------------------------------------------------------------------------------- Updated diff --git a/docs/conf.py b/docs/conf.py index 7378f931..5c3cd9e0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -25,7 +25,7 @@ copyright = '2017-2019 Onni Software Ltd.' author = 'C. W.' # The short X.Y version -version = '0.6.3' +version = '0.6.4' # The full version, including alpha/beta/rc tags release = '0.6.3' diff --git a/moban/_version.py b/moban/_version.py index ed642873..a83896a5 100644 --- a/moban/_version.py +++ b/moban/_version.py @@ -1,2 +1,2 @@ -__version__ = "0.6.3" +__version__ = "0.6.4" __author__ = "C. W." diff --git a/setup.py b/setup.py index 08b37c05..f7482386 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ NAME = "moban" AUTHOR = "C. W." -VERSION = "0.6.3" +VERSION = "0.6.4" EMAIL = "wangc_2011@hotmail.com" LICENSE = "MIT" ENTRY_POINTS = {