diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2020-02-04 23:01:30 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2020-02-04 23:01:30 -0500 |
commit | 40722f10ace3107dcb4709008239ac8233ada30f (patch) | |
tree | 676edd56ec5ba1287cd4f38b66f2733eea597ee9 /examples/environment.py | |
parent | 61dfcf613966355d68c01f2aa06f0158b54c1f20 (diff) | |
download | cmd2-git-40722f10ace3107dcb4709008239ac8233ada30f.tar.gz |
Added cmd2.utils.Settable to the cmd2 namespace and updated examples and docs
Diffstat (limited to 'examples/environment.py')
-rwxr-xr-x | examples/environment.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/environment.py b/examples/environment.py index 9e611f08..fb90838c 100755 --- a/examples/environment.py +++ b/examples/environment.py @@ -8,16 +8,16 @@ import cmd2 class EnvironmentApp(cmd2.Cmd): """ Example cmd2 application. """ - degrees_c = 22 sunny = False def __init__(self): super().__init__() - self.settable.update({'degrees_c': 'Temperature in Celsius'}) - self.settable.update({'sunny': 'Is it sunny outside?'}) + self.add_settable(cmd2.Settable('degrees_c', int, 'Temperature in Celsius')) + self.add_settable(cmd2.Settable('sunny', bool, 'Is it sunny outside?')) def do_sunbathe(self, arg): + """Attempt to sunbathe.""" if self.degrees_c < 20: result = "It's {} C - are you a penguin?".format(self.degrees_c) elif not self.sunny: |