summaryrefslogtreecommitdiff
path: root/cmd2.py
Commit message (Collapse)AuthorAgeFilesLines
* Simplified implementation of do__relative_loadTodd Leonhardt2017-06-281-15/+17
| | | | Also removed default argument for _relative_load and load
* Removed the ability for load command to load a script from a URLTodd Leonhardt2017-06-281-43/+10
| | | | From what I can tell, this hasn't worked in years and there aren't any unit tests which display how it is supposed to work.
* Ensure path completion results are sorted alphabetically on all OSesTodd Leonhardt2017-06-251-3/+5
|
* Fix Linux clipboard code so it works on both Python 2 and Python 3Todd Leonhardt2017-06-251-3/+14
|
* Various fixes and improvementsTodd Leonhardt2017-06-251-20/+11
| | | | | | - Removed some dead code in cmd2.py which was never used - Added a number of unit tests - Fixed how get_paste_buffer() and write_paste_buffer() work on macOS so that they work correctly on both Python 2.7 and Python 3.3+
* Set version to 0.7.4b for nowTodd Leonhardt2017-06-241-1/+1
|
* Reword output for cmdenvironmentTodd Leonhardt2017-06-161-5/+7
| | | | This is an attempt at making the cmdenvironment output more informative and easier to understand.
* Removed some help_* methodsTodd Leonhardt2017-06-161-105/+21
| | | | | | | | | | | | I originally created separate help_* methods for various built-in do_* methods so that: - The Sphinx docs could use the do_* docstring which could have extra reStructuredText markup embedded - The built-in help command could use the text from the help_* method This seemed like a good idea at the time, but I changed my mind - I was actually adding a maintenance headache. - And the payoff was small So I have now switched to using the do_* docstring for both the built-in help and Sphinx documentation. - With some very minor usage of reStructuredText markup that doesn't look bad when displaying built-in help
* Fixed tab completion of command and shell commandsTodd Leonhardt2017-06-151-11/+16
| | | | We now more closely emulate how Bash does or does not append a space.
* Added override of cmd.completenames() methodTodd Leonhardt2017-06-151-3/+16
| | | | Added override for convenience of automatically adding a space when tab-completing a command name.
* Updated CHANGES.md file and bumped version to 0.7.3Todd Leonhardt2017-06-141-1/+1
| | | | Bumped version in preparation for 0.7.3 release probably within the next couple weeks.
* Changed default value for USE_ARG_LIST global to TrueTodd Leonhardt2017-06-141-3/+3
| | | | | | | | | | | Now by default all @options commands get passed a list of argument strings instead of a single argument string. This is a much easier and more robust behavior to deal with. Additionally, command-line arguments are intelligently separated based on location of quotes to group things into a single argument. WARNING: This change breaks backward compatibility for older applicaitons based on cmd2. To change the behavior to the way it used to be, add the following code to the __init__() method of our class derived from cmd2.Cmd: cmd2.set_use_arg_list(False) This change really does make it easier for developers new to using cmd2 however. It is to the point where I create all custom commands with @options, even if I use an empty list for the options because the argument parsing is just much better this way.
* pyscript now expands the script path before calling do_pyTodd Leonhardt2017-06-131-1/+1
|
* Added new pyscript commandTodd Leonhardt2017-06-131-0/+36
| | | | | | | | This command is explicitly for running Python script files within an embedded Python interpreter. The advantages over the py command with "run" are: - Tab-completion of file system paths is supported - Command-line arguments can be passed to the Python script
* Minor cleanupTodd Leonhardt2017-06-131-1/+1
|
* Ruggedized do_py by adding try/except/finallyTodd Leonhardt2017-06-131-46/+50
| | | | The finally block ensures that the self._in_py state variable always gets reset to "False" before exiting the function, even if an exception occurs.
* Fixes a bug which caused transcript failures to display twiceTodd Leonhardt2017-06-131-2/+1
|
* Manually set readline delimiters to not include a dash ("-")Todd Leonhardt2017-06-091-0/+4
| | | | This is because file paths which had a "-" in them were not being completed with tab completion of local paths.
* Fix a bug in history commandTodd Leonhardt2017-06-041-2/+5
| | | | | | This is a bug that was introduced recently when the functionality of the list command was merged with the history command. This prevents an unhandled exception crash under certain unlikely but possible circumstances.
* Updated cmdenvironment commandTodd Leonhardt2017-06-031-3/+6
| | | | | | | | It no longer displays settable parameters since this functionality was redundant since those are displayed with either set or show. It now shows additional global settings for parsing @options commands. In the future a few more things should probably be displayed here related to parameters which are not settable at runtime.
* Removed redundant list commandTodd Leonhardt2017-06-031-35/+14
| | | | | | | | The extra functionality of listing a span (slice) of history items present in the list command has been incorporated into the existing history command and the list command has been removed. Unit tests have been updated accordingly. In the process a bug was fixed that was causing a crash if and end was supplied to the span but not a start.
* Made a few minor clarifying comment tweaksTodd Leonhardt2017-06-011-3/+5
|
* Added "exclude_from_help" list as a cmd2.Cmd public attributeTodd Leonhardt2017-06-011-1/+43
| | | | | | | | Added a list of commands to explicitly exclude displaying in the help menu of commands which detailed help can be retrieved for. By default, only "do_eof" is in this list since that isn't a command which is ever intended for an end user to directly enter on the command line. Also updated unit tests to reflect new default help menu.
* Whitespace changesTodd Leonhardt2017-06-011-36/+39
| | | | Made changes to suppress PyCharm Code Introspection warnings
* Moved _parsed into ParserManagerCatherine Devlin2017-05-301-49/+59
|
* Moved parser creation into ParserManagerCatherine Devlin2017-05-301-75/+105
|
* Adding parseline method backTodd Leonhardt2017-05-291-0/+31
| | | | Added a NOTE regarding what purpose it servers to the docstring
* Merge branch 'master' of https://github.com/python-cmd2/cmd2Catherine Devlin2017-05-291-2/+2
|\
| * Fix corner case in command completion of shell commandsTodd Leonhardt2017-05-231-1/+1
| | | | | | | | Fixed the path part of command completion of shell commands when that path happens to being with "~" (i.e. relies on user path expansion).
| * Bumping version to 0.7.3aTodd Leonhardt2017-05-221-1/+1
| | | | | | | | Changing to alpha version just to avoid confusion with release in PyPI
* | Remove unused `parseline` methodCatherine Devlin2017-05-291-29/+3
|/
* Started moving stuff aroundTodd Leonhardt2017-05-221-70/+79
|
* Made several methods and attributes which an end user should never need to ↵Todd Leonhardt2017-05-221-36/+37
| | | | | | call protected Added a leading underscore to several methods and attributes. This is for things which I don't think an end user should ever need to call.
* Bumping version to 0.7.20.7.2Todd Leonhardt2017-05-221-1/+1
|
* Abbreviations are no longer accepted for multiline commandsTodd Leonhardt2017-05-201-2/+2
| | | | | | Due to the way the parsing logic works for multiline commands, abbreviations didn't function properly with mutliline commands. So to avoid confusion, this commit deals with this issue by simply disallowing abbreviations for multiline commands altogether. A warning has been added to the section on abbreviations in the documentation to hopefully make this clear for users.
* Fixed a hard-coded path separatorTodd Leonhardt2017-05-181-2/+2
| | | | | | Fixed a bug where a path separator was hard-coded as ":" and replaced it with os.path.pathsep Also changed version from 0.7.1a to 0.7.1 in preparation for upcoming release.
* Updated an example, features, and changes based on new support for path and ↵Todd Leonhardt2017-05-171-6/+11
| | | | command completion
* Minor tweaksTodd Leonhardt2017-05-171-2/+2
|
* Tons of tab completion changesTodd Leonhardt2017-05-171-22/+181
| | | | | | | | Attempting to emulate Bash shell behavior as closely as possible. Path completion is significantly improved. Shell command completion of commands is also supported now.
* Improved local path completionTodd Leonhardt2017-05-161-26/+13
| | | | If local path completion has a single result which is a directory, then a trailing path separator is appended for convenience.
* Added path_complete() static method for local file system path completionTodd Leonhardt2017-05-161-0/+56
| | | | | | The edit, load, and shell commands now all use this for their tab completion. Additionally, end users can easily wire it up for use with any of their custom commands.
* Fix Windows unit testsTodd Leonhardt2017-05-111-1/+7
|
* Windows terminal doesn't use ANSI escape codesTodd Leonhardt2017-05-111-0/+4
|
* Added code to protect against GNU Readline bugTodd Leonhardt2017-05-111-1/+27
| | | | | | GNU Readline has a bug in calculating prompt length when ANSI escape codes are present in the prompt. It requires you to escape the escape codes to tell it where sections of invisible characters begin and end. So before calling input(), cmd2 now makes the prompt safe by escaping any ANSI escape codes present.
* Reverting change which prefers gnureadline if availableTodd Leonhardt2017-05-111-9/+0
| | | | The current version of gnureadline available in pip and conda has a malloc error, at least on Mac OS
* Added some checks to deal with unit testing on Windows systems with no readlineTodd Leonhardt2017-05-031-6/+15
| | | | NOTE: For real use on Windows you should have pyreadline installed.
* Try to import gnureadline and then if that fails import readlineTodd Leonhardt2017-05-031-17/+12
|
* Fixed transcript testing issuesTodd Leonhardt2017-04-261-43/+20
| | | | | | Transcript testing no longer creates an unnecessary 2nd instance of the class derived from cmd2.Cmd. This dramatically simplifies transcript testing for derived classes which have required parameters during construction. As a side effect the, feedback_to_output attribute now defaults to false. This had some minor ripple effects on various unit tests.
* Transcript testing now calls preloop() before and postloop() afterTodd Leonhardt2017-04-261-0/+7
|
* Don't throw exception when piping command output to a shell commandTodd Leonhardt2017-04-041-5/+11
| | | | If a non-zero return code is returned from the shell command, just ignore it.