Skip to content

Commit

Permalink
0.4.4 (#145)
Browse files Browse the repository at this point in the history
* ⬆️ Bump argx to 0.2.2

* 🎨 Expose parse_args() to cli plugins

* 🔖 0.4.3

* 🐛 Fix when cli plugin has no docstring

* 🚑 Exclude help from help sub-command itself

* 🔖 0.4.4

* 🐛 Fix subcommand list for help command
  • Loading branch information
pwwang authored Feb 24, 2023
1 parent 15b2e01 commit 750e704
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
6 changes: 6 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 0.4.4

- 🐛 Fix when cli plugin has no docstring
- 🚑 Exclude help from help sub-command itself
- 🚑 Add cli plugin docstring as sub-command description

## 0.4.3

- ⬆️ Bump `argx` to 0.2.2
Expand Down
12 changes: 11 additions & 1 deletion pipen/cli/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,19 @@ def main() -> None:
plugins = {}
for name in plugin_names:
plg = cli_plugin.get_plugin(name, raw=True)

docstr = plg.__doc__
if docstr is not None:
docstr = docstr.strip()

subparser = parser.add_command(
plg.name,
help=re.sub(r"\s+", " ", plg.__doc__.strip().split("\n\n")[0]),
help=(
None
if docstr is None
else re.sub(r"\s+", " ", docstr.splitlines()[0])
),
description=docstr,
)
plugins[plg.name] = plg(parser, subparser)

Expand Down
8 changes: 6 additions & 2 deletions pipen/cli/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import annotations
from typing import TYPE_CHECKING

from ._hooks import CLIPlugin, cli_plugin
from ._hooks import CLIPlugin

if TYPE_CHECKING:
from argx import ArgumentParser
Expand All @@ -21,7 +21,11 @@ def __init__(self, parser: ArgumentParser, subparser: ArgumentParser):
subparser.add_argument(
"cmd",
nargs="?",
choices=cli_plugin.get_enabled_plugin_names(),
choices=[
n
for n in parser._subparsers._group_actions[0].choices
if n != "help"
],
help="The command to show help for",
)

Expand Down
2 changes: 1 addition & 1 deletion pipen/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Provide version of pipen"""

__version__ = "0.4.3"
__version__ = "0.4.4"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.masonry.api"

[tool.poetry]
name = "pipen"
version = "0.4.3"
version = "0.4.4"
description = "A pipeline framework for python"
authors = [ "pwwang <[email protected]>",]
license = "MIT"
Expand Down

0 comments on commit 750e704

Please sign in to comment.