Author: Alexander Weigl <[email protected]>
License: LGPLv3
Support for CTK's Command Line Interface
Install over pip pip install pyclictk
- Parse CLI XML into Python model
- Create CLI XML from Python model
- Create
argparse.ArgumentParser
or adocopt
description for a CLI model - Invoke CLI executable with arguments
>>> from clictk import Executable
>>> exe1 = Executable.from_exe("myexecutable")
>>> exe2 = Executable.from_xml("myexecutable.xml")
>>> from clictk import Executable, ParameterGroup, Parameter
>>> exe = Executable(executable=sys.argv[0],
category="example",
title="My Super App",
description="This is just awesome",
version="1.0",
license=None,
contributor=None,
acknowledgements=None,
documentation_url=None,
parameter_groups=[
ParameterGroup(
label="FirstGroup",
description="Test",
parameters=[
Parameter("imagefile", "image", "test.png",
description="image file",
channel="input",,
label="Image",
flag="i",
file_ext=".png")
]
)
]):
>>> exe.as_xml()
>>> ap = build_argument_parser(exe)
>>> ap.parse_args()
exe.run(imagefile="abc.png")