Use pipeable.input_many.
This commit is contained in:
parent
1d8d85cb8a
commit
af9ae8f5ac
1 changed files with 4 additions and 3 deletions
7
crc32.py
7
crc32.py
|
@ -1,4 +1,5 @@
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import zlib
|
import zlib
|
||||||
|
|
||||||
|
@ -8,9 +9,9 @@ from voussoirkit import winglob
|
||||||
def crc32_argparse(args):
|
def crc32_argparse(args):
|
||||||
files = (
|
files = (
|
||||||
file
|
file
|
||||||
for arg in args.source
|
for pattern in pipeable.input_many(args.patterns)
|
||||||
for pattern in pipeable.input(arg)
|
|
||||||
for file in winglob.glob(pattern)
|
for file in winglob.glob(pattern)
|
||||||
|
if os.path.isfile(file)
|
||||||
)
|
)
|
||||||
for file in files:
|
for file in files:
|
||||||
try:
|
try:
|
||||||
|
@ -23,7 +24,7 @@ def crc32_argparse(args):
|
||||||
def main(argv):
|
def main(argv):
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
|
|
||||||
parser.add_argument('source', nargs='+')
|
parser.add_argument('patterns', nargs='+')
|
||||||
parser.set_defaults(func=crc32_argparse)
|
parser.set_defaults(func=crc32_argparse)
|
||||||
|
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
|
|
Loading…
Reference in a new issue