Skip to content

Commit

Permalink
Splits typer params out into seperate variables
Browse files Browse the repository at this point in the history
  • Loading branch information
AngellusMortis committed Jul 15, 2021
1 parent d6d0050 commit 30ab26e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 32 deletions.
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
History
=======

0.2.3 (2021-08-16)
------------------

* Splits typer params out into seperate variables

0.2.2 (2021-08-16)
------------------

Expand Down
2 changes: 1 addition & 1 deletion sxm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

__author__ = """AngellusMortis"""
__email__ = "[email protected]"
__version__ = "0.2.2"
__version__ = "0.2.3"
__all__ = [
"AuthenticationError",
"HLS_AES_KEY",
Expand Down
71 changes: 40 additions & 31 deletions sxm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,47 @@ class RegionChoice(str, Enum):
CA = "CA"


OPTION_USERNAME = typer.Option(
..., "--username", "-U", help="SXM username", prompt=True, envvar="SXM_USERNAME"
)
OPTION_PASSWORD = typer.Option(
...,
"--password",
"-P",
help="SXM password",
prompt=True,
hide_input=True,
envvar="SXM_PASSWORD",
)
OPTION_LIST_CHANNELS = typer.Option(
False, "--list-channels", "-l", help="List all available SXM channels and exit"
)
OPTION_PORT = typer.Option(
9999, "--port", "-p", help="Port to run SXM server on", envvar="SXM_PORT"
)
OPTION_HOST = typer.Option(
"127.0.0.1", "--host", "-h", help="IP to bind SXM server to", envvar="SXM_HOST"
)
OPTION_VERBOSE = typer.Option(
False, "--verbose", "-v", help="Enable debug logging", envvar="SXM_DEBUG"
)
OPTION_REGION = typer.Option(
RegionChoice.US,
"--region",
"-r",
help="Sets the SXM client's region",
envvar="SXM_REGION",
)


def main(
username: str = typer.Option(
..., "--username", "-U", help="SXM username", prompt=True, envvar="SXM_USERNAME"
),
password: str = typer.Option(
...,
"--password",
"-P",
help="SXM password",
prompt=True,
hide_input=True,
envvar="SXM_PASSWORD",
),
do_list: bool = typer.Option(
False, "--list-channels", "-l", help="List all available SXM channels and exit"
),
port: int = typer.Option(
9999, "--port", "-p", help="Port to run SXM server on", envvar="SXM_PORT"
),
host: str = typer.Option(
"127.0.0.1", "--host", "-h", help="IP to bind SXM server to", envvar="SXM_HOST"
),
verbose: bool = typer.Option(
False, "--verbose", "-v", help="Enable debug logging", envvar="SXM_DEBUG"
),
region: RegionChoice = typer.Option(
RegionChoice.US,
"--region",
"-r",
help="Sets the SXM client's region",
envvar="SXM_REGION",
),
username: str = OPTION_USERNAME,
password: str = OPTION_PASSWORD,
do_list: bool = OPTION_LIST_CHANNELS,
port: int = OPTION_PORT,
host: str = OPTION_HOST,
verbose: bool = OPTION_VERBOSE,
region: RegionChoice = OPTION_REGION,
) -> int:
"""SXM proxy command line application."""

Expand Down

0 comments on commit 30ab26e

Please sign in to comment.