diff options
| author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-02-27 09:51:51 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-27 09:51:51 -0500 |
| commit | 0ee3d6bf3cd20877870d9542d858f8abb1e7f4f1 (patch) | |
| tree | 8a81fd05667659955e20b98ff015dbfebd87dee2 | |
| parent | 27a8a15ce6fa1ace148573110d612563a05ec516 (diff) | |
| parent | 91255cd002bf65c99ea7931c3f4cda3e775b09e6 (diff) | |
| download | cmd2-git-0ee3d6bf3cd20877870d9542d858f8abb1e7f4f1.tar.gz | |
Merge pull request #284 from python-cmd2/instance_variables
Converted a few class variables into instance variables
| -rwxr-xr-x | cmd2.py | 7 | ||||
| -rw-r--r-- | tests/test_parsing.py | 24 |
2 files changed, 17 insertions, 14 deletions
@@ -803,8 +803,6 @@ class Cmd(cmd.Cmd): allow_cli_args = True # Should arguments passed on the command-line be processed as commands? allow_redirection = True # Should output redirection and pipes be allowed default_to_shell = False # Attempt to run unrecognized commands as shell commands - excludeFromHistory = '''run ru r history histor histo hist his hi h edit edi ed e eof eo eos'''.split() - exclude_from_help = ['do_eof', 'do_eos', 'do__relative_load'] # Commands to exclude from the help menu reserved_words = [] # Attributes which ARE dynamically settable at runtime @@ -874,7 +872,12 @@ class Cmd(cmd.Cmd): # Call super class constructor. Need to do it in this way for Python 2 and 3 compatibility cmd.Cmd.__init__(self, completekey=completekey, stdin=stdin, stdout=stdout) + # Commands to exclude from the help menu or history command + self.exclude_from_help = ['do_eof', 'do_eos', 'do__relative_load'] + self.excludeFromHistory = '''history histor histo hist his hi h edit edi ed e eof eo eos'''.split() + self._finalize_app_parameters() + self.initial_stdout = sys.stdout self.history = History() self.pystate = {} diff --git a/tests/test_parsing.py b/tests/test_parsing.py index da8f6692..5a741b57 100644 --- a/tests/test_parsing.py +++ b/tests/test_parsing.py @@ -27,10 +27,10 @@ def parser(): c.multilineCommands = ['multiline'] c.case_insensitive = True c.parser_manager = cmd2.ParserManager(redirector=c.redirector, terminators=c.terminators, multilineCommands=c.multilineCommands, - legalChars=c.legalChars, commentGrammars=c.commentGrammars, - commentInProgress=c.commentInProgress, case_insensitive=c.case_insensitive, - blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser, - preparse=c.preparse, postparse=c.postparse, shortcuts=c.shortcuts) + legalChars=c.legalChars, commentGrammars=c.commentGrammars, + commentInProgress=c.commentInProgress, case_insensitive=c.case_insensitive, + blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser, + preparse=c.preparse, postparse=c.postparse, shortcuts=c.shortcuts) return c.parser_manager.main_parser # Case-insensitive ParserManager @@ -40,10 +40,10 @@ def ci_pm(): c.multilineCommands = ['multiline'] c.case_insensitive = True c.parser_manager = cmd2.ParserManager(redirector=c.redirector, terminators=c.terminators, multilineCommands=c.multilineCommands, - legalChars=c.legalChars, commentGrammars=c.commentGrammars, - commentInProgress=c.commentInProgress, case_insensitive=c.case_insensitive, - blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser, - preparse=c.preparse, postparse=c.postparse, shortcuts=c.shortcuts) + legalChars=c.legalChars, commentGrammars=c.commentGrammars, + commentInProgress=c.commentInProgress, case_insensitive=c.case_insensitive, + blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser, + preparse=c.preparse, postparse=c.postparse, shortcuts=c.shortcuts) return c.parser_manager # Case-sensitive ParserManager @@ -53,10 +53,10 @@ def cs_pm(): c.multilineCommands = ['multiline'] c.case_insensitive = False c.parser_manager = cmd2.ParserManager(redirector=c.redirector, terminators=c.terminators, multilineCommands=c.multilineCommands, - legalChars=c.legalChars, commentGrammars=c.commentGrammars, - commentInProgress=c.commentInProgress, case_insensitive=c.case_insensitive, - blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser, - preparse=c.preparse, postparse=c.postparse, shortcuts=c.shortcuts) + legalChars=c.legalChars, commentGrammars=c.commentGrammars, + commentInProgress=c.commentInProgress, case_insensitive=c.case_insensitive, + blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser, + preparse=c.preparse, postparse=c.postparse, shortcuts=c.shortcuts) return c.parser_manager |
