yori-aggr should support more flexible file input arguments
It would be nice if yori-aggr was a bit more flexible regarding how it got its input file list. This can possibly be achieved without breaking backward compatibility by doing something like this:
parser = ArgumentParser(...)
parser.add_argument(
'filelist', help=(
"Can be a file path to an input file containing a single input file per line, "
"or '-' to read input list one per line from standard input, or a comma "
"separated list of files to use as input."
)
)
args = parser.parse_args()
# read file list from stdin
if args.filelist == '-':
inputs = [l.strip() for l in sys.stdin.read() if l.strip()]
# if the file exists, assume it is a file and try to fetch inputs
elif os.path.exists(args.filelist):
inputs = [l.strip() for l in open(args.filelist).read() if l.strip()]
else:
inputs = [f.strip() for f in args.filelist.split(',')]