Skip to main content

Make custom terminal commands in python.

Project description

TermCmds module

Make custom terminal commands in python.

how to make a basic command

example.py:

import TermCmds

cmd = TermCmds.Command()

@cmd.main_command
def main(args, kwargs, options):
    print(args)
    print(kwargs)
    print(options)

@cmd.command("subcommand")
def subcommand(args, kwargs, options):
    print("subcommand")
    print(args)
    print(kwargs)
    print(options)

if __name__ == "__main__":
    cmd.run()

python example.py a b -k v --o outputs:

["a", "b"]
{"k": "v"}
["o"]

python example.py subcommand c d -key value --option outputs:

subcommand
["c", "d"]
{"key": "value"}
["option"]

documentation

TermCmds.Command() is the class for the command
@cmd.main_command is the main command for .. args kwars options
@cmd.command(name) is the function link for .. name args kwargs options
args is a list of values that are not kwargs or options
kwargs is a dictionary of keys and values -key value
options is a list of options --option

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

TermCmds-0.0.3.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

TermCmds-0.0.3-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file TermCmds-0.0.3.tar.gz.

File metadata

  • Download URL: TermCmds-0.0.3.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.0

File hashes

Hashes for TermCmds-0.0.3.tar.gz
Algorithm Hash digest
SHA256 98b58118085993e961b50d4ce114f4e517d6fa7f66c0a735b66fce91a240ddd0
MD5 60b2c0c55de15e961009ee41d8b101a3
BLAKE2b-256 d0cbaca420da1831e14703a33db329d4daf593830eba88d79031a265ad2704a7

See more details on using hashes here.

File details

Details for the file TermCmds-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: TermCmds-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.0

File hashes

Hashes for TermCmds-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2821988a0ff442bf61dc45c846885e11afaf48a7611ad82c8dab873232b5ee97
MD5 04c04174c3e73d85822e52530ddbabf2
BLAKE2b-256 b2a7aa382a41fe408a0dfd1d3525967feb3999549b02232d325ca8daeeb5cf70

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