'installing a bash console script using poetry, pipx, click, poethepoet, etc
I have a bash script which spawns an interactive client that connects to services in AWS. It would take too much effort to reimplement the entire utility in python, so for the time being I'd like to wrap the utility and install it as a console tool using poetry/pipx.
The tool behaves simply. It is invoked by typing 'cli' and hitting tab to complete a series of destinations. You select one and hit return. An interactive client then connects to the service.
Despite a rather broad survey of the python console tools available, I have yet to find a workable combination to produce the simple behavior above, mostly due to the specific constraints:
- Must spawn a bash shell script.
- Must handle tab completion
- Must pass the selected destination to the invoked script as the first argument.
- Must spawn an interactive client via shell.
- Must install a symlink to the util as part of a python package.
- uses pipx/poetry as an installer.
The solution might be a combination of poetry, pipx, click, poethepoet, typer, etc. After several attempts I've yet to find a working combination that fits all constraints.
I'm almost at the point of giving up the idea of a simple console tool installed as a python package. Still, it would really help the organization of my tool framework as it evolves.
Can anyone here suggest how to make a python package that installs a bash script, which uses a single, tab-completed, positional argument, and then spawns an interactive shell? Is this possible, or is it still out of reach given the available tools?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
