prosodic.cli

 1from .imports import *
 2import click
 3
 4
 5@click.group()
 6def cli():
 7    """
 8    Main command group for the CLI application.
 9    """
10    pass
11
12
13@cli.command()
14@click.option('--host', default='127.0.0.1', help='set host (127.0.0.1)')
15@click.option('--port', default=8181, help='set port (8181)')
16@click.option('--debug', is_flag=True, help='debug')
17def web(host='127.0.0.1', port=8181, debug=False):
18    """
19    Start the prosodic web server.
20
21    Args:
22        host (str): The host address to bind the server to. Defaults to '127.0.0.1'.
23        port (int): The port number to run the server on. Defaults to 8181.
24        debug (bool): Enable debug mode if True. Defaults to False.
25
26    Returns:
27        None
28    """
29    from .web.app import main
30    msg = f'Starting prosodic as a webserver at http://{host}:{port}...'
31    click.echo(msg)
32    logmap.enable()
33    main(host=host, port=port, debug=debug)
34
35
36@cli.command()
37def ipython():
38    """
39    Start an IPython session with prosodic imported.
40
41    This function launches an interactive IPython shell with prosodic
42    pre-imported for convenience.
43
44    Returns:
45        None
46    """
47    click.echo('Starting prosodic in ipython')
48    imps = 'from prosodic import *\nimport prosodic'
49    cmd = f'ipython -i -c "{imps}"'
50    os.system(cmd)
cli = <Group cli>

Main command group for the CLI application.

web = <Command web>

Start the prosodic web server.

Arguments:
  • host (str): The host address to bind the server to. Defaults to '127.0.0.1'.
  • port (int): The port number to run the server on. Defaults to 8181.
  • debug (bool): Enable debug mode if True. Defaults to False.
Returns:

None

ipython = <Command ipython>

Start an IPython session with prosodic imported.

This function launches an interactive IPython shell with prosodic pre-imported for convenience.

Returns:

None