Skip to content

CognitionGuidedSurgery/pyclictk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyclictk

Circle CI Documentation Status

Author: Alexander Weigl <[email protected]>
License: LGPLv3

Support for CTK's Command Line Interface

Install over pip pip install pyclictk

Features

  • Parse CLI XML into Python model
  • Create CLI XML from Python model
  • Create argparse.ArgumentParser or a docopt description for a CLI model
  • Invoke CLI executable with arguments

Parse CLI XML into Python model

>>> from clictk import Executable
>>> exe1 = Executable.from_exe("myexecutable")
>>> exe2 = Executable.from_xml("myexecutable.xml")

Create CLI XML from Python model

>>> 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()

Create argparse.ArgumentParser or a docopt description for a CLI model

>>> ap = build_argument_parser(exe)
>>> ap.parse_args() 

Invoke CLI executable with arguments

exe.run(imagefile="abc.png")

About

Python Support for CTK Command Line Interface (CLI)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages