mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-06 19:25:34 +00:00
pretty print help options using tabulate
This commit is contained in:
parent
13475b0630
commit
8b25a9265f
23
README.md
23
README.md
@ -63,6 +63,29 @@ Usage: swingmusic [options]
|
|||||||
| `--build` | | Build the application (in development) |
|
| `--build` | | Build the application (in development) |
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
╭────────────────────┬─────────┬───────────────────────────────────────────────────────────────────────────────╮
|
||||||
|
│ Option │ Short │ Description │
|
||||||
|
├────────────────────┼─────────┼───────────────────────────────────────────────────────────────────────────────┤
|
||||||
|
│ --help │ -h │ Show this help message │
|
||||||
|
├────────────────────┼─────────┼───────────────────────────────────────────────────────────────────────────────┤
|
||||||
|
│ --version │ -v │ Show the app version │
|
||||||
|
├────────────────────┼─────────┼───────────────────────────────────────────────────────────────────────────────┤
|
||||||
|
│ --host │ │ Set the host │
|
||||||
|
├────────────────────┼─────────┼───────────────────────────────────────────────────────────────────────────────┤
|
||||||
|
│ --port │ │ Set the port │
|
||||||
|
├────────────────────┼─────────┼───────────────────────────────────────────────────────────────────────────────┤
|
||||||
|
│ --config │ │ Set the config path │
|
||||||
|
├────────────────────┼─────────┼───────────────────────────────────────────────────────────────────────────────┤
|
||||||
|
│ --no-periodic-scan │ -nps │ Disable periodic scan │
|
||||||
|
├────────────────────┼─────────┼───────────────────────────────────────────────────────────────────────────────┤
|
||||||
|
│ --scan-interval │ -psi │ Set the periodic scan interval in seconds. Default is 300 seconds (5 minutes) │
|
||||||
|
├────────────────────┼─────────┼───────────────────────────────────────────────────────────────────────────────┤
|
||||||
|
│ --build │ │ Build the application (in development) │
|
||||||
|
╰────────────────────┴─────────┴───────────────────────────────────────────────────────────────────────────────╯
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
To stream your music across your local network, use the `--host` flag to run the app in all ports. Like this:
|
To stream your music across your local network, use the `--host` flag to run the app in all ports. Like this:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -1,23 +1,34 @@
|
|||||||
from app.settings import ALLARGS
|
from app.settings import ALLARGS
|
||||||
|
from tabulate import tabulate
|
||||||
|
|
||||||
args = ALLARGS
|
args = ALLARGS
|
||||||
|
|
||||||
|
help_args_list = [
|
||||||
|
["--help", "-h", "Show this help message"],
|
||||||
|
["--version", "-v", "Show the app version"],
|
||||||
|
["--host", "", "Set the host"],
|
||||||
|
["--port", "", "Set the port"],
|
||||||
|
["--config", "", "Set the config path"],
|
||||||
|
["--no-periodic-scan", "-nps", "Disable periodic scan"],
|
||||||
|
[
|
||||||
|
"--scan-interval",
|
||||||
|
"-psi",
|
||||||
|
"Set the periodic scan interval in seconds. Default is 300 seconds (5 minutes)",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"--build",
|
||||||
|
"",
|
||||||
|
"Build the application (in development)",
|
||||||
|
],
|
||||||
|
]
|
||||||
|
|
||||||
HELP_MESSAGE = f"""
|
HELP_MESSAGE = f"""
|
||||||
|
Swing Music is a beautiful, self-hosted music player for your
|
||||||
|
local audio files. Like a cooler Spotify ... but bring your own music.
|
||||||
|
|
||||||
Usage: swingmusic [options]
|
Usage: swingmusic [options]
|
||||||
|
|
||||||
Swing Music is a beautiful, self-hosted music player for your local audio files. Like a cooler Spotify ... but bring your own music.
|
{tabulate(help_args_list, headers=["Option", "Short", "Description"], tablefmt="rounded_grid", maxcolwidths=[None, None, 44])}
|
||||||
|
|
||||||
Options:
|
|
||||||
{', '.join(args.help)}: Show this help message
|
|
||||||
{', '.join(args.version)}: Show the app version
|
|
||||||
|
|
||||||
{args.host}: Set the host
|
|
||||||
{args.port}: Set the port
|
|
||||||
{args.config}: Set the config path
|
|
||||||
|
|
||||||
{', '.join(args.no_periodic_scan)}: Disable periodic scan
|
|
||||||
{', '.join(args.periodic_scan_interval)}: Set the periodic scan interval in seconds. Default is 300 seconds (5
|
|
||||||
minutes)
|
|
||||||
|
|
||||||
{args.build}: Build the application (in development)
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
"80s, 90s, the noughties and today"
|
||||||
|
16
poetry.lock
generated
16
poetry.lock
generated
@ -1241,6 +1241,20 @@ files = [
|
|||||||
{file = "sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88"},
|
{file = "sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tabulate"
|
||||||
|
version = "0.9.0"
|
||||||
|
description = "Pretty-print tabular data"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.7"
|
||||||
|
files = [
|
||||||
|
{file = "tabulate-0.9.0-py3-none-any.whl", hash = "sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f"},
|
||||||
|
{file = "tabulate-0.9.0.tar.gz", hash = "sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
widechars = ["wcwidth"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinytag"
|
name = "tinytag"
|
||||||
version = "1.9.0"
|
version = "1.9.0"
|
||||||
@ -1478,4 +1492,4 @@ files = [
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = ">=3.10,<3.12"
|
python-versions = ">=3.10,<3.12"
|
||||||
content-hash = "4ad9b92ccf22a264b35e57ff935827a5717ca3dc023d03f0bdaa83a39ef11c2a"
|
content-hash = "15bc0dc4a39392445fe3fe8a9131090f697f80008a79f5d8d49668465acafcb3"
|
||||||
|
@ -22,6 +22,7 @@ show-in-file-manager = "^1.1.4"
|
|||||||
pendulum = "^2.1.2"
|
pendulum = "^2.1.2"
|
||||||
alive-progress = "^3.1.4"
|
alive-progress = "^3.1.4"
|
||||||
flask-compress = "^1.13"
|
flask-compress = "^1.13"
|
||||||
|
tabulate = "^0.9.0"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
pylint = "^2.15.5"
|
pylint = "^2.15.5"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user