summaryrefslogtreecommitdiff
path: root/cmd2.py
Commit message (Collapse)AuthorAgeFilesLines
* Added fix for changes in pyperclip project structure in the most recent versionTodd Leonhardt2017-11-081-4/+15
| | | | | | | | | Also included a number of minor maintenance updates: - Bumped version to 0.7.8 in preparation for upcoming release - Updated Readme.md to add link to slides from recent Florida PyCon talk about cmd2 - Updated documentation on integrating cmd2 with other event loops to use newer runcmds_plus_hooks() method instead of legacy onecmds_plus_hooks method which doesn't properly deal with load commands - Deleted old files which were used to prepare for a PyCon 2010 presentation - Updated ChangeLog regarding this bug fix
* Removed a conditional which was made redundant by an outer conditional that ↵Todd Leonhardt2017-09-231-4/+0
| | | | got added
* Fixed a bug when edit is passed a large negative integer in quotesTodd Leonhardt2017-09-231-3/+21
| | | | | | Fixed a weird corner case. Also added some comments to do_edit to better explain what the code is doing.
* Fixed a bug which occurred when edit was called with an integer index larger ↵Todd Leonhardt2017-09-231-7/+11
| | | | | | | | | than the length of the history Previously a edit was creating a file named 'None' in this case. Now an error is printed to the screen and no editor is opened. Also did some miscellaneous cleanup based on PyCharm warnings.
* Merge branch 'master' into support-load-in-onecmd_plus_hooksTodd Leonhardt2017-09-221-1/+1
|\
| * Improved documentation for how a user can modify comment grammar/styleTodd Leonhardt2017-09-221-1/+1
| | | | | | | | | | | | | | Also: - Added arg_print.py example to demonstrate this - Bumped version to 0.7.8a - Updated CHANGELOG
* | Provide method to run multiple commands w/o a cmdloop.Alfred Levy2017-09-221-12/+45
|/ | | | | | | | | | | | runcmds_plus_hooks can accept multiple commands process the command queue to deal with subsequent commands loaded from scripts without requiring a command loop. This better supports a one-off batch processing scenario. Also fixed the insertion order of commands placed in the command queue by load and _relative_load so that script commands are run in the expected order. Minor tweak to setup instructions in CONTRIBUTING.md to include pyperclip in prerequisites.
* Improved poutput() so that it can print an integer zero and other falsy thingsTodd Leonhardt2017-09-051-1/+1
| | | | | | | The poutput() function has been ruggedized so that it has a better conditional check so that it will actually print things which are "falsy" but are still convertible to a string. A few unit tests have been added specifically for the poutput function.
* Minor bug fixTodd Leonhardt2017-08-231-3/+2
|
* Exit on <control>D when on a ttyJared Crapo2017-08-231-0/+2
|
* Prompt and line now properly echoed on tty and pipeJared Crapo2017-08-231-9/+29
| | | | if we are on a pipe, we have to echo the prompt only after we read and are not at EOF.
* Don’t try and sane the tty if stdin isn’t a ttyJared Crapo2017-08-231-2/+3
|
* Improved what gets printed when running commands from a script with load ↵Todd Leonhardt2017-08-231-4/+3
| | | | | | command and echo is True Previously just the command get printed. Now the prompt and the command gets printed.
* Updated CHANGELOG with some text regarding recent enhancements to transcript ↵Todd Leonhardt2017-08-221-5/+5
| | | | | | regexes Also bumped version from 0.7.7a to 0.7.7 in preparation for eventual next release.
* Merge branch 'master' into fix/transcript_regexesTodd Leonhardt2017-08-221-10/+9
|\
| * Converted edit command to an @options command for the better argument ↵Todd Leonhardt2017-08-211-10/+9
| | | | | | | | | | | | parsing related to spaces and quotes The recent change of edit to allow spaces means that it can benefit from the better argument parsing cmd2 has for commands implemented using the @options decorator.
* | Fix a bug if there is only one slashJared Crapo2017-08-221-2/+4
| |
* | modernize formattingJared Crapo2017-08-221-2/+2
| |
* | Fix bug in history commandJared Crapo2017-08-221-4/+6
| | | | | | | | It output double newlines after each history item
* | Checkpoint. Many tests working, multiline seems brokenJared Crapo2017-08-211-10/+61
| |
* | Simple but working version of new regex transcriptJared Crapo2017-08-211-13/+34
|/ | | | Escapes of slashes don’t work yet.
* feedback_to_output now defaults to FalseTodd Leonhardt2017-08-201-1/+1
| | | | 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 |.
* Ensure editor and the file to edit can have spaces in themJared Crapo2017-08-191-1/+1
|
* .pfeedback() now honors feedback_to_output settingJared Crapo2017-08-191-1/+1
| | | | If feedback_to_output is false, .pfeedback() now sends messages to stderr instead of stdout.
* Bump versions to 0.7.7aTodd Leonhardt2017-08-151-1/+1
| | | | This is to help distinguish latest code in GitHub from a version installed via pip from PyPI
* Updated commentKevin Van Brunt2017-08-151-2/+4
|
* Added workaround for bug in Python 2 on Linux when pygtk is installedTodd Leonhardt2017-08-151-0/+8
| | | | This bug is exposed by cmd2's dependency on pyperclip and pyperclip's optional dependency on pygtk.
* The default buffer size is fine for 99% of pipe operationsTodd Leonhardt2017-08-101-7/+2
| | | | | | 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.
* Improved commentKevin Van Brunt2017-08-101-1/+3
|
* Merge branch 'master' into buffer_sizeTodd Leonhardt2017-08-101-1/+1
|\
| * Fix for occasional extra output at startup when using Python 2.7 on LinuxTodd Leonhardt2017-08-101-1/+1
| |
* | Added pipe buffer size that can be tweaked if stdin/stdout need to be larger ↵Kevin Van Brunt2017-08-101-5/+14
|/ | | | | | when piping to shell commands. Fixed error caused by BrokenPipeError not existing in Python 2.
* Made a few code ruggedizationsTodd Leonhardt2017-08-091-15/+18
| | | | | | - 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
* Minor tweak to wording of a comment for clarificationTodd Leonhardt2017-08-081-1/+1
|
* Slight rewording to a comment to make it more accurateTodd Leonhardt2017-08-081-1/+1
|
* Replaced direct calls to self.stdout.write() with calls to self.poutput().Todd Leonhardt2017-08-081-23/+40
| | | | | | 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.
* Changed how the pipe file descriptors get opened on Python 3 vs 2Todd Leonhardt2017-08-071-2/+9
| | | | | | | | 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.
* First attempt at improving how command output gets piped to a shell commandTodd Leonhardt2017-08-071-40/+55
| | | | | | | | | | 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.
* Updated CHANGES and bumped version in preparation for 0.7.6 releaseTodd Leonhardt2017-08-021-1/+1
|
* Added strip_ansi() function and visible_prompt properyTodd Leonhardt2017-08-021-6/+30
| | | | | | 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.
* Corrected help text for shortcuts since they don't have to be single keyKevin Van Brunt2017-07-191-1/+1
|
* Added support for case-insensitive tab-completion of cmd2 command namesTodd Leonhardt2017-07-131-1/+5
|
* Fixed a couple case sensitivity bugs and added an exampleTodd Leonhardt2017-07-121-2/+6
| | | | | | | | 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.
* Fixed a few typosTodd Leonhardt2017-07-111-3/+3
|
* Fixed a comment and updated CHANGESTodd Leonhardt2017-07-101-1/+1
|
* Minor attempt at ruggedization of clipboard stuff in some weird cases on ↵Todd Leonhardt2017-07-101-1/+2
| | | | Python 2
* Attempt at fixing some extraneous output on Linux when using Python3 and xclipTodd Leonhardt2017-07-101-1/+6
|
* Fix a typo: paramters -> parametersFelix Yan2017-07-101-1/+1
|
* Bump version to 0.7.6a (from 0.7.5)Todd Leonhardt2017-07-081-1/+1
|
* Bump version to 0.7.5 (from 0.7.5a)0.7.5Todd Leonhardt2017-07-081-1/+1
|