Loading agetpkg +8 −1 Original line number Original line Diff line number Diff line Loading @@ -282,6 +282,7 @@ def list_packages(packages, long=False): def select_packages(packages): def select_packages(packages): """select a package in a list""" """select a package in a list""" # shortcut to one package if len(packages) == 1: if len(packages) == 1: yield packages[0] yield packages[0] else: else: Loading @@ -292,9 +293,15 @@ def select_packages(packages): print("{:{pad}} {}".format(i, pkg, pad=pad)) print("{:{pad}} {}".format(i, pkg, pad=pad)) selection = "" selection = "" while not match("^(\d+ ){0,}\d+$", selection): while not match("^(\d+ ){0,}\d+$", selection): selection = input("Select packages: ").strip() selection = input("Select packages (* for all): ").strip() if selection == "": if selection == "": return 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(" ") ] numbers = [ int(x) for x in selection.split(" ") ] for num in numbers: for num in numbers: if num in index.keys(): if num in index.keys(): Loading Loading
agetpkg +8 −1 Original line number Original line Diff line number Diff line Loading @@ -282,6 +282,7 @@ def list_packages(packages, long=False): def select_packages(packages): def select_packages(packages): """select a package in a list""" """select a package in a list""" # shortcut to one package if len(packages) == 1: if len(packages) == 1: yield packages[0] yield packages[0] else: else: Loading @@ -292,9 +293,15 @@ def select_packages(packages): print("{:{pad}} {}".format(i, pkg, pad=pad)) print("{:{pad}} {}".format(i, pkg, pad=pad)) selection = "" selection = "" while not match("^(\d+ ){0,}\d+$", selection): while not match("^(\d+ ){0,}\d+$", selection): selection = input("Select packages: ").strip() selection = input("Select packages (* for all): ").strip() if selection == "": if selection == "": return 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(" ") ] numbers = [ int(x) for x in selection.split(" ") ] for num in numbers: for num in numbers: if num in index.keys(): if num in index.keys(): Loading