diff --git a/cmd2.py b/cmd2.py index cd2d9d54b..776c85d88 100755 --- a/cmd2.py +++ b/cmd2.py @@ -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 @@ def __init__(self, completekey='tab', stdin=None, stdout=None, persistent_histor # 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 da8f66925..5a741b578 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