improve help messages
This commit is contained in:
parent
3e0615815f
commit
39df530ec2
13
RELEASING.md
Normal file
13
RELEASING.md
Normal file
@ -0,0 +1,13 @@
|
||||
1. Run 'tzk build emptify' in the parent directory;
|
||||
this will update the single-file (for GitHub Pages)
|
||||
and edition (for the PyPi package) versions.
|
||||
Ensure that the emptified build looks how you want it.
|
||||
2. Update version numbers:
|
||||
`setup.py`,
|
||||
`cli_docs/conf.py`,
|
||||
`util.py`.
|
||||
3. Push changes to GitHub.
|
||||
Check that RTD and GitHub Pages update as desired
|
||||
(https://tzk.readthedocs.io/en/latest/,
|
||||
https://sobjornstad.github.io/tzk/).
|
||||
4. Run `publish.sh`, which will upload the latest package version to PyPi.
|
@ -10,7 +10,8 @@ from typing import Optional
|
||||
from tzk.config import cm, DEFAULT_INIT_OPTS
|
||||
from tzk import git
|
||||
from tzk import tw
|
||||
from tzk.util import BuildError, fail, numerize, require_dependencies, pushd
|
||||
from tzk.util import (BuildError, fail, numerize, require_dependencies, pushd,
|
||||
TZK_VERSION)
|
||||
|
||||
|
||||
class CliCommand(ABC):
|
||||
@ -78,7 +79,7 @@ class CommitCommand(CliCommand):
|
||||
|
||||
class ListenCommand(CliCommand):
|
||||
cmd = "listen"
|
||||
help = "Start a TiddlyWiki server in the current directory."
|
||||
help = "Start a TiddlyWiki server in the current tzk repository."
|
||||
|
||||
@classmethod
|
||||
def setup_arguments(cls, parser: argparse.ArgumentParser) -> None:
|
||||
@ -121,7 +122,7 @@ class ListenCommand(CliCommand):
|
||||
|
||||
class InitCommand(CliCommand):
|
||||
cmd = "init"
|
||||
help = "Set up a new tzk directory."
|
||||
help = "Set up a new tzk repository."
|
||||
|
||||
@classmethod
|
||||
def setup_arguments(cls, parser: argparse.ArgumentParser) -> None:
|
||||
@ -170,6 +171,18 @@ class PreflightCommand(CliCommand):
|
||||
"turn into your tzk repository and run 'tzk init'.")
|
||||
|
||||
|
||||
class VersionCommand(CliCommand):
|
||||
cmd = "version"
|
||||
help = "Find out what version your tzk is at."
|
||||
|
||||
@classmethod
|
||||
def setup_arguments(cls, parser: argparse.ArgumentParser) -> None:
|
||||
pass
|
||||
|
||||
def execute(self, args: argparse.Namespace) -> None:
|
||||
print(f"tzk version {TZK_VERSION}")
|
||||
|
||||
|
||||
class BuildCommand(CliCommand):
|
||||
cmd = "build"
|
||||
help = ("Build another wiki or derivative product, "
|
||||
@ -386,11 +399,19 @@ def launch():
|
||||
f"'{os.environ['TZK_DIRECTORY']}', so I tried to go there, "
|
||||
f"but there's no tzk_config.py there either.")
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser = argparse.ArgumentParser(
|
||||
description=f"TiddlyZettelKasten {TZK_VERSION} CLI\n"
|
||||
f"Copyright (c) 2021 Soren Bjornstad.\n"
|
||||
f"MIT license; see https://github.com/sobjornstad/tzk/LICENSE for details.",
|
||||
epilog="For full documentation, see https://tzk.readthedocs.io/en/latest/.",
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter
|
||||
)
|
||||
|
||||
subparsers = parser.add_subparsers()
|
||||
for command in sorted(CliCommand.__subclasses__(), key=lambda i: i.__name__):
|
||||
subparser = subparsers.add_parser(command.cmd, help=command.help)
|
||||
subparser = subparsers.add_parser(command.cmd,
|
||||
help=command.help,
|
||||
description=command.help)
|
||||
subparser.set_defaults(_cls=command)
|
||||
command.setup_arguments(subparser) # type: ignore
|
||||
|
||||
|
@ -10,6 +10,9 @@ import sys
|
||||
from typing import Any, Callable, Dict, NoReturn
|
||||
|
||||
|
||||
TZK_VERSION = "0.1.0"
|
||||
|
||||
|
||||
class BuildError(Exception):
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user