<p>Define a command, to be executed later, either by calling <ahref="/api/@podman-desktop/namespaces/commands/functions/executeCommand">commands.executeCommand</a> or by referencing its name in the <code>command</code> field of a <ahref="/api/interfaces/StatusBarItem">StatusBarItem</a>.</p>
<p>For examples, see <ahref="/api/@podman-desktop/namespaces/commands">commands</a> and <ahref="/api/@podman-desktop/namespaces/window/functions/createStatusBarItem">window.createStatusBarItem</a>.</p>
<h2class="anchor anchorWithStickyNavbar_JmGV"id="parameters">Parameters<ahref="#parameters"class="hash-link"aria-label="Direct link to Parameters"title="Direct link to Parameters"></a></h2>
<h3class="anchor anchorWithStickyNavbar_JmGV"id="command">command<ahref="#command"class="hash-link"aria-label="Direct link to command"title="Direct link to command"></a></h3>
<p><code>string</code></p>
<p>the name of the command. The name must be unique over all extensions. It is recommended to prefix this name with the name of the extension, to avoid conflicts with commands from other extensions.</p>
<h3class="anchor anchorWithStickyNavbar_JmGV"id="callback">callback<ahref="#callback"class="hash-link"aria-label="Direct link to callback"title="Direct link to callback"></a></h3>
<h3class="anchor anchorWithStickyNavbar_JmGV"id="thisarg">thisArg?<ahref="#thisarg"class="hash-link"aria-label="Direct link to thisArg?"title="Direct link to thisArg?"></a></h3>
<p><code>any</code></p>
<p>The value of <code>this</code> provided for the call to callback</p>
<h2class="anchor anchorWithStickyNavbar_JmGV"id="returns">Returns<ahref="#returns"class="hash-link"aria-label="Direct link to Returns"title="Direct link to Returns"></a></h2>
<p>A disposable that unregisters this command when being disposed</p>
<h2class="anchor anchorWithStickyNavbar_JmGV"id="throws">Throws<ahref="#throws"class="hash-link"aria-label="Direct link to Throws"title="Direct link to Throws"></a></h2>
<p>if a command with the same name is already registered.</p></div></article><navclass="pagination-nav docusaurus-mt-lg"aria-label="Docs pages"><aclass="pagination-nav__link pagination-nav__link--prev"href="/api/@podman-desktop/namespaces/commands/functions/executeCommand"><divclass="pagination-nav__sublabel">Previous</div><divclass="pagination-nav__label">executeCommand</div></a><aclass="pagination-nav__link pagination-nav__link--next"href="/api/@podman-desktop/namespaces/configuration"><divclass="pagination-nav__sublabel">Next</div><divclass="pagination-nav__label">configuration</div></a></nav></div></div><divclass="col col--3"><divclass="tableOfContents_XG6w thin-scrollbar theme-doc-toc-desktop"><ulclass="table-of-contents table-of-contents__left-border"><li><ahref="#parameters"class="table-of-contents__link toc-highlight">Parameters</a><ul><li><ahref="#command"class="table-of-contents__link toc-highlight">command</a></li><li><ahref="#callback"class="table-of-contents__link toc-highlight">callback</a></li><li><ahref="#thisarg"class="table-of-contents__link toc-highlight">thisArg?</a></li></ul></li><li><ahref="#returns"class="table-of-contents__link toc-highlight">Returns</a></li><li><ahref="#throws"class="table-of-contents__link toc-highlight">Throws</a></li></ul></div></div></div></div></main></div></div></div><footerclass="footer"><divclass="container container-fluid"><divclass="row footer__links"><divclass="col footer__col"><divclass="footer__title">Documentation</div><ulclass="footer__items clean-list"><liclass="footer__item"><aclass="footer__link-item"href="/docs/installation">Installing Podman Desktop</a></li><liclass="footer__item"><aclass="footer__link-item"href="/docs/migrating-from-docker">Migrating from Docker</a></li><liclass="footer__item"><aclass="footer__link-item"href="/docs/kubernetes">Working with Kubernetes</a></li><liclass="footer__item"><aclass="footer__link-item"href="/docs/troubleshooting">Troubleshooting</a></li></ul></div><divclass="col footer__col"><divclass="footer__title">Links</div><ulclass="footer__items clean-list"><liclass="footer__item"><ahref="https://github.com/podman-desktop/podman-desktop"target="_blank"rel="noopener noreferrer"class="footer__link-item">GitHub<svgwidth="13.5"height="13.5"aria-hidden="true"viewBox="0 0 24 24"class="iconExternalLink_nPrP"><pathfill="currentColor"d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><liclass="footer__item"><ahref="https://discord.com/invite/x5GzFF6QH4"target="_blank"rel="noopener noreferrer"class="footer__link-item">Chat (bridged): #podman-desktop on Discord<svgwidth="13.5"height="13.5"aria-hidden="true"viewBox="0 0 24 24"class="iconExternalLink_nPrP"><pathfill="currentColor"d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><liclass="footer__item"><ahref="https://github.com/podman-desktop/podman-desktop#communication"target="_blank"rel="noopener noreferrer"class="footer__link-item">Other ways to Communicate<svgwidth="13.5"height="13.5"aria-hidden="true"viewBox="0 0 24 24"class="iconExternalLink_nPrP"><pathfill="currentColor"d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><liclass="footer__item"><ahref="https://github.com/orgs/podman-desktop/projects/4/views/3"target="_blank"rel="noopener noreferrer"class="footer__link-item">Current Sprint<svgwidth="13.5"height="13.5"aria-hidden="true"viewBox="0 0 24 24"class="iconExternalLink_nPrP"><pathfill="currentColor"d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><divclass="footer__bottom text--center"><divclass="footer__copyright"><divclass="flex flex-col items-center divide-y-4 divide-none">
<divclass="text-xs">The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our <ahref="https://www.linuxfoundation.org/trademark-usage/"> Trademark Usage</a> page.