From 439d5292c1d4cd0aed2744b67202fe9f5b83c873 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Fri, 2 Jun 2023 14:00:55 -0500 Subject: [PATCH] refactor: swap hardcode with loop --- src/viv/viv.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/viv/viv.py b/src/viv/viv.py index 137e8b1..116cb09 100755 --- a/src/viv/viv.py +++ b/src/viv/viv.py @@ -50,7 +50,7 @@ from typing import ( from urllib.error import HTTPError from urllib.request import urlopen -__version__ = "23.5a4-43-gcdeed9f-dev" +__version__ = "23.5a4-43-g993e0e6-dev" class Spinner: @@ -1361,16 +1361,15 @@ class Cli: ) ).update( { - # "exe": dict( - # pip=dict(help="run cmd with pip"), - # python=dict(help="run cmd with python"), - # ), - "manage": dict( - show=dict(help="show current installation", aliases=["s"]), - install=dict(help="install fresh viv", aliases=["i"]), - update=dict(help="update viv version", aliases=["u"]), - purge=dict(help="remove traces of viv", aliases=["p"]), - ), + "manage": { + subcmd: {"help": help, "aliases": [subcmd[0]]} + for subcmd, help in ( + ("show", "show current installation"), + ("install", "install fresh viv"), + ("update", "update viv version"), + ("purge", "remove traces of viv"), + ) + } } )