From 6cb4daa56408c342d85df8e567581972fe7ba4c1 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 9 Nov 2018 21:10:25 +0000 Subject: refuse to install/uninstall/force-uninstall/search if no package name is given --- src/frontend/cli/sisyphus-cli.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/frontend/cli/sisyphus-cli.py') diff --git a/src/frontend/cli/sisyphus-cli.py b/src/frontend/cli/sisyphus-cli.py index e7637cb..ff68593 100755 --- a/src/frontend/cli/sisyphus-cli.py +++ b/src/frontend/cli/sisyphus-cli.py @@ -8,11 +8,20 @@ pkgList = sys.argv[2:] if "__main__" == __name__: if sys.argv[1:]: if "install" in sys.argv[1:]: - startInstall(pkgList) + if not pkgList: + sys.exit("\n" + "Nothing to install, please give at least one package name; quitting" + "\n") + else: + startInstall(pkgList) elif "uninstall" in sys.argv[1:]: - startUninstall(pkgList) + if not pkgList: + sys.exit("\n" + "Nothing to uninstall, please give at least one package name; quitting" + "\n") + else: + startUninstall(pkgList) elif "force-uninstall" in sys.argv[1:]: - startUninstallForce(pkgList) + if not pkgList: + sys.exit("\n" + "Nothing to force uninstall, please give at least one package name; quitting" + "\n") + else: + startUninstallForce(pkgList) elif "remove-orphans" in sys.argv[1:]: removeOrphans() elif "update" in sys.argv[1:]: @@ -20,7 +29,10 @@ if "__main__" == __name__: elif "upgrade" in sys.argv[1:]: startUpgrade() elif "search" in sys.argv[1:]: - startSearch(pkgList) + if not pkgList: + sys.exit("\n" + "Nothing to search, please give at least one package name; quitting" + "\n") + else: + startSearch(pkgList) elif "spmsync" in sys.argv[1:]: startSyncSPM() elif "rescue" in sys.argv[1:]: -- cgit v1.2.3