mirror of
https://github.com/1j01/textual-paint.git
synced 2024-09-11 15:56:03 +03:00
Automatically update CLI help on readme, during development
This commit is contained in:
parent
e200501518
commit
c610019430
@ -12,5 +12,7 @@ __license__ = "MIT"
|
||||
# to distinguish production from development versions.
|
||||
from os.path import exists, dirname
|
||||
from subprocess import check_output
|
||||
if exists(dirname(__file__) + "/../../.git"):
|
||||
DEVELOPMENT = exists(dirname(__file__) + "/../../.git")
|
||||
"""Whether running from a Git repository."""
|
||||
if DEVELOPMENT:
|
||||
__version__ = "development " + check_output(["git", "describe", "--tags"], cwd=dirname(__file__)).strip().decode()
|
||||
|
@ -4,7 +4,7 @@ import argparse
|
||||
import os
|
||||
import re
|
||||
|
||||
from .__init__ import __version__
|
||||
from .__init__ import __version__, DEVELOPMENT
|
||||
|
||||
parser = argparse.ArgumentParser(description='Paint in the terminal.', usage='%(prog)s [options] [filename]', prog="textual-paint")
|
||||
parser.add_argument('--version', action='version', version=f'%(prog)s {__version__}')
|
||||
@ -60,11 +60,13 @@ def update_cli_help_on_readme():
|
||||
f.seek(0)
|
||||
f.write(md)
|
||||
f.truncate()
|
||||
# Manually disabled for release.
|
||||
# TODO: disable for release builds, while keeping it automatic during development.
|
||||
# (I could make this another dev flag, but I like the idea of it being automatic.)
|
||||
# (Maybe a pre-commit hook would be ideal, if it's worth the complexity.)
|
||||
# update_cli_help_on_readme()
|
||||
|
||||
if DEVELOPMENT:
|
||||
# A pre-commit hook might technically be best for this,
|
||||
# but I doubt it's worth the complexity.
|
||||
# I'm usually running with --restart-on-changes anyways,
|
||||
# while working on the project.
|
||||
update_cli_help_on_readme()
|
||||
|
||||
args = parser.parse_args()
|
||||
"""Parsed command line arguments."""
|
||||
|
Loading…
Reference in New Issue
Block a user