diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-06-29 13:33:25 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-06-29 13:33:25 -0400 |
commit | 3bf3bf65bfaa938e579984d8079045692d7f290c (patch) | |
tree | f88c4ad6a8d4f6f282cf5d5114271c598b63d027 /cmd2/cmd2.py | |
parent | 1ca3ce9361ef0eb9c98ce8ec4cbd76e7b30140b2 (diff) | |
download | cmd2-git-3bf3bf65bfaa938e579984d8079045692d7f290c.tar.gz |
Always set the canonical version allow_ansi' string value
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 31399620..07e7fcec 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -563,8 +563,9 @@ class Cmd(cmd.Cmd): @allow_ansi.setter def allow_ansi(self, new_val: str) -> None: - """Read-only property needed to support do_set when it sets allow_ansi""" - if new_val.lower() not in (ansi.ANSI_TERMINAL.lower(), ansi.ANSI_ALWAYS.lower(), ansi.ANSI_NEVER.lower()): + """Setter property needed to support do_set when it updates allow_ansi""" + new_val = new_val.capitalize() + if new_val not in (ansi.ANSI_TERMINAL, ansi.ANSI_ALWAYS, ansi.ANSI_NEVER): self.perror('Invalid value: {} (valid values: {}, {}, {})'.format(new_val, ansi.ANSI_TERMINAL, ansi.ANSI_ALWAYS, ansi.ANSI_NEVER)) else: |