Metadata-Version: 2.4
Name: py_cmdoptions
Version: 0.0.2
Summary: To create command-line and options.
Author-email: ThankVinci <thankvinci@163.com>
Project-URL: Homepage, https://github.com/ThankVinci/py-cmdoptions
Project-URL: Repository, https://github.com/ThankVinci/py-cmdoptions.git
Keywords: command-line,options
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Dynamic: license-file

# 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

```python

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

```python

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)

```
