Skip to content

Commit

Permalink
Fixed regression in Cmd.select converting "Any" type argument to string
Browse files Browse the repository at this point in the history
  • Loading branch information
tsujamin authored and kmvanbrunt committed Oct 25, 2021
1 parent 369cd7a commit 4fac490
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd2/cmd2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3865,7 +3865,7 @@ def do_quit(self, _: argparse.Namespace) -> Optional[bool]:
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.
Expand Down Expand Up @@ -3910,7 +3910,7 @@ def select(self, opts: Union[str, List[str], List[Tuple[Any, Optional[str]]]], p
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)}:")

Expand Down

0 comments on commit 4fac490

Please sign in to comment.