Skip to main content

commands

The commands module provides functions to register and execute commands Existing commands available for extensions to use:

  • pullImage: uses Podman Desktop's UI pull image behavior. This command will create a visible task to show the progress of the pullImage action with the option to include a task action. It uses the same parameters as the original pullImage function, in addition to having taskActionName: string and taskActionCallback: () => void as parameters to create a task action (optional).

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);
}

Functions