Blender V5.3
bpy_cli_command.cc File Reference
#include <Python.h>
#include "BLI_utildefines.hh"
#include "bpy_capi_utils.hh"
#include "BKE_blender_cli_command.hh"
#include "../generic/py_capi_utils.hh"
#include "../generic/python_compat.hh"
#include "bpy_cli_command.hh"

Go to the source code of this file.

Classes

class  blender::BPyCommandHandler

Namespaces

namespace  blender
 BMesh Iterators.

Functions

Internal Utilities
static PyObject * blender::py_argv_from_bytes (const int argc, const char **argv)
Internal Implementation
static int blender::bpy_cli_command_exec (bContext *C, PyObject *py_exec_fn, const int argc, const char **argv)
static void blender::bpy_cli_command_free (PyObject *py_exec_fn)

Variables

static const char * blender::bpy_cli_command_capsule_name = "bpy_cli_command"
static const char * blender::bpy_cli_command_capsule_name_invalid = "bpy_cli_command<invalid>"

Public Methods

PyMethodDef blender::BPY_cli_command_register_def
PyMethodDef blender::BPY_cli_command_unregister_def
 blender::PyDoc_STRVAR (bpy_cli_command_register_doc, ".. function:: register_cli_command(id, execute)\n" "\n" " Register a command, accessible via the (``-c`` / ``--command``) command-line argument.\n" "\n" " :param id: The command identifier (must pass an ``str.isidentifier`` check).\n" "\n" " If the ``id`` is already registered, a warning is printed and " "the command is inaccessible to prevent accidents invoking the wrong command.\n" " :type id: str\n" " :param execute: Callback, taking a single list of strings and returns an int.\n" " The arguments are built from all command-line arguments following the command id.\n" " The return value should be 0 for success, 1 on failure " "(specific error codes from the ``os`` module can also be used).\n" " :type execute: Callable[[list[str]], int]\n" " :return: The command handle which can be passed to :func:`unregister_cli_command`.\n" "\n" " This uses Python's capsule type " "however the result should be considered an opaque handle only used for unregistering.\n" " :rtype: Any\n")
static PyObject * blender::bpy_cli_command_register (PyObject *, PyObject *args, PyObject *kw)
 blender::PyDoc_STRVAR (bpy_cli_command_unregister_doc, ".. function:: unregister_cli_command(handle)\n" "\n" " Unregister a CLI command.\n" "\n" " :param handle: The return value of :func:`register_cli_command`.\n" " :type handle: Any\n")
static PyObject * blender::bpy_cli_command_unregister (PyObject *, PyObject *value)

Detailed Description

Wrap BKE_command_cli_* to support custom CLI commands.

Definition in file bpy_cli_command.cc.