mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-09-09 04:01:54 +00:00
add --output to generate
specify ./man as output dir in hatch man script
This commit is contained in:
parent
fff41e1895
commit
969f28fab4
@ -1,5 +1,7 @@
|
|||||||
"""script for generating man pages for the CLI."""
|
"""script for generating man pages for the CLI."""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
|
||||||
import typer
|
import typer
|
||||||
from click_man.core import write_man_pages
|
from click_man.core import write_man_pages
|
||||||
|
|
||||||
@ -7,14 +9,24 @@ from obsws_cli import app
|
|||||||
from obsws_cli.__about__ import __version__
|
from obsws_cli.__about__ import __version__
|
||||||
|
|
||||||
|
|
||||||
def make_man():
|
def main(target_dir: str):
|
||||||
"""Generate man pages for the CLI."""
|
"""Generate man pages for the CLI."""
|
||||||
cli = typer.main.get_command(app)
|
cli = typer.main.get_command(app)
|
||||||
name = 'obsws-cli'
|
name = 'obsws-cli'
|
||||||
version = __version__
|
version = __version__
|
||||||
target_dir = './man'
|
|
||||||
write_man_pages(name, cli, version=version, target_dir=target_dir)
|
write_man_pages(name, cli, version=version, target_dir=target_dir)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_args():
|
||||||
|
"""Parse command line arguments."""
|
||||||
|
parser = argparse.ArgumentParser(description='Generate man pages for the CLI.')
|
||||||
|
parser.add_argument(
|
||||||
|
'--output', type=str, default='.', help='Directory to save man pages'
|
||||||
|
)
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
make_man()
|
args = parse_args()
|
||||||
|
|
||||||
|
main(args.output)
|
||||||
|
@ -44,7 +44,7 @@ dependencies = ["click-man>=0.5.1"]
|
|||||||
|
|
||||||
[tool.hatch.envs.default.scripts]
|
[tool.hatch.envs.default.scripts]
|
||||||
cli = "obsws-cli {args:}"
|
cli = "obsws-cli {args:}"
|
||||||
man = "python man/generate.py"
|
man = "python man/generate.py --output=./man"
|
||||||
|
|
||||||
[tool.hatch.envs.hatch-test]
|
[tool.hatch.envs.hatch-test]
|
||||||
dependencies = ["pytest>=8.3.5"]
|
dependencies = ["pytest>=8.3.5"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user