diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-06 18:03:12 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-06 18:03:12 -0400 |
commit | f8f06bff169dca1f0c6ee1dbb2d61c347490b3bb (patch) | |
tree | 85c15a4b96b4eb8dca48b9fdab2102528ba1569a /cmd2 | |
parent | 9eed45b2c54a058f2ce4e448148e5ed99c0d7925 (diff) | |
download | cmd2-git-f8f06bff169dca1f0c6ee1dbb2d61c347490b3bb.tar.gz |
More unit tests
Diffstat (limited to 'cmd2')
-rw-r--r-- | cmd2/argparse_completer.py | 4 | ||||
-rw-r--r-- | cmd2/cmd2.py | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/cmd2/argparse_completer.py b/cmd2/argparse_completer.py index 0e9321db..b6d22dce 100644 --- a/cmd2/argparse_completer.py +++ b/cmd2/argparse_completer.py @@ -59,7 +59,7 @@ How to supply completion choice lists or functions for sub-commands: """ import argparse -import os +import shutil from typing import List, Union from . import utils @@ -504,7 +504,7 @@ class AutoCompleter(object): if item_width > token_width: token_width = item_width - term_size = os.get_terminal_size() + term_size = shutil.get_terminal_size() fill_width = int(term_size.columns * .6) - (token_width + 2) for item in completions: entry = '{: <{token_width}}{: <{fill_width}}'.format(item, item.description, diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index e6d4ae47..009b1359 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1584,18 +1584,18 @@ class Cmd(cmd.Cmd): def _autocomplete_default(self, text: str, line: str, begidx: int, endidx: int, argparser: argparse.ArgumentParser) -> List[str]: - """Default completion function for argparse commands.""" + """Default completion function for argparse commands""" completer = AutoCompleter(argparser, self) tokens, _ = self.tokens_for_completion(line, begidx, endidx) return completer.complete_command(tokens, text, line, begidx, endidx) def get_all_commands(self) -> List[str]: - """Returns a list of all commands.""" + """Return a list of all commands""" return [name[len(COMMAND_FUNC_PREFIX):] for name in self.get_names() if name.startswith(COMMAND_FUNC_PREFIX) and callable(getattr(self, name))] def get_visible_commands(self) -> List[str]: - """Returns a list of commands that have not been hidden or disabled.""" + """Return a list of commands that have not been hidden or disabled""" commands = self.get_all_commands() # Remove the hidden commands |