Skip to content

Commit

Permalink
fix #24
Browse files Browse the repository at this point in the history
  • Loading branch information
bckohan committed May 22, 2024
1 parent bf7ac32 commit 65b6a98
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Change Log
==========

v0.2.3
======

* Fixed `when :prog: is supplied and a subcommand help is generated the usage string includes incorrect prefix to prog <https://github.com/sphinx-contrib/typer/issues/24>`_

v0.2.2
======

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sphinxcontrib-typer"
version = "0.2.2"
version = "0.2.3"
description = "Auto generate docs for typer commands."
authors = ["Brian Kohan <[email protected]>"]
license = "MIT"
Expand Down
12 changes: 8 additions & 4 deletions sphinxcontrib/typer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
from typer.main import get_command as get_typer_command
from typer.models import Context as TyperContext

VERSION = (0, 2, 2)
VERSION = (0, 2, 3)

__title__ = "SphinxContrib Typer"
__version__ = ".".join(str(i) for i in VERSION)
Expand Down Expand Up @@ -585,9 +585,13 @@ def run(self) -> t.Iterable[nodes.section]:
self.preferred if self.preferred in supported else supported[0]
)

return self.generate_nodes(
self.prog_name, command, getattr(self, "parent", None)
)
parent = getattr(self, "parent", None)
if parent and self.options.get("prog", None):
# we unset this because we're not at the root command and this gets
# messed up for whatever reason
# https://github.com/sphinx-contrib/typer/issues/24
parent.info_name = ""
return self.generate_nodes(self.prog_name, command, parent)


def typer_get_iframe_height(
Expand Down

0 comments on commit 65b6a98

Please sign in to comment.