diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-05 21:00:51 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-05 21:00:51 -0500 |
commit | 9b95f50975ecaa8dbfd37c375ebf38e1971fc960 (patch) | |
tree | 442dd4bbe65134dabbd7f3f22e8de594779bed47 /cmd2 | |
parent | f254f4a9acd5e946892e86315e8313b3181dbb6e (diff) | |
download | cmd2-git-9b95f50975ecaa8dbfd37c375ebf38e1971fc960.tar.gz |
Added more to onchange_cb documentation
Diffstat (limited to 'cmd2')
-rw-r--r-- | cmd2/utils.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py index 9635be42..2bb91ccd 100644 --- a/cmd2/utils.py +++ b/cmd2/utils.py @@ -90,9 +90,13 @@ class Settable: validation using str_to_bool(). The val_type function should raise an exception if it fails. This exception will be caught and printed by Cmd.do_set(). :param description: string describing this setting - :param onchange_cb: optional function to call when the value of this settable is altered by the set command - Callback signature: - val_changed_cb(param_name: str, old_value: Any, new_value: Any) -> Any + :param onchange_cb: optional function or method to call when the value of this settable is altered + by the set command. (e.g. onchange_cb=self.debug_changed) + + Cmd.do_set() passes the following 3 arguments to onchange_cb: + param_name: str - name of the changed parameter + old_value: Any - the value before being changed + new_value: Any - the value after being changed The following optional settings provide tab completion for a parameter's values. They correspond to the same settings in argparse-based tab completion. A maximum of one of these should be provided. |