diff options
| author | Jared Crapo <jared@kotfu.net> | 2017-08-22 10:46:30 -0600 |
|---|---|---|
| committer | Jared Crapo <jared@kotfu.net> | 2017-08-22 10:46:30 -0600 |
| commit | 73399623f8c1929a080c6dfd1fb62af1bd6551b9 (patch) | |
| tree | 8add6eb27cdc8b288786eb5c6d2caed66ed54f4d /cmd2.py | |
| parent | 20d752047185214806694bc7a045a8af8e5a240f (diff) | |
| download | cmd2-git-73399623f8c1929a080c6dfd1fb62af1bd6551b9.tar.gz | |
Fix bug in history command
It output double newlines after each history item
Diffstat (limited to 'cmd2.py')
| -rwxr-xr-x | cmd2.py | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -2022,10 +2022,12 @@ class ParserManager: class HistoryItem(str): """Class used to represent an item in the History list. - Thing wrapper around str class which adds a custom format for printing. It also keeps track of its index in the - list as well as a lowercase representation of itself for convenience/efficiency. + Thin wrapper around str class which adds a custom format for printing. It + also keeps track of its index in the list as well as a lowercase + representation of itself for convenience/efficiency. + """ - listformat = '-------------------------[%d]\n%s\n' + listformat = '-------------------------[{}]\n{}\n' # noinspection PyUnusedLocal def __init__(self, instr): @@ -2038,7 +2040,7 @@ class HistoryItem(str): :return: str - pretty print string version of a HistoryItem """ - return self.listformat % (self.idx, str(self)) + return self.listformat.format(self.idx, str(self).rstrip()) class History(list): |
