Makes driver scripts that enable git-like commands so that foo bar will run foo-bar
Project description
gitlike-commands
Background
gitlike-commands
is a python module for easily creating git
-style subcommand handling.
Refactored out of thelogrus so you don't have to import any modules that aren't part of the Python standard library.
Usage
subcommand_driver
automatically figures out what name the script was called as, then looks for subcommands and runs them if found, passing in any command line options.
So if you have a foo
script in your $PATH
as shown below
#!/usr/bin/env python3
from gitlike_commands import subcommand_driver
if __name__ == '__main__':
subcommand_driver()
Running foo bar baz
will look for a foo-bar-baz
script, and if present in your $PATH
, run it. If there is no foo-bar-baz
, it will look for foo-bar
, and if it finds that, run foo-bar baz
.
If you're using poetry in your python project, you can add a gitlike driver as a scripts entry:
[tool.poetry.scripts]
gitalike-demo = "gitlike_commands:subcommand_driver"
The subcommands can be written in any language, the only requirements are that they are marked executable and follow the foo-something
naming convention.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gitlike_commands-0.3.0.tar.gz
.
File metadata
- Download URL: gitlike_commands-0.3.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.18 Darwin/23.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72f4e65239cb6a4a2c614867c5f914b5d5994edd2863335515b543689b01ff70 |
|
MD5 | b528014c8b12c39a6b214af3441d79a2 |
|
BLAKE2b-256 | f830ad1e2fc1cb3fd55aa1549c6151c1a3ddb55c061bcde5419f3d12ff5120cd |
File details
Details for the file gitlike_commands-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: gitlike_commands-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.18 Darwin/23.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c262f8f532639ec8558369bdc2cd904bd0b65638834ed333c42a51be69578f21 |
|
MD5 | 1684eb900ab2868166935bb9f23b0c6c |
|
BLAKE2b-256 | cdd725dbc939f4f707f33b7743949648923271af660bd56f77bda40b47f031e0 |