Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
64522cc
Change load to run scripts immediately instead of queueing commands
kmvanbrunt May 23, 2019
c3f0794
Returning value of stop from history command when it runs a script
kmvanbrunt May 23, 2019
d333a99
Fixed spelling
kmvanbrunt May 24, 2019
c3fe057
Removed most return statements from finally blocks to avoid hiding ex…
kmvanbrunt May 24, 2019
ba4de1d
Stopping transcript generation if a command returns True for its stop…
kmvanbrunt May 24, 2019
a37dd5d
Fixed count in output message printed after transcript generation
kmvanbrunt May 24, 2019
1178bda
Since transcript generation actually runs the commands, it now return…
kmvanbrunt May 24, 2019
da5f03f
Running commands from history stops if a command returns True for its…
kmvanbrunt May 24, 2019
d1438e0
Removing duplicate functionality by calling runcmds_plus_hooks() to r…
kmvanbrunt May 24, 2019
c4fd5b6
Removed _STOP_AND_EXIT cmd2 class member since it was meant to be a b…
kmvanbrunt Jun 4, 2019
a490975
Merge branch 'master' into script_refactor
kmvanbrunt Jun 6, 2019
5157a6e
runcmds_plus_hooks now handles HistoryItems
kmvanbrunt Jun 6, 2019
abeb8e7
Transcript testing now properly handles commands which signal the app…
tleonhardt Jun 7, 2019
6cdf708
Refactored how and when transcript file glob patterns are expanded in…
tleonhardt Jun 7, 2019
16f6bee
Extracted duplicated code to utility function
tleonhardt Jun 7, 2019
069b181
Moved a new helper function from cmd2.py to utils.py where it probabl…
tleonhardt Jun 7, 2019
ee699c3
Made comment more accurate
kmvanbrunt Jun 7, 2019
ab1ae68
Removed self._should_quit from cmd2 and add logic to PyscriptBridge t…
kmvanbrunt Jun 7, 2019
0b0ccc5
Removed copyright headers from source files and updated LICENSE with …
kmvanbrunt Jun 7, 2019
9985666
Updated change log and comment
kmvanbrunt Jun 7, 2019
273538c
Merge branch 'master' into script_refactor
kmvanbrunt Jun 10, 2019
6fa5c56
Added unit test
kmvanbrunt Jun 10, 2019
18f001c
Added unit test for stopping during transcript generation
kmvanbrunt Jun 10, 2019
cfb09fe
Updated change log
kmvanbrunt Jun 10, 2019
0983226
Updated change log
kmvanbrunt Jun 10, 2019
1f23509
Updated change log
kmvanbrunt Jun 10, 2019
1aee031
Updated change log
kmvanbrunt Jun 10, 2019
77633bc
Removed support for cmd.cmdqueue
kmvanbrunt Jun 11, 2019
f42cdb2
Move argparse parsing of CLI args back to cmdloop() from __init__()
tleonhardt Jun 12, 2019
c0f92d1
Revert "Move argparse parsing of CLI args back to cmdloop() from __in…
kmvanbrunt Jun 12, 2019
bc24624
Fixed unit tests
kmvanbrunt Jun 12, 2019
6b8b636
Made constants for color values
kmvanbrunt Jun 12, 2019
57c64c4
Fixed UnsupportedOperation on fileno error when a shell command was o…
kmvanbrunt Jun 12, 2019
6b38d41
Transcript generation no longer terminates _cmdloop() when a command …
kmvanbrunt Jun 12, 2019
8e90658
Updated unit test
kmvanbrunt Jun 12, 2019
f659da3
Reverted making constant values for colors. This will be done on a fu…
kmvanbrunt Jun 13, 2019
756d8d3
Fixed flake8 error
kmvanbrunt Jun 13, 2019
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
39 changes: 25 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,50 @@
precedence even though it appeared later in the command.
* Fixed issue where quotes around redirection file paths were being lost in `Statement.expanded_command_line()`
* Fixed a bug in how line numbers were calculated for transcript testing
* Fixed issue where `_cmdloop()` suppressed exceptions by returning from within its `finally` code
* Fixed UnsupportedOperation on fileno error when a shell command was one of the commands run while generating
a transcript
* Enhancements
* Added capability to chain pipe commands and redirect their output (e.g. !ls -l | grep user | wc -l > out.txt)
* `pyscript` limits a command's stdout capture to the same period that redirection does.
Therefore output from a command's postparsing and finalization hooks isn't saved in the StdSim object.
Therefore output from a command's postparsing and finalization hooks isn't saved in the StdSim object.
* `StdSim.buffer.write()` now flushes when the wrapped stream uses line buffering and the bytes being written
contain a newline or carriage return. This helps when `pyscript` is echoing the output of a shell command
since the output will print at the same frequency as when the command is run in a terminal.
contain a newline or carriage return. This helps when `pyscript` is echoing the output of a shell command
since the output will print at the same frequency as when the command is run in a terminal.
* **ACArgumentParser** no longer prints complete help text when a parsing error occurs since long help messages
scroll the actual error message off the screen.
scroll the actual error message off the screen.
* Exceptions occurring in tab completion functions are now printed to stderr before returning control back to
readline. This makes debugging a lot easier since readline suppresses these exceptions.
* Added support for custom Namespaces in the argparse decorators. See description of `ns_provider` argument
for more information.
* Transcript testing now sets the `exit_code` returned from `cmdloop` based on Success/Failure
* The history of entered commands previously was saved using the readline persistence mechanism,
and only persisted if you had readline installed. Now history is persisted independent of readline; user
input from previous invocations of `cmd2` based apps now shows in the `history` command.

