From 2de2538cc9786c203a66df5d2f82bdc5bded2f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= Date: Fri, 16 Oct 2015 23:24:07 +0200 Subject: [PATCH] Shortcut to select all package in once --- agetpkg | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/agetpkg b/agetpkg index fd5db0f..7cefe69 100755 --- a/agetpkg +++ b/agetpkg @@ -282,6 +282,7 @@ def list_packages(packages, long=False): def select_packages(packages): """select a package in a list""" + # shortcut to one package if len(packages) == 1: yield packages[0] else: @@ -292,9 +293,15 @@ def select_packages(packages): print("{:{pad}} {}".format(i, pkg, pad=pad)) selection = "" while not match("^(\d+ ){0,}\d+$", selection): - selection = input("Select packages: ").strip() + selection = input("Select packages (* for all): ").strip() if selection == "": return + # shortcut to select all packages + if selection == "*": + for pkg in packages: + yield pkg + return + # parse selection numbers = [ int(x) for x in selection.split(" ") ] for num in numbers: if num in index.keys(): -- GitLab