@@ -31,10 +31,7 @@ def main():
31
31
parser .add_argument ('--human' , action = 'store_true' , default = False , help = 'Make size human readable.' )
32
32
parser .add_argument ('path' , type = str , default = '' , help = 'Path' , nargs = '?' )
33
33
arguments = parser .parse_args ()
34
- try :
35
- app (arguments )
36
- except TemplateNotFound as e :
37
- raise IndexGeneratorTemplateNotFound (str (e ))
34
+ app (arguments )
38
35
except BaseException as e :
39
36
if e .__class__ .__name__ != 'SystemExit' :
40
37
print ('[Exception] ' + e .__class__ .__name__ + ': ' + str (e ))
@@ -53,13 +50,16 @@ def app(args):
53
50
sys .exit (0 )
54
51
if not os .path .exists (args .path ):
55
52
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 ))
63
63
64
64
65
65
def generate_once (theme , root , files , name , if_print , base = os .path .sep , human = False , template = '' ):
0 commit comments