Skip to content

Commit 8f4111c

Browse files
fix
1 parent 39e5338 commit 8f4111c

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

index_generator/__main__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ def main():
3131
parser.add_argument('--human', action='store_true', default=False, help='Make size human readable.')
3232
parser.add_argument('path', type=str, default='', help='Path', nargs='?')
3333
arguments = parser.parse_args()
34-
try:
35-
app(arguments)
36-
except TemplateNotFound as e:
37-
raise IndexGeneratorTemplateNotFound(str(e))
34+
app(arguments)
3835
except BaseException as e:
3936
if e.__class__.__name__ != 'SystemExit':
4037
print('[Exception] ' + e.__class__.__name__ + ': ' + str(e))
@@ -53,13 +50,16 @@ def app(args):
5350
sys.exit(0)
5451
if not os.path.exists(args.path):
5552
raise IndexGeneratorPathNotExists('Path does not exists')
56-
if args.no_recursive:
57-
os.chdir(args.path)
58-
generate_once(args.theme, '.', os.listdir('.'), args.name, args.print, base=args.root, human=args.human,
59-
template=os.path.abspath(args.template) if args.template else '')
60-
else:
61-
generate_recursively(args.theme, args.path, args.name, args.print, args.depth, base=args.root, human=args.human,
62-
template=os.path.abspath(args.template) if args.template else '')
53+
try:
54+
if args.no_recursive:
55+
os.chdir(args.path)
56+
generate_once(args.theme, '.', os.listdir('.'), args.name, args.print, base=args.root, human=args.human,
57+
template=os.path.abspath(args.template) if args.template else '')
58+
else:
59+
generate_recursively(args.theme, args.path, args.name, args.print, args.depth, base=args.root, human=args.human,
60+
template=os.path.abspath(args.template) if args.template else '')
61+
except TemplateNotFound as e:
62+
raise IndexGeneratorTemplateNotFound(str(e))
6363

6464

6565
def generate_once(theme, root, files, name, if_print, base=os.path.sep, human=False, template=''):

0 commit comments

Comments
 (0)