and only persisted if you had readline installed. Now history is persisted independent of readline; user
input from previous invocations of `cmd2` based apps now shows in the `history` command.
* Text scripts now run immediately instead of adding their commands to `cmdqueue`. This allows easy capture of
the entire script's output.
* Added member to `CommandResult` called `stop` which is the return value of `onecmd_plus_hooks` after it runs
the given command line.
* Breaking changes
* Replaced `unquote_redirection_tokens()` with `unquote_specific_tokens()`. This was to support the fix
that allows terminators in alias and macro values.
that allows terminators in alias and macro values.
* Changed `Statement.pipe_to` to a string instead of a list
* `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 application developer's responsibility to treat the return value from `cmdloop()` accordingly
It is now application developer's responsibility to treat the return value from `cmdloop()` accordingly
* Only valid commands are persistent in history between invocations of `cmd2` based apps. Previously
all user input was persistent in history. If readline is installed, the history available with the up and
down arrow keys (readline history) may not match that shown in the `history` command, because `history`
only tracks valid input, while readline history captures all input.
all user input was persistent in history. If readline is installed, the history available with the up and
down arrow keys (readline history) may not match that shown in the `history` command, because `history`
only tracks valid input, while readline history captures all input.
* History is now persisted in a binary format, not plain text format. Previous history files are destroyed
on first launch of a `cmd2` based app of version 0.9.13 or higher.
on first launch of a `cmd2` based app of version 0.9.13 or higher.
* HistoryItem class is no longer a subclass of `str`. If you are directly accessing the `.history` attribute
of a `cmd2` based app, you will need to update your code to use `.history.get(1).statement.raw` instead.
of a `cmd2` based app, you will need to update your code to use `.history.get(1).statement.raw` instead.
* 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
* Removed `cmd2` member called `_should_quit` since `PyscriptBridge` now handles this logic
* Removed support for `cmd.cmdqueue`
* `allow_cli_args` is now an argument to __init__ instead of a `cmd2` class member
* **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
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2008-2016 Catherine Devlin and others
Copyright (c) 2008-2019 Catherine Devlin and others

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 0 additions & 3 deletions cmd2/argparse_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ def my_completer(text: str, line: str, begidx: int, endidx:int, extra_param: str
The subcommand group dictionary maps subcommand names to tuple(arg_choices, subcmd_args_lookup)
For more details of this more complex approach see tab_autocompletion.py in the examples
Copyright 2018 Eric Lin <anselor@gmail.com>
Released under MIT license, see LICENSE file
"""

import argparse
Expand Down
Loading