##// END OF EJS Templates
help: format command and option list help using RST...
Olav Reinert -
r16853:7863ff38 default
parent child Browse files
Show More
@@ -3205,30 +3205,29 b' def help_(ui, name=None, unknowncmd=Fals'
3205 ui.status(_('no commands defined\n'))
3205 ui.status(_('no commands defined\n'))
3206 return
3206 return
3207
3207
3208 ui.status(header)
3208 rst = []
3209 if not ui.quiet:
3210 rst.append(header)
3209 fns = sorted(h)
3211 fns = sorted(h)
3210 m = max(map(len, fns))
3211 for f in fns:
3212 for f in fns:
3212 if ui.verbose:
3213 if ui.verbose:
3213 commands = cmds[f].replace("|",", ")
3214 commands = cmds[f].replace("|",", ")
3214 ui.write(" %s:\n %s\n"%(commands, h[f]))
3215 rst.append(" :%s: %s\n" % (commands, h[f]))
3215 else:
3216 else:
3216 ui.write('%s\n' % (util.wrap(h[f], textwidth,
3217 rst.append(' :%s: %s\n' % (f, h[f]))
3217 initindent=' %-*s ' % (m, f),
3218 hangindent=' ' * (m + 4))))
3219
3218
3220 if not name:
3219 if not name:
3221 rst = help.listexts(_('enabled extensions:'), extensions.enabled())
3220 exts = help.listexts(_('enabled extensions:'), extensions.enabled())
3222 if rst:
3221 if exts:
3223 ui.write("\n%s" % minirst.format('\n'.join(rst), textwidth))
3222 rst.append('\n')
3224
3223 rst.extend(exts)
3225 ui.write(_("\nadditional help topics:\n\n"))
3224
3225 rst.append(_("\nadditional help topics:\n\n"))
3226 topics = []
3226 topics = []
3227 for names, header, doc in help.helptable:
3227 for names, header, doc in help.helptable:
3228 topics.append((sorted(names, key=len, reverse=True)[0], header))
3228 topics.append((sorted(names, key=len, reverse=True)[0], header))
3229 topics_len = max([len(s[0]) for s in topics])
3230 for t, desc in topics:
3229 for t, desc in topics:
3231 ui.write(" %-*s %s\n" % (topics_len, t, desc))
3230 rst.append(" :%s: %s\n" % (t, desc))
3232
3231
3233 optlist = []
3232 optlist = []
3234 if not ui.quiet:
3233 if not ui.quiet:
@@ -3249,17 +3248,12 b' def help_(ui, name=None, unknowncmd=Fals'
3249 'global options') % (name and " " + name or "")
3248 'global options') % (name and " " + name or "")
3250 optlist.append((msg, ()))
3249 optlist.append((msg, ()))
3251
3250
3252 if not optlist:
3251 if optlist:
3253 return
3252 for title, options in optlist:
3254
3253 rst.append('\n%s\n' % title)
3255 rst = ''
3254 if options:
3256 for title, options in optlist:
3255 rst.append('\n%s\n' % help.optrst(options, ui.verbose))
3257 rst += '\n%s\n' % title
3256 ui.write(minirst.format(''.join(rst), textwidth))
3258 if options:
3259 rst += "\n"
3260 rst += help.optrst(options, ui.verbose)
3261 rst += '\n'
3262 ui.write('\n' + minirst.format(rst, textwidth))
3263
3257
3264 def helptopic(name):
3258 def helptopic(name):
3265 for names, header, doc in help.helptable:
3259 for names, header, doc in help.helptable:
@@ -340,24 +340,24 b' invalid global arguments for normal comm'
340
340
341 basic commands:
341 basic commands:
342
342
343 add add the specified files on the next commit
343 add add the specified files on the next commit
344 annotate show changeset information by line for each file
344 annotate show changeset information by line for each file
345 clone make a copy of an existing repository
345 clone make a copy of an existing repository
346 commit commit the specified files or all outstanding changes
346 commit commit the specified files or all outstanding changes
347 diff diff repository (or selected files)
347 diff diff repository (or selected files)
348 export dump the header and diffs for one or more changesets
348 export dump the header and diffs for one or more changesets
349 forget forget the specified files on the next commit
349 forget forget the specified files on the next commit
350 init create a new repository in the given directory
350 init create a new repository in the given directory
351 log show revision history of entire repository or files
351 log show revision history of entire repository or files
352 merge merge working directory with another revision
352 merge merge working directory with another revision
353 phase set or show the current phase name
353 phase set or show the current phase name
354 pull pull changes from the specified source
354 pull pull changes from the specified source
355 push push changes to the specified destination
355 push push changes to the specified destination
356 remove remove the specified files on the next commit
356 remove remove the specified files on the next commit
357 serve start stand-alone webserver
357 serve start stand-alone webserver
358 status show changed files in the working directory
358 status show changed files in the working directory
359 summary summarize working directory state
359 summary summarize working directory state
360 update update working directory (or switch revisions)
360 update update working directory (or switch revisions)
361
361
362 use "hg help" for the full list of commands or "hg -v" for details
362 use "hg help" for the full list of commands or "hg -v" for details
363 [255]
363 [255]
@@ -367,24 +367,24 b' invalid global arguments for normal comm'
367
367
368 basic commands:
368 basic commands:
369
369
370 add add the specified files on the next commit
370 add add the specified files on the next commit
371 annotate show changeset information by line for each file
371 annotate show changeset information by line for each file
372 clone make a copy of an existing repository
372 clone make a copy of an existing repository
373 commit commit the specified files or all outstanding changes
373 commit commit the specified files or all outstanding changes
374 diff diff repository (or selected files)
374 diff diff repository (or selected files)
375 export dump the header and diffs for one or more changesets
375 export dump the header and diffs for one or more changesets
376 forget forget the specified files on the next commit
376 forget forget the specified files on the next commit
377 init create a new repository in the given directory
377 init create a new repository in the given directory
378 log show revision history of entire repository or files
378 log show revision history of entire repository or files
379 merge merge working directory with another revision
379 merge merge working directory with another revision
380 phase set or show the current phase name
380 phase set or show the current phase name
381 pull pull changes from the specified source
381 pull pull changes from the specified source
382 push push changes to the specified destination
382 push push changes to the specified destination
383 remove remove the specified files on the next commit
383 remove remove the specified files on the next commit
384 serve start stand-alone webserver
384 serve start stand-alone webserver
385 status show changed files in the working directory
385 status show changed files in the working directory
386 summary summarize working directory state
386 summary summarize working directory state
387 update update working directory (or switch revisions)
387 update update working directory (or switch revisions)
388
388
389 use "hg help" for the full list of commands or "hg -v" for details
389 use "hg help" for the full list of commands or "hg -v" for details
390 [255]
390 [255]
@@ -394,24 +394,24 b' invalid global arguments for normal comm'
394
394
395 basic commands:
395 basic commands:
396
396
397 add add the specified files on the next commit
397 add add the specified files on the next commit
398 annotate show changeset information by line for each file
398 annotate show changeset information by line for each file
399 clone make a copy of an existing repository
399 clone make a copy of an existing repository
400 commit commit the specified files or all outstanding changes
400 commit commit the specified files or all outstanding changes
401 diff diff repository (or selected files)
401 diff diff repository (or selected files)
402 export dump the header and diffs for one or more changesets
402 export dump the header and diffs for one or more changesets
403 forget forget the specified files on the next commit
403 forget forget the specified files on the next commit
404 init create a new repository in the given directory
404 init create a new repository in the given directory
405 log show revision history of entire repository or files
405 log show revision history of entire repository or files
406 merge merge working directory with another revision
406 merge merge working directory with another revision
407 phase set or show the current phase name
407 phase set or show the current phase name
408 pull pull changes from the specified source
408 pull pull changes from the specified source
409 push push changes to the specified destination
409 push push changes to the specified destination
410 remove remove the specified files on the next commit
410 remove remove the specified files on the next commit
411 serve start stand-alone webserver
411 serve start stand-alone webserver
412 status show changed files in the working directory
412 status show changed files in the working directory
413 summary summarize working directory state
413 summary summarize working directory state
414 update update working directory (or switch revisions)
414 update update working directory (or switch revisions)
415
415
416 use "hg help" for the full list of commands or "hg -v" for details
416 use "hg help" for the full list of commands or "hg -v" for details
417 [255]
417 [255]
@@ -16,24 +16,24 b' Mercurial Distributed SCM'
16
16
17 basic commands:
17 basic commands:
18
18
19 add add the specified files on the next commit
19 add add the specified files on the next commit
20 annotate show changeset information by line for each file
20 annotate show changeset information by line for each file
21 clone make a copy of an existing repository
21 clone make a copy of an existing repository
22 commit commit the specified files or all outstanding changes
22 commit commit the specified files or all outstanding changes
23 diff diff repository (or selected files)
23 diff diff repository (or selected files)
24 export dump the header and diffs for one or more changesets
24 export dump the header and diffs for one or more changesets
25 forget forget the specified files on the next commit
25 forget forget the specified files on the next commit
26 init create a new repository in the given directory
26 init create a new repository in the given directory
27 log show revision history of entire repository or files
27 log show revision history of entire repository or files
28 merge merge working directory with another revision
28 merge merge working directory with another revision
29 phase set or show the current phase name
29 phase set or show the current phase name
30 pull pull changes from the specified source
30 pull pull changes from the specified source
31 push push changes to the specified destination
31 push push changes to the specified destination
32 remove remove the specified files on the next commit
32 remove remove the specified files on the next commit
33 serve start stand-alone webserver
33 serve start stand-alone webserver
34 status show changed files in the working directory
34 status show changed files in the working directory
35 summary summarize working directory state
35 summary summarize working directory state
36 update update working directory (or switch revisions)
36 update update working directory (or switch revisions)
37
37
38 use "hg help" for the full list of commands or "hg -v" for details
38 use "hg help" for the full list of commands or "hg -v" for details
39 runcommand id --quiet
39 runcommand id --quiet
@@ -178,8 +178,7 b" Check hgweb's load order:"
178
178
179 list of commands:
179 list of commands:
180
180
181 foo:
181 foo yet another foo command
182 yet another foo command
183
182
184 global options:
183 global options:
185
184
@@ -208,10 +207,8 b" Check hgweb's load order:"
208
207
209 list of commands:
208 list of commands:
210
209
211 debugfoobar:
210 debugfoobar yet another debug command
212 yet another debug command
211 foo yet another foo command
213 foo:
214 yet another foo command
215
212
216 global options:
213 global options:
217
214
@@ -328,7 +325,7 b' Extension module help vs command help:'
328
325
329 list of commands:
326 list of commands:
330
327
331 extdiff use external program to diff repository (or selected files)
328 extdiff use external program to diff repository (or selected files)
332
329
333 use "hg -v help extdiff" to show builtin aliases and global options
330 use "hg -v help extdiff" to show builtin aliases and global options
334
331
@@ -5,46 +5,46 b' Short help:'
5
5
6 basic commands:
6 basic commands:
7
7
8 add add the specified files on the next commit
8 add add the specified files on the next commit
9 annotate show changeset information by line for each file
9 annotate show changeset information by line for each file
10 clone make a copy of an existing repository
10 clone make a copy of an existing repository
11 commit commit the specified files or all outstanding changes
11 commit commit the specified files or all outstanding changes
12 diff diff repository (or selected files)
12 diff diff repository (or selected files)
13 export dump the header and diffs for one or more changesets
13 export dump the header and diffs for one or more changesets
14 forget forget the specified files on the next commit
14 forget forget the specified files on the next commit
15 init create a new repository in the given directory
15 init create a new repository in the given directory
16 log show revision history of entire repository or files
16 log show revision history of entire repository or files
17 merge merge working directory with another revision
17 merge merge working directory with another revision
18 phase set or show the current phase name
18 phase set or show the current phase name
19 pull pull changes from the specified source
19 pull pull changes from the specified source
20 push push changes to the specified destination
20 push push changes to the specified destination
21 remove remove the specified files on the next commit
21 remove remove the specified files on the next commit
22 serve start stand-alone webserver
22 serve start stand-alone webserver
23 status show changed files in the working directory
23 status show changed files in the working directory
24 summary summarize working directory state
24 summary summarize working directory state
25 update update working directory (or switch revisions)
25 update update working directory (or switch revisions)
26
26
27 use "hg help" for the full list of commands or "hg -v" for details
27 use "hg help" for the full list of commands or "hg -v" for details
28
28
29 $ hg -q
29 $ hg -q
30 add add the specified files on the next commit
30 add add the specified files on the next commit
31 annotate show changeset information by line for each file
31 annotate show changeset information by line for each file
32 clone make a copy of an existing repository
32 clone make a copy of an existing repository
33 commit commit the specified files or all outstanding changes
33 commit commit the specified files or all outstanding changes
34 diff diff repository (or selected files)
34 diff diff repository (or selected files)
35 export dump the header and diffs for one or more changesets
35 export dump the header and diffs for one or more changesets
36 forget forget the specified files on the next commit
36 forget forget the specified files on the next commit
37 init create a new repository in the given directory
37 init create a new repository in the given directory
38 log show revision history of entire repository or files
38 log show revision history of entire repository or files
39 merge merge working directory with another revision
39 merge merge working directory with another revision
40 phase set or show the current phase name
40 phase set or show the current phase name
41 pull pull changes from the specified source
41 pull pull changes from the specified source
42 push push changes to the specified destination
42 push push changes to the specified destination
43 remove remove the specified files on the next commit
43 remove remove the specified files on the next commit
44 serve start stand-alone webserver
44 serve start stand-alone webserver
45 status show changed files in the working directory
45 status show changed files in the working directory
46 summary summarize working directory state
46 summary summarize working directory state
47 update update working directory (or switch revisions)
47 update update working directory (or switch revisions)
48
48
49 $ hg help
49 $ hg help
50 Mercurial Distributed SCM
50 Mercurial Distributed SCM
@@ -211,42 +211,26 b' Test short command list with verbose opt'
211
211
212 basic commands:
212 basic commands:
213
213
214 add:
214 add add the specified files on the next commit
215 add the specified files on the next commit
215 annotate, blame
216 annotate, blame:
216 show changeset information by line for each file
217 show changeset information by line for each file
217 clone make a copy of an existing repository
218 clone:
218 commit, ci commit the specified files or all outstanding changes
219 make a copy of an existing repository
219 diff diff repository (or selected files)
220 commit, ci:
220 export dump the header and diffs for one or more changesets
221 commit the specified files or all outstanding changes
221 forget forget the specified files on the next commit
222 diff:
222 init create a new repository in the given directory
223 diff repository (or selected files)
223 log, history show revision history of entire repository or files
224 export:
224 merge merge working directory with another revision
225 dump the header and diffs for one or more changesets
225 phase set or show the current phase name
226 forget:
226 pull pull changes from the specified source
227 forget the specified files on the next commit
227 push push changes to the specified destination
228 init:
228 remove, rm remove the specified files on the next commit
229 create a new repository in the given directory
229 serve start stand-alone webserver
230 log, history:
230 status, st show changed files in the working directory
231 show revision history of entire repository or files
231 summary, sum summarize working directory state
232 merge:
232 update, up, checkout, co
233 merge working directory with another revision
233 update working directory (or switch revisions)
234 phase:
235 set or show the current phase name
236 pull:
237 pull changes from the specified source
238 push:
239 push changes to the specified destination
240 remove, rm:
241 remove the specified files on the next commit
242 serve:
243 start stand-alone webserver
244 status, st:
245 show changed files in the working directory
246 summary, sum:
247 summarize working directory state
248 update, up, checkout, co:
249 update working directory (or switch revisions)
250
234
251 global options:
235 global options:
252
236
@@ -389,8 +373,8 b' Test ambiguous command help'
389 $ hg help ad
373 $ hg help ad
390 list of commands:
374 list of commands:
391
375
392 add add the specified files on the next commit
376 add add the specified files on the next commit
393 addremove add all new files, delete all missing files
377 addremove add all new files, delete all missing files
394
378
395 use "hg -v help ad" to show builtin aliases and global options
379 use "hg -v help ad" to show builtin aliases and global options
396
380
@@ -539,24 +523,24 b' Test command without options'
539
523
540 basic commands:
524 basic commands:
541
525
542 add add the specified files on the next commit
526 add add the specified files on the next commit
543 annotate show changeset information by line for each file
527 annotate show changeset information by line for each file
544 clone make a copy of an existing repository
528 clone make a copy of an existing repository
545 commit commit the specified files or all outstanding changes
529 commit commit the specified files or all outstanding changes
546 diff diff repository (or selected files)
530 diff diff repository (or selected files)
547 export dump the header and diffs for one or more changesets
531 export dump the header and diffs for one or more changesets
548 forget forget the specified files on the next commit
532 forget forget the specified files on the next commit
549 init create a new repository in the given directory
533 init create a new repository in the given directory
550 log show revision history of entire repository or files
534 log show revision history of entire repository or files
551 merge merge working directory with another revision
535 merge merge working directory with another revision
552 phase set or show the current phase name
536 phase set or show the current phase name
553 pull pull changes from the specified source
537 pull pull changes from the specified source
554 push push changes to the specified destination
538 push push changes to the specified destination
555 remove remove the specified files on the next commit
539 remove remove the specified files on the next commit
556 serve start stand-alone webserver
540 serve start stand-alone webserver
557 status show changed files in the working directory
541 status show changed files in the working directory
558 summary summarize working directory state
542 summary summarize working directory state
559 update update working directory (or switch revisions)
543 update update working directory (or switch revisions)
560
544
561 use "hg help" for the full list of commands or "hg -v" for details
545 use "hg help" for the full list of commands or "hg -v" for details
562 [255]
546 [255]
@@ -567,24 +551,24 b' Test command without options'
567
551
568 basic commands:
552 basic commands:
569
553
570 add add the specified files on the next commit
554 add add the specified files on the next commit
571 annotate show changeset information by line for each file
555 annotate show changeset information by line for each file
572 clone make a copy of an existing repository
556 clone make a copy of an existing repository
573 commit commit the specified files or all outstanding changes
557 commit commit the specified files or all outstanding changes
574 diff diff repository (or selected files)
558 diff diff repository (or selected files)
575 export dump the header and diffs for one or more changesets
559 export dump the header and diffs for one or more changesets
576 forget forget the specified files on the next commit
560 forget forget the specified files on the next commit
577 init create a new repository in the given directory
561 init create a new repository in the given directory
578 log show revision history of entire repository or files
562 log show revision history of entire repository or files
579 merge merge working directory with another revision
563 merge merge working directory with another revision
580 phase set or show the current phase name
564 phase set or show the current phase name
581 pull pull changes from the specified source
565 pull pull changes from the specified source
582 push push changes to the specified destination
566 push push changes to the specified destination
583 remove remove the specified files on the next commit
567 remove remove the specified files on the next commit
584 serve start stand-alone webserver
568 serve start stand-alone webserver
585 status show changed files in the working directory
569 status show changed files in the working directory
586 summary summarize working directory state
570 summary summarize working directory state
587 update update working directory (or switch revisions)
571 update update working directory (or switch revisions)
588
572
589 use "hg help" for the full list of commands or "hg -v" for details
573 use "hg help" for the full list of commands or "hg -v" for details
590 [255]
574 [255]
@@ -711,7 +695,7 b' Test list of commands with command with '
711
695
712 list of commands:
696 list of commands:
713
697
714 nohelp (no help text available)
698 nohelp (no help text available)
715
699
716 use "hg -v help helpext" to show builtin aliases and global options
700 use "hg -v help helpext" to show builtin aliases and global options
717
701
@@ -19,24 +19,24 b''
19
19
20 basic commands:
20 basic commands:
21
21
22 add add the specified files on the next commit
22 add add the specified files on the next commit
23 annotate show changeset information by line for each file
23 annotate show changeset information by line for each file
24 clone make a copy of an existing repository
24 clone make a copy of an existing repository
25 commit commit the specified files or all outstanding changes
25 commit commit the specified files or all outstanding changes
26 diff diff repository (or selected files)
26 diff diff repository (or selected files)
27 export dump the header and diffs for one or more changesets
27 export dump the header and diffs for one or more changesets
28 forget forget the specified files on the next commit
28 forget forget the specified files on the next commit
29 init create a new repository in the given directory
29 init create a new repository in the given directory
30 log show revision history of entire repository or files
30 log show revision history of entire repository or files
31 merge merge working directory with another revision
31 merge merge working directory with another revision
32 phase set or show the current phase name
32 phase set or show the current phase name
33 pull pull changes from the specified source
33 pull pull changes from the specified source
34 push push changes to the specified destination
34 push push changes to the specified destination
35 remove remove the specified files on the next commit
35 remove remove the specified files on the next commit
36 serve start stand-alone webserver
36 serve start stand-alone webserver
37 status show changed files in the working directory
37 status show changed files in the working directory
38 summary summarize working directory state
38 summary summarize working directory state
39 update update working directory (or switch revisions)
39 update update working directory (or switch revisions)
40
40
41 use "hg help" for the full list of commands or "hg -v" for details
41 use "hg help" for the full list of commands or "hg -v" for details
42 [255]
42 [255]
General Comments 0
You need to be logged in to leave comments. Login now