diff options
| author | Benjamin George Roberts <benjamin@bgroberts.id.au> | 2021-10-25 10:38:53 +1100 |
|---|---|---|
| committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2021-10-25 16:36:02 -0400 |
| commit | 4fac4902e4c54e441379644826a355c2837bde1b (patch) | |
| tree | 064d49c7e98143970b617a1ac3086e6f08a27d5e | |
| parent | 369cd7a07b5d6c17e762184f54de05e9965a6171 (diff) | |
| download | cmd2-git-4fac4902e4c54e441379644826a355c2837bde1b.tar.gz | |
Fixed regression in Cmd.select converting "Any" type argument to string
| -rw-r--r-- | cmd2/cmd2.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index c06b9617..09b3fe43 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -3865,7 +3865,7 @@ class Cmd(cmd.Cmd): self.last_result = True return True - def select(self, opts: Union[str, List[str], List[Tuple[Any, Optional[str]]]], prompt: str = 'Your choice? ') -> str: + def select(self, opts: Union[str, List[str], List[Tuple[Any, Optional[str]]]], prompt: str = 'Your choice? ') -> Any: """Presents a numbered menu to the user. Modeled after the bash shell's SELECT. Returns the item chosen. @@ -3910,7 +3910,7 @@ class Cmd(cmd.Cmd): choice = int(response) if choice < 1: raise IndexError - return str(fulloptions[choice - 1][0]) + return fulloptions[choice - 1][0] except (ValueError, IndexError): self.poutput(f"'{response}' isn't a valid choice. Pick a number between 1 and {len(fulloptions)}:") |
