mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-08-08 04:31:49 +00:00
Compare commits
4 Commits
fff41e1895
...
6b22e02bb2
Author | SHA1 | Date | |
---|---|---|---|
6b22e02bb2 | |||
944eeea244 | |||
612ae9e667 | |||
969f28fab4 |
@ -1,5 +1,18 @@
|
||||
"""script for generating man pages for the CLI."""
|
||||
|
||||
# /// script
|
||||
# dependencies = [
|
||||
# "typer>=0.15.2",
|
||||
# "click-man>=0.5.1",
|
||||
# "obsws-cli",
|
||||
# ]
|
||||
#
|
||||
# [tool.uv.sources]
|
||||
# obsws-cli = { path = "../" }
|
||||
# ///
|
||||
|
||||
import argparse
|
||||
|
||||
import typer
|
||||
from click_man.core import write_man_pages
|
||||
|
||||
@ -7,14 +20,24 @@ from obsws_cli import app
|
||||
from obsws_cli.__about__ import __version__
|
||||
|
||||
|
||||
def make_man():
|
||||
def main(target_dir: str):
|
||||
"""Generate man pages for the CLI."""
|
||||
cli = typer.main.get_command(app)
|
||||
name = 'obsws-cli'
|
||||
version = __version__
|
||||
target_dir = './man'
|
||||
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__':
|
||||
make_man()
|
||||
args = parse_args()
|
||||
|
||||
main(args.output)
|
||||
|
@ -58,15 +58,6 @@ for module in (
|
||||
app.add_typer(module.app, name=module.__name__.split('.')[-1])
|
||||
|
||||
|
||||
@app.command()
|
||||
def version(ctx: typer.Context):
|
||||
"""Get the OBS Client and WebSocket versions."""
|
||||
resp = ctx.obj.get_version()
|
||||
typer.echo(
|
||||
f'OBS Client version: {resp.obs_version} with WebSocket version: {resp.obs_web_socket_version}'
|
||||
)
|
||||
|
||||
|
||||
@app.callback()
|
||||
def main(
|
||||
ctx: typer.Context,
|
||||
@ -95,3 +86,12 @@ def main(
|
||||
timeout=settings.TIMEOUT,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@app.command()
|
||||
def version(ctx: typer.Context):
|
||||
"""Get the OBS Client and WebSocket versions."""
|
||||
resp = ctx.obj.get_version()
|
||||
typer.echo(
|
||||
f'OBS Client version: {resp.obs_version} with WebSocket version: {resp.obs_web_socket_version}'
|
||||
)
|
||||
|
@ -44,7 +44,7 @@ dependencies = ["click-man>=0.5.1"]
|
||||
|
||||
[tool.hatch.envs.default.scripts]
|
||||
cli = "obsws-cli {args:}"
|
||||
man = "python man/generate.py"
|
||||
man = "python man/generate.py --output=./man"
|
||||
|
||||
[tool.hatch.envs.hatch-test]
|
||||
dependencies = ["pytest>=8.3.5"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user