We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 176e38e commit 6b1e3a3Copy full SHA for 6b1e3a3
userland/__init__.py
@@ -1,4 +1,5 @@
1
import importlib
2
+import importlib.metadata
3
import sys
4
from pathlib import Path
5
@@ -8,11 +9,18 @@
8
9
10
11
def print_usage(prog_name: str) -> None:
12
+ try:
13
+ version = importlib.metadata.version(__package__)
14
+ except importlib.metadata.PackageNotFoundError:
15
+ version = "(unknown version)"
16
+
17
print(
- f"Usage: {prog_name} APPLET [ARGUMENT]..."
- + f"\n{7 * " "}{prog_name} --list"
- + "\n\nAvailable applets:",
18
+ f"python-userland v{version}",
19
+ f"Usage: {prog_name} APPLET [ARGUMENT]...",
20
+ f"{7 * " "}{prog_name} --list",
21
+ "\nAvailable applets:",
22
", ".join(sorted(applets)),
23
+ sep="\n"
24
)
25
26
0 commit comments