Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cmd2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = {}
Expand Down
24 changes: 12 additions & 12 deletions tests/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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


Expand Down