#!python3 import os import sys type_ = sys.argv[1] command = "git-pw {0} list --page {1} -f csv" if type_ == 'patch': command+= " --state 'new'" for i in range(1, 100): # print(command.format(type_, i)) ret = os.system(command.format(type_, i)) if ret: break