List installed nRF Util commands in Python

nRF Util

tags
nRF Util

The following Python code snippet uses JSON output to retrieve the installed nRF Util commands:

import json
import subprocess

output = subprocess.run(
    ["nrfutil", "--json", "list", "--skip-overhead"],
    capture_output=True,
    check=True,
    text=True,
)
installed_commands = json.loads(output.stdout)

print(json.dumps(installed_commands, indent=2))