From 40722f10ace3107dcb4709008239ac8233ada30f Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Tue, 4 Feb 2020 23:01:30 -0500 Subject: Added cmd2.utils.Settable to the cmd2 namespace and updated examples and docs --- docs/examples/first_app.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/examples') diff --git a/docs/examples/first_app.rst b/docs/examples/first_app.rst index 19d573b4..310c8d0c 100644 --- a/docs/examples/first_app.rst +++ b/docs/examples/first_app.rst @@ -67,7 +67,7 @@ initializer to our class:: # Make maxrepeats settable at runtime self.maxrepeats = 3 - self.settable['maxrepeats'] = 'max repetitions for speak command' + self.add_settable(cmd2.Settable('maxrepeats', int, 'max repetitions for speak command')) In that initializer, the first thing to do is to make sure we initialize ``cmd2``. That's what the ``super().__init__()`` line does. Then we create an @@ -203,7 +203,7 @@ method so it looks like this:: # Make maxrepeats settable at runtime self.maxrepeats = 3 - self.settable['maxrepeats'] = 'max repetitions for speak command' + self.add_settable(cmd2.Settable('maxrepeats', int, 'max repetitions for speak command')) 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 -- cgit v1.2.1