Merge pull request #4 from goetzc/fix/cli-help-version-early-exit

cli: exit early for --help/--version without starting app
This commit is contained in:
Danielle McLean 2026-03-01 12:43:52 +11:00
commit 5a2c5bb372
Signed by: 00dani
GPG key ID: 6854781A0488421C

View file

@ -1,4 +1,5 @@
import asyncio
import sys
from collections.abc import Iterable
from rich import print
@ -22,7 +23,23 @@ async def listen(
await listener.loop(receivers)
def print_help() -> None:
print("Usage: mpd-now-playable [OPTIONS]")
print("")
print("Options:")
print(" -h, --help Show this help message and exit.")
print(" -v, --version Show version and exit.")
def main() -> None:
args = set(sys.argv[1:])
if "-h" in args or "--help" in args:
print_help()
return
if "-v" in args or "--version" in args:
print(f"mpd-now-playable v{__version__}")
return
print(f"mpd-now-playable v{__version__}")
config = loadConfig()
print(config)