• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

README.mdD11-Mar-20241.8 KiB4334

__init__.pyD11-Mar-20240 10

constants.pyD11-Mar-20241.2 KiB4333

core_ext.pyD11-Mar-202424 KiB585537

create_ext.pyD11-Mar-20245.6 KiB12196

debug_ext.pyD11-Mar-202416.9 KiB405361

dfu_ext.pyD11-Mar-20242.6 KiB6655

errors.pyD11-Mar-2024497 1610

global_options.pyD11-Mar-2024156 76

serial_ext.pyD11-Mar-202412.6 KiB308262

tools.pyD11-Mar-202413.7 KiB355258

uf2_ext.pyD11-Mar-2024744 2520

README.md

1# idf.py extensions
2Python modules (subdirectories and files) in this directory named `[your_extension]_ext` will be loaded as idf.py extensions.
3If you want to provide extra extensions just provide `;` separated list of directories with extensions in  `IDF_EXTRA_ACTIONS_PATH`. Extensions will be loaded in alphanumeric order.
4Command line arguments parsing and extension mechanism is implemented on top of [Click](https://click.palletsprojects.com/en/5.x/) (versions >=5.0 are supported).
5
6They should define a function `action_extensions(base_actions, project_path)` where:
7
8- base_actions - dictionary with actions that are already available for idf.py
9- project_path - working dir, may be defaulted to `os.getcwd()`
10
11This function have to return a dict with 3 possible keys:
12
13```python
14{
15    # Additional options that will be available from id
16    "global_options": [{
17        "names": ["--option-name"],
18        "help": "Help for option --option-name.",
19    }],
20    # List of functions that will have access to full app context, and can mangle with arguments
21    "global_action_callbacks": [global_callback],
22    # Additional subcommands for idf.py
23    "actions": {
24        "subcommand_name": {
25            "callback": subcommand_callback,
26            "help": "Help for subcommand.",
27        },
28    },
29}
30```
31
32Where function `global_callback(ctx, global_args, tasks)` accepts 3 arguments:
33
34- ctx - [Click context](https://click.palletsprojects.com/en/5.x/api/#context)
35- global_args - dictionary of all available global arguments
36- tasks - list of Task objects
37
38And `subcommand_callback(subcommand_name, ctx, args)` accepts 3 arguments:
39
40- subcommand_name - name of subcommand
41- ctx - [Click context](https://click.palletsprojects.com/en/5.x/api/#context)
42- args - list of command's arguments
43