Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a couple simple example for using tmux or byobu to launch cmd2 applications #1399

Merged
merged 5 commits into from
Dec 29, 2024

Conversation

tleonhardt
Copy link
Member

@tleonhardt tleonhardt commented Dec 28, 2024

Added a couple simple example shell scripts demonstrating how to use tmux or [byobu])(https://www.byobu.org/) to launch a cmd2 application in a terminal multiplexer along with another application such as a shell.

One example uses windows/tabs and the other uses a split screen mode.

Using a terminal multiplexer to have a cmd2 app running at the same time as a shell within a single physical terminal is a common use case I have seen multiple cmd2 customer use. This intent is to make this use case more discoverable for those not very familiar with tmux or byobu.

Also added a README.md with brief documentation about each example and added that to the built documentation as well.

…tmux or byobu to launch a cmd2 application in a terminal multiplexer along with another application such as a shell.

One example uses windows/tabs and the other uses a split screen mode.
@tleonhardt tleonhardt self-assigned this Dec 28, 2024
@@ -39,30 +39,30 @@ The price we pay for beautifully colored displays is complexity required to aggr
The `cmd2` framework provides a great mixture of both worlds. Application designers can easily create complex applications and rely on the cmd2 library to offer effortless user facing help and extensive tab completion.
When users become comfortable with functionality, cmd2 turns into a feature rich library enabling a smooth transition to full automation. If designed with enough forethought, a well implemented cmd2 application can serve as a boutique workflow tool. `cmd2` pulls off this flexibility based on two pillars of philosophy:

- Tab Completion
- Automation Transition
- Tab Completion
Copy link
Member Author

@tleonhardt tleonhardt Dec 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All whitespace changes like this are due to prettier auto-formatting of Markdown and YAML files accoridng to the configuration in the .prettierrc configuration file in the cmd2 project root directory.

There is a Prettier extension for VSCode and a Prettier plugin for PyCharm - both make it easy to auto-format on save.

In the future we may want to look into a GitHub Actions workflow to check the auto-formatting of all Markdown and YAML files using Prettier, but I think that might be overkill at this time.

Copy link
Member

@kmvanbrunt kmvanbrunt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few spelling and grammar errors.

- [arg_decorators.py](https://github.com/python-cmd2/cmd2/blob/master/examples/arg_decorators.py)
- Demonstrates how to use the `cmd2.with_argparser` decorator to specify command arguments using [argparse](https://docs.python.org/3/library/argparse.html)
- [arg_print.py](https://github.com/python-cmd2/cmd2/blob/master/examples/arg_print.py)
- Demonstrates how arguments and options get parsed and passed to commands and shows how shortcust work
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix "shortcuts" spelling.

- [custom_parser.py](https://github.com/python-cmd2/cmd2/blob/master/examples/custom_parser.py)
- Demonstrates how to create your own customer `Cmd2ArgumentParser`; used by the `override_parser.py` example
- [decorator_example.py](https://github.com/python-cmd2/cmd2/blob/master/examples/decorator_example.py)
- Shows how to use cmd2's various argparse decotrators to processes command-line arguments
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix "decorators" spelling.

- [modular_commands_main.py](https://github.com/python-cmd2/cmd2/blob/master/examples/modular_commands_main.py)
- Complex example demonstrating a variety of methods to load `CommandSets` using a mix of command decorators
- [modular_subcommands.py](https://github.com/python-cmd2/cmd2/blob/master/examples/modular_subcommands.py)
- Shows how to use dynamically add and remove subcommands at runtime using `CommandSets`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "use".

- [pirate.py](https://github.com/python-cmd2/cmd2/blob/master/examples/pirate.py)
- Demonstrates many features including colorized output, multiline commands, shorcuts, defaulting to shell, etc.
- [python_scripting.py](https://github.com/python-cmd2/cmd2/blob/master/examples/python_scripting.py)
- Shows how cmd2's built-in `run_pyscript` command and provide advanced Python scripting of cmd2 applications
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix wording of this sentence.

# If the second isn't provided, then the user's default shell is launched for this.
#
# byobu must be installed for this script to work and you can install it using your
# operating system package manager. or info on how to use Byobu, see: https://www.byobu.org/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change "or" to "For".

# See the tmux Wiki for info on how to use it: https://github.com/tmux/tmux/wiki.
# To shift focus between different windows in tmux use Ctrl-b followed by l (lowercase "L").
#
# NOTE: IF you have byobu installed, it is a wrapper around tmux and will likely run instead of tmux.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change "IF" to "If".

@tleonhardt tleonhardt merged commit e4ab25f into master Dec 29, 2024
47 checks passed
@tleonhardt tleonhardt deleted the tmux_example branch December 29, 2024 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants