| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
argparse.ArgumentParser.
This is best practice for consistency of appearance between built-in and custom commands.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Added include_py keyword parameter to cmd2.Cmd.__init__(). If False, then the py command will not be available.
Removed ability to run Python commands from the command line with py.
Made banners and exit messages of Python and IPython consistent.
Changed utils.is_text_file() to raise OSError if file cannot be read.
|
| |
|
| |
|
| |
|
|
|
|
| |
minor import changes.
|
|
|
|
| |
implementation as an option to with_argparser instead.
|
| |
|
|
|
|
|
| |
stdout/stderr is automatically captured in CommandResult during python scripting.
Fixes #898
|
| |
|
|
|
|
| |
This more accurately reflects what it controls
|
| |
|
|
|
|
|
|
|
| |
Also:
- Updated examples that use color to use cmd2.ansi instead of colorama
- Updated tests that use color to use cmd2.ansi instead of colorama
- plumbum_colorspy example shows how to override color lookup functions to use a different color library
|
| |
|
| |
|
|
|
|
| |
and associated comment
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
cmd2.Cmd.cmdloop() now returns self.exit_code which should be an integer
Also:
- Refactored examples to call sys.exit(app.cmdloop()) in their __main__
- Running transcript tests now sets the exit_code accordingly based on success/failure
- Updated CHANGELOG
- Updated README
- Updated Sphinx docs
- Added unit test for case when transcript test fails
|
| |
|
|\ |
|
| |
| |
| |
| | |
supported
|
|/
|
|
|
|
|
|
| |
to colorize the output with
Also:
- Added optional err_color and war_color arguments to perror() for providing color escape codes
- Removed usage of deprecated colorize() method within the examples
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These classes are subtly different, particularly in terms of their truthiness.
CmdResult
- attributes: out, err, war
- truthy: if err is falsy
CommandResult
- attributes: stdout, stderr, data
- truthy: if err is falsy AND data is not None
So CmdResult was oriented to provide essentially info, error, and warning messages to the user (typically as stirngs), whereas CommandResult is geared towards providing info and error messages to the user as strings in addition to data to the user in a command-specific format which is arbitrary other than it should never be None if the command succeeds.
|
|
|
|
|
|
| |
Also:
- Made self.locals_in_py = True for main.py and examples/python_scripting.py
- This makes debugging easier in the embedded IPython shell provided by the opt-in ipy command
|
| |
|
|
|
|
|
|
|
| |
Added some shared definitions to cmd2/__init__.py -> maybe there's a better place for these?
Figured out how to trick bash into showing argument hints. It's a bit weird.
Updated all of the tests and examples to import cmd2 resources from their new location without the automatic imports in cmd2/__init__.py
For #369
|
|
|
|
|
|
|
| |
Removed all dependency on six other than for six.moves.input
Also:
- Started removing code branches which were for Python 2 support
|
| |
|
|
|
|
| |
- Since path_complete got moved outside of cmd2.Cmd and is now a function instead of a method, need to do partial argument binding with functools.partial() instead of functools.partialmethod()
|
|
|
|
| |
Removed usage of and reference to attributes and commands which have now been removed.
|
|
|
|
| |
descriptive
|
|
|
|
| |
Also added another @with_argparser_and_list decorator that uses argparse.parse_known_args to pass two arguments to a command: both the argparse output and a list of unknown/unmatched args.
|
| |
|
|
|
|
|
|
|
| |
Also:
- Updated pythong_scripting.py example to show how to colorize text
- Updated contributing.md to show how to run code coverage in parallel using python-xdist and -nauto
- Updated contributing.md to talk more about looking at unit test results within the PR
|
|
|
|
|
|
| |
Cleaned up the examples directory by adding a scripts subdirectory.
This makes it a bit clearer which Python files are example cmd2 applications and which are example Python scripts for use with the pyscript command.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
Added information related to the new pyscript command.
The old way of running Python scripts via "py run()" should be considered deprecated. The new "pyscript" command
is superior in two significant ways:
1) It supports tab-completion of file system paths
2) It allows the user to pass command-line arguments to scripts
|
|
|
|
| |
command completion
|
|
|
|
|
|
| |
The last two arguments (err and war) are now optional.
Only the 1st argument (out) is required.
err and war default to empty strings.
|
| |
|
|
|
|
|
|
| |
Added the pirate8.py example from Catherine's PyCon2010 talk as pirate.py with some cleanups done.
Added an example of a complete_* method for command argument completion to the python_scripting.py example.
|
|
be achieved via the py command and python scripts.
|