Package: xappt
XAPPT - extensible application toolkitXAPPT(pronounced like "zapped") is a toolkit that makes it easy to create  custom command line tools and invoke them from a uniform interface.XAPPTrequires Python 3.7 or higher.To get started just create a subclass ofxappt.models.plugin.Plugin, and make sure it's loadable by invoking your package, or apluginssubmodule of your package.The name of your module should have the prefix "xappt". This allows automatic plugin discovery by scanningsys.path, and scanning paths defined on the environment variableXAPPT_PLUGIN_PATH.Getting startedIf xappt is installed to the system Python interpreter, it should be available on the command line just by running thexapptcommand.If everything is installed properly you should get output that looks like this:$ xappt
usage: xappt [-h] [--version] {} ...

positional arguments:
  {}  Sub command help

optional arguments:
  -h, --help   show this help message and exit
  --version    Display the version numberLet's walk through creating a custom plugin. I'll be doing this on Linux, but the process is pretty similar on other systems.First, make sure that xappt is installed:$ pip3 install xapptNext, let's make sure thatxapptis available on the command line:$ xappt --version
xappt 0.0.3-4735e57Now lets make a new plugin:$ cd ~
$ mkdir -p temp/xappt_plugin
$ cd temp/xappt_plugin
$ touch __init__.pyWe're created a folder named "temp", and inside that a folder named "xappt_plugin".The reason for the two folders is so that we can add "temp" toXAPPT_PLUGIN_PATH, so that the "xappt_plugin" folder can be found inside it. We'll get to that momentarily.Then we create a new file in "xappt_plugin" named__init__.py.Now in__init__.pyadd the following code:importxappt@xappt.register_pluginclassMyPlugin(xappt.BaseTool):arg1=xappt.ParamString(required=True)arg2=xappt.ParamString(required=True)arg3=xappt.ParamString(required=True)@classmethoddefhelp(cls)->str:returnstr("A simple command that will just echo the passed in arguments")defexecute(self,interface:xappt.BaseInterface,**kwargs)->int:print(self.arg1.value)print(self.arg2.value)print(self.arg3.value)return0Finally, we have to add that "temp" folder to an environment variable to make our plugin discoverable, and then invoke xappt.On Linux this would look something like this:$ export XAPPT_PLUGIN_PATH=~/temp
$ xapptOn Windows it would look like this:set XAPPT_PLUGIN_PATH=C:\path\to\temp
xapptThe output should now look like this:usage: xappt [-h] [--version] {myplugin} ...

positional arguments:
  {myplugin}            Sub command help
    myplugin            A simple command that will just echo the passed in arguments

optional arguments:
  -h, --help            show this help message and exit
  --version             Display the version numberAnd when runningxappt myplugin:$ xappt myplugin
usage: main.py example [-h] --arg1 ARG1 --arg2 ARG2 --arg3 ARG3
xappt myplugin: error: the following arguments are required: --arg1, --arg2, --arg3So let's pass in some arguments:$ xappt myplugin --arg1 123 --arg2 abc --arg3 xyz
123
abc
xyzFor more complicated plugins you can have a structure like this:/xappt_plugin
    /plugins
        __init__.py
        myplugin.py
    __init__.pyIn this casemyplugin.pywould contain theMyPluginclass. Andxappt_plugin/plugins/__init__.pymight look like this:from .myplugin import MyPluginAnd that's it. Now feel free to makeexecutedo something actually useful.ExamplesXappt ships with a few example plugins that you can dissect. To load these plugins set an environment variable named XAPPT_LOAD_EXAMPLE_TOOLS to "1" before loading Xappt.$exportXAPPT_LOAD_EXAMPLE_TOOLS=1These examples can be found inxappt.plugins.tools.examples.