Skip to main content

Makes driver scripts that enable git-like commands so that foo bar will run foo-bar

Project description

gitlike-commands

License Build Status Awesomebot Megalinter Issue Count PyPI - Format

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

gitlike_commands-0.3.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitlike_commands-0.3.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file gitlike_commands-0.3.1.tar.gz.

File metadata

  • Download URL: gitlike_commands-0.3.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gitlike_commands-0.3.1.tar.gz
Algorithm Hash digest
SHA256 ceb56f6994a7485244da4d4a3a471ddcbfc7294ef922d967131595cc3090601d
MD5 16684cb38bd2b992b61af56f9bdc1aab
BLAKE2b-256 90c25dfe00b57b3c4e0e7058616139871f1116a88b6978869295e37a217f2ce7

See more details on using hashes here.

File details

Details for the file gitlike_commands-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: gitlike_commands-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gitlike_commands-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9f29e196fb3f2cb0752f8e86de79bf2095980aed9e3aafe8422819a0dd0fb640
MD5 06523131c93b7c9b516fe02f79a7c634
BLAKE2b-256 03e54e74d8e83a535be5d9b744dc193d029a95f0aa6203582246202b9dafe87b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page