Rev 2460: Add a get_help_topic method to commands.Command. in file:///home/robertc/source/baz/help-contexts/

Robert Collins robertc at robertcollins.net
Fri Apr 20 06:39:22 BST 2007


At file:///home/robertc/source/baz/help-contexts/

------------------------------------------------------------
revno: 2460
revision-id: robertc at robertcollins.net-20070420053919-edekarog2f6qvyzx
parent: robertc at robertcollins.net-20070420053658-gpwvs7wkmivmlzlx
committer: Robert Collins <robertc at robertcollins.net>
branch nick: help-contexts
timestamp: Fri 2007-04-20 15:39:19 +1000
message:
  Add a get_help_topic method to commands.Command.
modified:
  bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
  bzrlib/tests/test_help.py      test_help.py-20070419045354-6q6rq15j9e2n5fna-1
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2007-04-20 03:54:06 +0000
+++ b/bzrlib/commands.py	2007-04-20 05:39:19 +0000
@@ -296,6 +296,10 @@
             result += '\n'
         return result
 
+    def get_help_topic(self):
+        """Return the commands help topic - its name."""
+        return self.name()
+
     def get_see_also(self, additional_terms=None):
         """Return a list of help topics that are related to this ommand.
         

=== modified file 'bzrlib/tests/test_help.py'
--- a/bzrlib/tests/test_help.py	2007-04-20 05:36:58 +0000
+++ b/bzrlib/tests/test_help.py	2007-04-20 05:39:19 +0000
@@ -75,6 +75,13 @@
             '  -h, --help  show help message\n'
             '\n'
             'See also: gam\n')
+
+    def test_get_help_topic(self):
+        """The help topic for a Command is its name()."""
+        class cmd_foo_bar(commands.Command):
+            """A sample command."""
+        cmd = cmd_foo_bar()
+        self.assertEqual(cmd.name(), cmd.get_help_topic())
     
 
 class TestRegisteredTopic(tests.TestCase):



More information about the bazaar-commits mailing list