File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change 6
6
import shutil
7
7
import sys
8
8
import re
9
-
9
+ import argparse
10
10
11
11
def copy_if_out_of_date (original , derived ):
12
12
if (not os .path .exists (derived ) or
@@ -174,17 +174,23 @@ def all():
174
174
'as spurious changes in your \' git status\' :\n \t {}'
175
175
.format ('\n \t ' .join (symlink_warnings )))
176
176
177
- if len (sys .argv )> 1 :
178
- if '--small' in sys .argv [1 :]:
179
- small_docs = True
180
- sys .argv .remove ('--small' )
181
- for arg in sys .argv [1 :]:
182
- func = funcd .get (arg )
177
+ parser = argparse .ArgumentParser (description = 'Build matplotlib docs' )
178
+ parser .add_argument ("cmd" , help = ("Command to execute. Can be multiple. "
179
+ "Valid options are: %s" % (funcd .keys ())), nargs = '*' )
180
+ parser .add_argument ("--small" ,
181
+ help = "Smaller docs with only low res png figures" ,
182
+ action = "store_true" )
183
+ args = parser .parse_args ()
184
+ if args .small :
185
+ small_docs = True
186
+
187
+ if args .cmd :
188
+ for command in args .cmd :
189
+ func = funcd .get (command )
183
190
if func is None :
184
- raise SystemExit ('Do not know how to handle %s; valid args are %s' % (
185
- arg , funcd .keys ()))
191
+ raise SystemExit (( 'Do not know how to handle %s; valid commands'
192
+ ' are %s' % ( command , funcd .keys () )))
186
193
func ()
187
194
else :
188
- small_docs = False
189
195
all ()
190
196
os .chdir (current_dir )
You can’t perform that action at this time.
0 commit comments