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:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user