Skip to main content

pytcm - Python Terminal Commands Manager

Project description

pytcm

A Python Terminal Commands Manager

Installation

$ pip install pytcm

Usage

Using execute directly

import pytcm

binary = 'python'
opts = [
    pytcm.Flag('--version', True)
]

result = pytcm.execute(binary, opts)

print(result.out)  # "Python 3.9.7"
print(result.err)  # ""
print(result.returncode)  # 0

Using a Command object that holds the context

import pytcm

binary = 'python'
opts = [
    pytcm.Flag('--version', True)
]

cmd = pytcm.Command(binary, opts)
cmd.execute()

print(cmd.out)  # "Python 3.9.7"
print(cmd.err)  # ""
print(cmd.returncode)  # 0

Options

Flag

A boolean option

import pytcm

flag = pytcm.Flag("--verbose", True)
opt = flag.parse()

print(opt)  # "--verbose"

Explicit

An option with an equal sign

import pytcm

explicit = pytcm.Explicit("--age", 12)
opt = explicit.parse()

print(opt)  # "--age=12"

Implicit

An option separated by a space character

import pytcm

implicit = pytcm.Implicit("--age", 12)
opt = implicit.parse()

print(opt)  # "--age 12"

Positional

A simple inline option

import pytcm

positional = pytcm.Positional("test.txt")
opt = positional.parse()

print(opt)  # "test.txt"

Contributing

Thank you for considering making pytcm better.

Please refer to docs.

Change Log

See CHANGELOG

License

MIT

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

pytcm-0.5.6.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

pytcm-0.5.6-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file pytcm-0.5.6.tar.gz.

File metadata

  • Download URL: pytcm-0.5.6.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.6.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.8.13

File hashes

Hashes for pytcm-0.5.6.tar.gz
Algorithm Hash digest
SHA256 1debb06c3e4eb80acb84f9c3f72b292045d63212faf9cca458de600d9b7c7b46
MD5 d9a8a40d1e96d7efa3629508c5c543b6
BLAKE2b-256 ab14d7c66af0d37f08f30b602b1982759aecc26e29fc496ab9e5be46ef8a9296

See more details on using hashes here.

File details

Details for the file pytcm-0.5.6-py3-none-any.whl.

File metadata

  • Download URL: pytcm-0.5.6-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.6.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.8.13

File hashes

Hashes for pytcm-0.5.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c628c68c4de272829f57a8258f633e371086e1e057e22145c4f975692980c7ba
MD5 e191a96a3363a4e1c0023c9b238484d8
BLAKE2b-256 df9a4b25b013f04614732284af8a730bbae55aac798c3241dd8664042dbb12e0

See more details on using hashes here.

Supported by

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