diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2021-06-25 13:28:48 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2021-06-25 13:28:48 -0400 |
commit | 81d5ad7cac5dbb55e0c615c1aede6c210142458d (patch) | |
tree | 7a4507847a3b9b74034b29e8031ea1491fa71098 | |
parent | a84860ef10464d3066ed99a8da80a37a184bde64 (diff) | |
download | cmd2-git-81d5ad7cac5dbb55e0c615c1aede6c210142458d.tar.gz |
Updated docs
-rw-r--r-- | docs/examples/first_app.rst | 4 | ||||
-rw-r--r-- | docs/features/initialization.rst | 1 | ||||
-rw-r--r-- | docs/features/plugins.rst | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/docs/examples/first_app.rst b/docs/examples/first_app.rst index adf50c97..d90f96d8 100644 --- a/docs/examples/first_app.rst +++ b/docs/examples/first_app.rst @@ -68,7 +68,7 @@ initializer to our class:: # Make maxrepeats settable at runtime self.maxrepeats = 3 - self.add_settable(cmd2.Settable('maxrepeats', int, 'max repetitions for speak command')) + self.add_settable(cmd2.Settable('maxrepeats', int, 'max repetitions for speak command', self)) In that initializer, the first thing to do is to make sure we initialize ``cmd2``. That's what the ``super().__init__()`` line does. Next create an @@ -204,7 +204,7 @@ method so it looks like this:: # Make maxrepeats settable at runtime self.maxrepeats = 3 - self.add_settable(cmd2.Settable('maxrepeats', int, 'max repetitions for speak command')) + self.add_settable(cmd2.Settable('maxrepeats', int, 'max repetitions for speak command', self)) Shortcuts are passed to the ``cmd2`` initializer, and if you want the built-in shortcuts of ``cmd2`` you have to pass them. These shortcuts are defined as a diff --git a/docs/features/initialization.rst b/docs/features/initialization.rst index e3acf859..e51f87b2 100644 --- a/docs/features/initialization.rst +++ b/docs/features/initialization.rst @@ -50,6 +50,7 @@ capabilities which you may wish to utilize while initializing the app:: self.add_settable(cmd2.Settable('foreground_color', str, 'Foreground color to use with echo command', + self, choices=fg.colors())) @cmd2.with_category(CUSTOM_CATEGORY) diff --git a/docs/features/plugins.rst b/docs/features/plugins.rst index ecd3a32d..13a3910b 100644 --- a/docs/features/plugins.rst +++ b/docs/features/plugins.rst @@ -81,7 +81,7 @@ example:: super().__init__(*args, **kwargs) # code placed here runs after cmd2.Cmd initializes self.mysetting = 'somevalue' - self.add_settable(cmd2.Settable('mysetting', str, 'short help message for mysetting')) + self.add_settable(cmd2.Settable('mysetting', str, 'short help message for mysetting', self)) You can hide settings from the user by calling :meth:`~cmd2.Cmd.remove_settable`. See :ref:`features/settings:Settings` for |