clarkperkins / click-shell

An extension to click that easily turns your click app into a shell utility
BSD 3-Clause "New" or "Revised" License
90 stars 17 forks source link

Adding Linux-style command chaining #46

Open caseyriebe opened 3 years ago

caseyriebe commented 3 years ago

I've been using this package for some time in a work project where we need to make a custom shell for end-users to lock down everything, save for a few necessary commands, and to make in more Linux/Unix-like I added command chaining into my shell.

It supports both AND && and OR || chains, and multiple combinations of each. I can write tests for them if desired. Although, I can tell you from usage that it works well.

It does require the saving of the return_code of the command in the global core context, but that was a 2 line change in core.py.

I am happy to answer any other questions or provide a demo, if needed.

Great project! Glad I can contribute something!

caseyriebe commented 3 years ago

Also, when I ran build.sh all of the tests that needed cli_runner fixture failed. I wasn't sure where that was suppose to be pulled from, so I added a conftest.py and imported the click.testing.CliRunner() and served it out of the fixture for the tests. They all passed after that.

plasorak commented 2 years ago

Any news if/when this could be merged? This could be very useful (by the way, I couldn't get the OR version to work).