INNER CODE UNIT · Python
commandline
thevickypedia/Jarvis · jarvis/__init__.py:41
def commandline() -> None:
"""Starter function to invoke Jarvis using commandline."""
# This is to validate that only 'jarvis' command triggers this function and not invoked by other functions
assert sys.argv[0].endswith("jarvis"), "Invalid commandline trigger!!"
options = {
"install": "Installs the main dependencies.",
"dev-install": "Installs the dev dependencies.",
"start | run": "Initiates Jarvis.",
"uninstall": "Uninstall the main dependencies",
"dev-uninstall": "Uninstall the dev dependencies",
"--version | -v": "Prints the version.",
"--help | -h": "Prints the help section.",
}
# weird way to increase spacing to keep all values monotonic
_longest_key = len(max(options.keys()))
_pretext = "\n\t* "
choices = _pretext + _pretext.join(
f"{k} {'·' * (_longest_key - len(k) + 8)}→ {v}".expandtabs() for k, v in options.items()