scripts/cli-help
#!/usr/bin/env python
import os
import subprocess
import click
@click.command()
@click.option('--commands', type=str, multiple=True, default=("libertem-server", "libertem-worker"))
@click.option(
'--folder',
type=click.Path(
exists=True,
file_okay=False,
dir_okay=True,
writable=True,
readable=False,
allow_dash=False,
),
default="docs/source/autogenerated/"
)
def main(commands, folder):
for command in commands:
outfile = os.path.join(folder, f"{command}.help")
with open(outfile, 'w', encoding='utf-8') as of:
print(f"{command} --help > {outfile}")
subprocess.call((command, '--help'), stdout=of)
if __name__ == '__main__':
main()