optconstruct

This package provides an API for create appropriate option for command to execute in your application. API is called by one of several classes, which each of them handle different type of option.


License
Apache-2.0
Install
pip install optconstruct==0.1.7

Documentation

Option Construct Package (opt_construct)

Package for construct options of Messaging Clients or Ansible based on prefix and input data.

Build/Test Status

Build Status GitHub Issues GitHub Issues pypi Contributions welcome License

Description

This package provides an API for create appropriate option for command to execute in your application. API is called by one of several classes, which each of them handle different type of option.

Example

Exmaple of Toggle class:

data = {'help':True}
obj = Toggle('help','--help')
opt = obj.generate(data)   
print(opt)
    ->  ['--help']

In current version there are these classes:

  • Toggle - Create option only from prefix.
  • Dummy - Only placeholder for specific values.
  • Argument - Create option only from value.
  • Prefixed - Create option with prefix and input value.
  • BasicComposed - Composing multiple value into one option. You must override generate method for your own use.
  • KWOption - Parse a dictionary into multiple appearance of one option with prefix and value.
  • ListOption - Parse a list into multiple appearance of one option with prefix and value.

Requirements

Python >= 3.5

reformat

Install & Run

Not yet uploaded to pypi.

Tests

Requirements

pytest

How to run tests

$ python -m pytest tests/ 

License

Apache 2.0

Author Information

Messaging QE team @ redhat.com