summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--cmd2/cmd2.py10
-rw-r--r--tests/test_cmd2.py3
3 files changed, 8 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a46fad45..d17d442f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,7 +32,8 @@
* `preserve_quotes` is now a keyword-only argument in the argparse decorators
* Refactored so that `cmd2.Cmd.cmdloop()` returns the `exit_code` instead of a call to `sys.exit()`
* It is now applicaiton developer's responsibility to treat the return value from `cmdloop()` accordingly
- * Removed internally used `eos` command that was used to keep track of when a text script's commands ended
+ * Removed internally used `eos` command that was used to keep track of when a text script's commands ended
+ * Removed cmd2 member called _STOP_AND_EXIT since it was just a boolean value that should always be True
* **Python 3.4 EOL notice**
* Python 3.4 reached its [end of life](https://www.python.org/dev/peps/pep-0429/) on March 18, 2019
* This is the last release of `cmd2` which will support Python 3.4
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index d1a5552e..89ea0c0f 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -432,9 +432,6 @@ class Cmd(cmd.Cmd):
# Built-in commands don't make use of this. It is purely there for user-defined commands and convenience.
self._last_result = None
- # Codes used for exit conditions
- self._STOP_AND_EXIT = True # cmd convention
-
# Used load command to store the current script dir as a LIFO queue to support _relative_load command
self._script_dir = []
@@ -2859,14 +2856,15 @@ class Cmd(cmd.Cmd):
@with_argparser(ACArgumentParser(epilog=INTERNAL_COMMAND_EPILOG))
def do_eof(self, _: argparse.Namespace) -> bool:
"""Called when <Ctrl>-D is pressed"""
- # End of script should not exit app, but <Ctrl>-D should.
- return self._STOP_AND_EXIT
+ # Return True to stop the command loop
+ return True
@with_argparser(ACArgumentParser())
def do_quit(self, _: argparse.Namespace) -> bool:
"""Exit this application"""
self._should_quit = True
- return self._STOP_AND_EXIT
+ # Return True to stop the command loop
+ return True
def select(self, opts: Union[str, List[str], List[Tuple[Any, Optional[str]]]],
prompt: str = 'Your choice? ') -> str:
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 4fc9fd59..7ea4f227 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -1950,7 +1950,8 @@ Usage: exit [exit_code]
self.exit_code = -1
self._should_quit = True
- return self._STOP_AND_EXIT
+ # Return True to stop the command loop
+ return True
def postloop(self) -> None:
"""Hook method executed once when the cmdloop() method is about to return."""