dragonfly.cli package


Module contents

Command Line Interface (CLI) entry point for dragonfly and dragonfly extensions.

Use this file only to add commands related to dragonfly-core. For adding extra commands from each extention see below.

Dragonfly is using click (https://click.palletsprojects.com/en/7.x/) for creating the CLI. You can extend the command line interface from inside each extention by following these steps:

  1. Create a cli folder in your extension.

  2. Import the main function from this dragonfly.cli.

  3. Add your commands and command groups to main using add_command method.

  4. Add import [your-extention].cli to __init__.py file to the commands are added to the cli when the module is loaded.

Good practice is to group all your extention commands in a command group named after the extension. This will make the commands organized under extension namespace. For instance commands for dragonfly-energy will be called like dragonfly energy [energy-command].

import click
from dragonfly.cli import main

def energy():

# add commands to energy group
# ...
def to_idf():

# finally add the newly created commands to dragonfly cli

# do not forget to import this module in __init__.py otherwise it will not be added
# to dragonfly commands.


For extension with several commands you can use a folder structure instead of a single file.