File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 66 mkdoc_out = None
77 mkdoc_help = False
88 mkdoc_args = []
9+ docstring_width = None
910
1011 i = 1
1112 while i < len (sys .argv ):
1819 i += 1 # Skip next
1920 elif arg .startswith ('-o' ):
2021 mkdoc_out = arg [2 :]
22+ elif arg == '-w' :
23+ docstring_width = int (sys .argv [i + 1 ])
24+ i += 1 # Skip next
25+ elif arg .startswith ('-w' ):
26+ docstring_width = int (arg [2 :])
2127 elif arg == '-I' :
2228 # Concatenate include directive and path
2329 mkdoc_args .append (arg + sys .argv [i + 1 ])
3844
3945 -o <filename> Write to the specified filename (default: use stdout)
4046
47+ -w <width> Specify docstring width before wrapping
48+
4149 -I <path> Specify an include directory
4250
4351 -Dkey=value Specify a compiler definition
4452
4553(Other compiler flags that Clang understands can also be supplied)""" )
4654 else :
47- mkdoc (mkdoc_args , mkdoc_out )
55+ mkdoc (mkdoc_args , docstring_width , mkdoc_out )
Original file line number Diff line number Diff line change 6262job_count = cpu_count ()
6363job_semaphore = Semaphore (job_count )
6464errors_detected = False
65+ docstring_width = int (70 )
6566
6667
6768class NoFilenamesError (ValueError ):
@@ -165,7 +166,7 @@ def process_comment(comment):
165166 wrapper .expand_tabs = True
166167 wrapper .replace_whitespace = True
167168 wrapper .drop_whitespace = True
168- wrapper .width = 70
169+ wrapper .width = docstring_width
169170 wrapper .initial_indent = wrapper .subsequent_indent = ''
170171
171172 result = ''
@@ -376,7 +377,10 @@ def write_header(comments, out_file=sys.stdout):
376377''' , file = out_file )
377378
378379
379- def mkdoc (args , output = None ):
380+ def mkdoc (args , width , output = None ):
381+ if width != None :
382+ global docstring_width
383+ docstring_width = int (width )
380384 comments = extract_all (args )
381385 if errors_detected :
382386 return
You can’t perform that action at this time.
0 commit comments