Manage all your command line tools easily in one place!
Poly can be installed easily with the following command:
curl https://raw.githubusercontent.com/ketanv3/poly/master/scripts/install.sh -o install-poly.sh && chmod 755 ./install-poly.sh && ./install-poly.sh
Depending on your configuration, you might need to run this command with sudo
. If this fails for you, follow the manual install procedure given below.
POLY_WORKSPACE
environment variable defines the root directory that containing all your executable commands. Add it to .bashrc
/ .zshrc
or similar so that it's sourced every time a new shell is launched.
export POLY_WORKSPACE=~/poly_ws/
A workspace contains bunch of folders and files (leaf nodes) which form the searchable command path.
↳ poly_ws
↳ foo
↳ bar
↳ hello_world.py
↳ code
↳ vscode.py
↳ intellij.py
↳ base64
↳ encode.py
↳ decode.py
Creating these commands is pretty easy in itself. We use Click library to generate command line utilities.
Here's a simple hello-world.py
example:
import click
@click.command()
@click.option('--name', required=True)
@click.option('--count', default=1)
def command(name, count):
for i in range(count):
print(f'Hello, {name}!')
To execute the above command:
poly foo bar hello_world --name poly --count 5
Make sure you're running Python 3.6+. Run the following command to confirm.
python --version
Once Python version is confirmed, clone the project and run the following commands from the root directory of the project:
python setup.py install
That's it! Poly should now be installed! Confirm by running the following command:
poly
To build the module and run the tests, run the following command:
python setup.py test
Alternatively, tests can be run without building the module. To also report the code coverage, use the following command:
python -m pytest --cov=poly --cov-report term-missing
If you encounter any issues or have suggestions, please file an issue along with a detailed description. Remember to apply labels for easier tracking.
We use SemVer for versioning. For the available versions, see the tags on this repository
See the list of contributors who participated in this project.