| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
This is so that non-essential info which isn't directly associated with command output, such as time elapsed while executing a command, won't redirect when command output is redirected using >, >>, or |.
|
| |
|
|
|
|
| |
If feedback_to_output is false, .pfeedback() now sends messages to stderr instead of stdout.
|
|
|
|
| |
This is to help distinguish latest code in GitHub from a version installed via pip from PyPI
|
| |
|
|
|
|
| |
This bug is exposed by cmd2's dependency on pyperclip and pyperclip's optional dependency on pygtk.
|
|
|
|
|
|
| |
Removed the complexity of a member variable which would be unnecessary for the vast majority of applications.
If users have an application with atypical requirements, they are free to override the default.
|
| |
|
|\ |
|
| | |
|
|/
|
|
|
|
| |
when piping to shell commands.
Fixed error caused by BrokenPipeError not existing in Python 2.
|
|
|
|
|
|
| |
- poutput() can now take any argument convertible to a str via '{}'.format() instead of only str
- postparsing_postcmd() automatically runs a 'stty sane' on POSIX OSes to handle those cases of your terminal getting in a messed up state if you do something like pipe to a terminal command like "less" and then improperly quit out of it with a <Ctrl>-C instead of properly using "q"
- In _restore_output(), immeditelly restore stdout state in a finally block after closing the temporary one used for redirection/piping
|
| |
|
| |
|
|
|
|
|
|
| |
Modified implementation of poutput() to accept an optional "end" argument which can change the ending to something other than a newline or simply suppress adding a newline. Also added a try/except to catch BrokenPipeError exceptions which can occupoutputr if the subprocess output is being piped to closes before the command piping output to it is finished.
Updated install docs to note that when using Python 2.7, the subprocess32 module should also be installed.
|
|
|
|
|
|
|
|
| |
Open them in text mode in Python 3 so self.stdout.write() expects normal Python 3 (unicode) strings.
Open them in binary mode in Python 2 so self.stdout.write() expects normal Python 2 (byte) strings.
Also fixed a unit test mocking issue on Python 2 to account for the fact that Python 2.7 requires the subprocess32 module instead of subprocess.
|
|
|
|
|
|
|
|
|
|
| |
Now a real pipe is created to a subprocess. This has many advantages and should "just work" like intended with all commands.
One downside is to work properly on Python 2.7, it requires the subprocess32 module which is the subprocess module from Python 3.2 backported to Python 2.7. Another downside, is that unit testing the feature is now more difficult.
This still needs to be tested for compatibility across all OSes and supported versions of Python.
The user needs to be careful if designing multi-threaded cmd2 applications that do command processing in other threads and those threads can make calls to self.stdout.write to put in a try/except to catch Broken Pipe errors which can occur for long running commands if the user closes the shell subprocess before the command is finished.
|
| |
|
|
|
|
|
|
| |
Transcript testing now strips ANSI escape codes from the current line and current prompt before comparing the start of the current line with the current prompt to see if it is a command.
This makes it easier to use transcript testing with applications that colorize the prompt.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Bugs fixed:
- Case-sensitive parsing was completely broken, this has been fixed
- <Ctrl>+D to quit wasn't working when case-sensitive parsing was enabled, this is fixed
Added a "case_sensitive.py" example in the examples directory for quickly testing case-sensitive command parsing behavior.
|
| |
|
| |
|
|
|
|
| |
Python 2
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
compatibility shim
|
|
|
|
|
|
| |
OS-default
This fixes a unit test bug where on Windows it was trying to load a utf-8 file as some other encoding starting with "cp".
|
|
|
|
|
|
| |
The load command no longer spawns a nested main loop using _cmdloop(). It now simply adds commands to the cmdqueue. And after adding all commands in the script file, it adds the eos command.
The eos command simply pops the most recent script directory from the list of script directories.
|
|
|
|
| |
do__relative_load()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug fixes:
- case_insensitive is no longer a runtime-settable parameter, but it was still listed as such
- Fixed a recursive loop bug when abbreviated commands are enabled and it could get stuck in the editor forever
- Added additional command abbreviations to the "exclude from history" list
- Fixed argparse_example.py and pirate.py examples
Other changes:
- Organized all attributes used to configure the ParserManager into a single location
- Set the default value of "abbrev" to False (which controls whether or not abbreviated commands are allowed)
- With good tab-completion of command names, using abbreviated commands isn't a particularly useful feature
- And it can create problems
|
| |
|
|
|
|
|
|
| |
It was pretty useless, it just printed a message and sat there and waited for the user to hit enter.
It didn't feel like it belonged in a top-level framework. If a particular application wants this functionality, it is a 2 line change to add it back.
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed a bug where CmdResult named tuple Truthiness wasn't working in Python 2
Removed unused cmd2.History.search() method.
Added unit tests for:
- History class
- cast() function
- CmdResult namedtuple
|
|
|
|
| |
Python 3.6
|
|
|
|
| |
Also improved error handling in some exceptional cases.
|
|
|
|
| |
Since in the subprocess.Popen() call, shell=True and stderr=sys.stderr, errors get printed on stderr. There is no need to catch an exception.
|
|
|
|
|
|
|
|
|
| |
The main advantages of this are that shell command output can now be
- piped to another shell command
- redirected to a file
In the future, I may take it a step further where the output is piped, but using a pipe versus a real terminal changes the behavior of many shell commands, for example by getting rid of ANSI color and various other pretty formatting.
|
| |
|
| |
|
|
|
|
|
|
| |
Without using the repr representation of the path, "C:\Users" treats \U as a Unicode Escape.
To fix this, pyscript passes the repr representation of the path to do_py.
|
|
|
|
|
|
|
| |
Also:
- When running cmd2.py as main, enable use of IPython if present to aid with debugging and troubleshooting
- Deleted a unit test which wasn't reliable
|
|
|
|
| |
Also skip unit test which passes when I run it on my systems, but fails on TravisCI and AppVeyor
|
|
|
|
| |
Also added a few unit tests related to running an empty statement and dealing with precmd hook success and failure.
|
|
|
|
| |
So it turns out that on Linux, it sys.platform is "linux2" in Python 2 and "linux" in Python 3, so if doing a comparsion, need to do a .startswith() instead of a ==
|
|
|
|
|
|
|
| |
If Pyperclip could not find a copy/paste mechanism for your system, then
cmd2.can_clip gets set to False.
If cmd2.can_clip is False, then the "send_to_paste_buffer" test gets skipped.
|