Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kmvanbrunt committed Jun 25, 2021
1 parent a84860e commit 81d5ad7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/examples/first_app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/features/initialization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/features/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 81d5ad7

Please sign in to comment.