Skip to content

Writing a Plugin with a Subcommand

takeshix edited this page May 14, 2018 · 3 revisions

In order to be used as a subcommand, a plugin needs to define the following class variables:

  • cmd_name: The name of the subcommand.
  • cmd_help: The help string that will be used in the argparse help page.
  • cmd_only: An optional class variable that indicates that a plugin is only usable a subcommand on the CLI. This can be used for plugin that e.g. take multiple input parameters that (currently) cannot be used in the GUI.

The core DeenPlugin class defines two function:

  • add_argparser: A staticmethod that can be overridden by plugins in order to add a new argparse parser.
  • process_cli: A function that can be overridden by plugins to define the process of the plugin un subcommand-mode. Plugins only need to override this if the plugin process is more complex than the typical process/unprocess of most of the codecs plugins.