Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: refine docs generation script and template #1328

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1325.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Refine docs generation script and template.
15 changes: 9 additions & 6 deletions scripts/gen_doc_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import mkdocs_gen_files
from jinja2 import Environment, FileSystemLoader

from pipx.main import __version__


def get_help(cmd: Optional[str]) -> str:
base = ["pipx"]
Expand All @@ -19,24 +17,29 @@ def get_help(cmd: Optional[str]) -> str:
content = content.replace(str(Path("~").expanduser()), "~")
return f"""
```
{" ".join(args[2:])}
{content}
```
"""


params = {
"runpip": get_help("runpip"),
"install": get_help("install"),
"installall": get_help("install-all"),
"uninject": get_help("uninject"),
"inject": get_help("inject"),
"upgrade": get_help("upgrade"),
"upgradeall": get_help("upgrade-all"),
"inject": get_help("inject"),
"uninstall": get_help("uninstall"),
"uninstallall": get_help("uninstall-all"),
"reinstall": get_help("reinstall"),
"reinstallall": get_help("reinstall-all"),
"list": get_help("list"),
"interpreter": get_help("interpreter"),
"run": get_help("run"),
"version": __version__,
"runpip": get_help("runpip"),
"ensurepath": get_help("ensurepath"),
"environment": get_help("environment"),
"completions": get_help("completions"),
"usage": get_help(None),
}

Expand Down
44 changes: 36 additions & 8 deletions scripts/templates/docs.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
{{ usage }}
{{usage}}

### pipx install

{{ install }}
{{install}}

### pipx run
### pipx install-all

{{run}}
{{installall}}

### pipx uninject

{{uninject}}

### pipx inject

{{inject}}

### pipx upgrade

Expand All @@ -16,10 +24,6 @@

{{upgradeall}}

### pipx inject

{{inject}}

### pipx uninstall

{{uninstall}}
Expand All @@ -28,6 +32,10 @@

{{uninstallall}}

### pipx reinstall

{{reinstall}}

### pipx reinstall-all

{{reinstallall}}
Expand All @@ -36,6 +44,26 @@

{{list}}

### pipx interpreter

{{interpreter}}

### pipx run

{{run}}

### pipx runpip

{{runpip}}

### pipx ensurepath

{{ensurepath}}

### pipx environment

{{environment}}

### pipx completions

{{completions}}