1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-17 19:51:45 +00:00

Use glob to resolve file globs

For systems where the shell doesn't do glob expansion, eg Windows.
This commit is contained in:
blue
2014-10-28 18:34:14 +00:00
parent eaa387a9d6
commit ac794eff85

View File

@@ -25,6 +25,7 @@ __docformat__ = 'restructuredtext en'
import os import os
import sys import sys
from glob import glob
from json import loads from json import loads
from urllib.request import Request, urlopen from urllib.request import Request, urlopen
from re import split, sub, compile from re import split, sub, compile
@@ -57,11 +58,15 @@ def main(argv=None):
parser = makeParser() parser = makeParser()
options, args = parser.parse_args(argv) options, args = parser.parse_args(argv)
checkOptions() checkOptions()
if len(args) < 1: if len(args) == 0:
parser.print_help() parser.print_help()
return return
for source in args: sources = [source for arg in args for source in glob(arg)]
if len(args) > 1: if len(sources) == 0:
print('No matching files found.')
return
for source in sources:
if len(sources) > 1:
print('\nWorking on {}...'.format(source)) print('\nWorking on {}...'.format(source))
outputPath = makeBook(source) outputPath = makeBook(source)
return outputPath return outputPath