Skip to main content

To create command-line and options.

Project description

py_cmdoptions

py_cmdoptions is a tool that makes it easy to create a command with options.

you can extend Executor to create a new cmd types.

you can also extend Option to create a new option types.

example1

from py_cmdoptions.executor import Executor
from py_cmdoptions.option import Option

class Python(Executor):
    cmd:str = 'python'

class Version(Option):
    opt:str = '--version'

py = Python()
py.addOption(Version())
print(py)

some command options have a specific order, such as ffmpeg:

usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

example2

from py_cmdoptions.executor import Executor
from py_cmdoptions.option import Option

class FFmpeg(Executor):
    cmd:str = 'ffmpeg'

class InFile(Option):
    opt:str = '-i'
    prio:int = 1

class OutFile(Option):
    opt:str = ''
    prio:int = 2

ff = FFmpeg()
ff.addOption(OutFile('output.mp4'))
ff.addOption(InFile('input.mp4'))
print(ff)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

py_cmdoptions-0.0.2-py38-none-any.whl (8.4 kB view details)

Uploaded Python 3.8

File details

Details for the file py_cmdoptions-0.0.2-py38-none-any.whl.

File metadata

  • Download URL: py_cmdoptions-0.0.2-py38-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for py_cmdoptions-0.0.2-py38-none-any.whl
Algorithm Hash digest
SHA256 38472c7619b040e373eee397376552f4a53e47f6b5028a808c74483d26a37309
MD5 cdd00f49aac54468eef77dd02ced1346
BLAKE2b-256 767a48b1e85282563e65f944cf0a281a3c29f41fe69dc716d9d7d4406f26371b

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