summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
...
* Moved example scripts from examples to examples/scripts directlyTodd Leonhardt2017-06-215-2/+2
| | | | | | 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.
* Changed default value for USE_ARG_LIST global to TrueTodd Leonhardt2017-06-142-4/+7
| | | | | | | | | | | 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.
* Updated documentation and examplesTodd Leonhardt2017-06-143-16/+27
| | | | | | | | | 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
* Added new pyscript commandTodd Leonhardt2017-06-132-2/+9
| | | | | | | | 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
* Updated example transcript test and docsTodd Leonhardt2017-06-031-2/+2
| | | | Updated these to reflect that the list command has been removed
* Updated an example, features, and changes based on new support for path and ↵Todd Leonhardt2017-05-171-12/+3
| | | | command completion
* Apparently regex syntax is stricter for Python 3 on Windows.Todd Leonhardt2017-03-162-1/+3
| | | | | | Than it is for Python 2 on Windows or Python 3 on Linux or Mac. Go figure. You would think it would be the same for Python 3 across platforms.
* Added a regex to transcript for color because its not present on Windows.Todd Leonhardt2017-03-161-2/+2
|
* Added example of using a regular expression in a transcript test.Todd Leonhardt2017-03-162-0/+19
| | | | Also added a unit test for this feature.
* Improved the CmdResult namedtuple subclassTodd Leonhardt2017-03-142-6/+12
| | | | | | 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 intro with unicode characters to one example.Todd Leonhardt2017-03-141-3/+5
|
* Mostly fix a bunch of spelling mistakes.Todd Leonhardt2017-03-136-7/+13
| | | | A few other miscellaneous minor tweaks for whitespace and such.
* Improved examplesTodd Leonhardt2017-03-112-3/+112
| | | | | | 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.
* Added an example for how conditional control flow of a cmd2 application can ↵Todd Leonhardt2017-03-112-0/+126
| | | | be achieved via the py command and python scripts.
* Added basic example of how to use cmd2 in a manner that doesn't own the main ↵Todd Leonhardt2017-03-041-0/+26
| | | | inner loop of an application.
* Added info to CHANGES.rst on what bugs have been fixed so far this release.Todd Leonhardt2017-03-041-0/+88
| | | | | | Fixed a bug where the allow_cli_args attribute wasn't properly preventing OptParse from prasing the args looking for "-t" or "--test" for transcript testing. Added an example of using Argparse with cmd2.
* Changes to make our project as welcoming as possible for new contributors.Todd Leonhardt2017-02-264-0/+127
Changes include: 1) Added CONTRIBUTING.md with detailed instructions for how to contribute, which should be especially useful to those new to open source in general or GitHub in particular 2) Added CODE_OF_CONDUCT.md which sets ground rules for participants’ behavior and helps to facilitate a friendly, welcoming environment 3) Renamed the "example" directory to "examples" in the hope that one day soon there may be more than a single example ;-)