commands
The commands module provides functions to register and execute commands
Example
import * as api from '@podman-desktop/api';
export async function activate(extensionContext: api.ExtensionContext): Promise<void> {
const myCommand = api.commands.registerCommand(
'extension-name.my-command',
(arg1: string, arg2: number) => {
console.log('my-command executed with', arg1, arg2);
},
);
extensionContext.subscriptions.push(myCommand);
// [...]
api.commands.executeCommand('extension-name.my-command', 'a-string', 1001);
}