Blender V4.3
BKE_blender_cli_command.hh File Reference

Blender CLI Generic --command Support. More...

#include "BLI_utility_mixins.hh"
#include <memory>
#include <string>

Go to the source code of this file.

Classes

class  CommandHandler
 

Functions

void BKE_blender_cli_command_register (std::unique_ptr< CommandHandler > cmd)
 
bool BKE_blender_cli_command_unregister (CommandHandler *cmd)
 
int BKE_blender_cli_command_exec (struct bContext *C, const char *id, const int argc, const char **argv)
 
void BKE_blender_cli_command_print_help ()
 
void BKE_blender_cli_command_free_all ()
 

Detailed Description

Blender CLI Generic --command Support.

Note
all registered commands must print help to the STDOUT & exit with a zero exit-code when --help is passed in as the first argument to a command.

Definition in file BKE_blender_cli_command.hh.

Function Documentation

◆ BKE_blender_cli_command_exec()

int BKE_blender_cli_command_exec ( struct bContext * C,
const char * id,
const int argc,
const char ** argv )

Run the command by id, passing in the argument list & context. The argument list must begin after the command identifier.

Definition at line 122 of file blender_cli_command.cc.

References blender_cli_command_lookup(), CommandHandler::exec(), and CommandHandler::is_duplicate.

Referenced by arg_handle_command_set().

◆ BKE_blender_cli_command_free_all()

void BKE_blender_cli_command_free_all ( )

Frees all commands (using their #CommandFreeFn call-backs).

Definition at line 176 of file blender_cli_command.cc.

References g_command_handlers.

Referenced by WM_exit_ex().

◆ BKE_blender_cli_command_print_help()

void BKE_blender_cli_command_print_help ( )

Print all known commands (used for passing --command help in the command-line).

Definition at line 138 of file blender_cli_command.cc.

References b, and g_command_handlers.

Referenced by arg_handle_command_set().

◆ BKE_blender_cli_command_register()

void BKE_blender_cli_command_register ( std::unique_ptr< CommandHandler > cmd)
Parameters
cmdThe memory for a command type (ownership is transferred).

Definition at line 74 of file blender_cli_command.cc.

References blender_cli_command_lookup(), and g_command_handlers.

Referenced by bpy_cli_command_register().

◆ BKE_blender_cli_command_unregister()

bool BKE_blender_cli_command_unregister ( CommandHandler * cmd)

Unregister a previously registered command.

Definition at line 87 of file blender_cli_command.cc.

References blender_cli_command_index(), g_command_handlers, CommandHandler::id, and CommandHandler::is_duplicate.

Referenced by bpy_cli_command_unregister().