comparison svncommand.py @ 94:b5651f53e7ae

svncommand: Fix help to use ui.status() and be a bit smarter about displaying help.
author Augie Fackler <durin42@gmail.com>
date Wed, 19 Nov 2008 10:16:50 -0600
parents f537eb456cf7
children 91ce18fa0375
comparison
equal deleted inserted replaced
93:f537eb456cf7 94:b5651f53e7ae
54 54
55 @register_subcommand('help') 55 @register_subcommand('help')
56 def help_command(ui, args=None, **opts): 56 def help_command(ui, args=None, **opts):
57 """Get help on the subsubcommands. 57 """Get help on the subsubcommands.
58 """ 58 """
59 if args and args[0] in svn_subcommands: 59 if args:
60 print svn_subcommands[args[0]].__doc__.strip() 60 subcommand = args[0]
61 if subcommand not in svn_subcommands:
62 candidates = []
63 for c in svn_subcommands:
64 if c.startswith(subcommand):
65 candidates.append(c)
66 if len(candidates) == 1:
67 subcommand = candidates[0]
68 elif len(candidates) > 1:
69 ui.status('Ambiguous command. Could have been:\n%s\n' %
70 ' '.join(candidates))
71 return
72 doc = svn_subcommands[subcommand].__doc__
73 if doc is None:
74 doc = "No documentation available for %s." % subcommand
75 ui.status(doc.strip(), '\n')
61 return 76 return
62 print 'Valid commands:', ' '.join(sorted(svn_subcommands.keys())) 77 ui.status('Valid commands: ', ' '.join(sorted(svn_subcommands.keys())),
78 '\n')
63 79
64 @register_subcommand('gentags') 80 @register_subcommand('gentags')
65 def generate_hg_tags(ui, hg_repo_path, **opts): 81 def generate_hg_tags(ui, hg_repo_path, **opts):
66 """Save tags to .hg/localtags 82 """Save tags to .hg/localtags
67 """ 83 """