@@ -53,21 +53,27 @@ def index_command(index_dict, help_command):
53
53
index_command (child , sub_help_command )
54
54
55
55
56
- def main ():
57
- parser = argparse .ArgumentParser ()
58
- parser .add_argument ('-o' , '--output' ,
59
- help = 'The filename of the index file.' )
60
- args = parser .parse_args ()
61
- if args .output is None :
62
- args .output = determine_index_filename ()
56
+ def write_index (output_filename = None ):
57
+ if output_filename is None :
58
+ output_filename = determine_index_filename ()
63
59
driver = awscli .clidriver .create_clidriver ()
64
60
help_command = driver .create_help_command ()
65
61
index = {'aws' : new_index ()}
66
62
current = index ['aws' ]
67
63
index_command (current , help_command )
68
64
69
65
result = pprint .pformat (index )
70
- if not os .path .isdir (os .path .dirname (args . output )):
71
- os .makedirs (os .path .dirname (args . output ))
72
- with open (args . output , 'w' ) as f :
66
+ if not os .path .isdir (os .path .dirname (output_filename )):
67
+ os .makedirs (os .path .dirname (output_filename ))
68
+ with open (output_filename , 'w' ) as f :
73
69
f .write (result )
70
+
71
+
72
+ def main ():
73
+ parser = argparse .ArgumentParser ()
74
+ parser .add_argument ('-o' , '--output' ,
75
+ help = 'The filename of the index file.' )
76
+ args = parser .parse_args ()
77
+ if args .output is None :
78
+ args .output = determine_index_filename ()
79
+ write_index (args .output )
0 commit comments