Page Not Found
We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
diff --git a/404.html b/404.html index 3d02fa3f..66514b59 100644 --- a/404.html +++ b/404.html @@ -11,8 +11,8 @@ - - + +
We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
catch
method",id:"error-handling-in-the-catch-method",level:2},{value:"bin/run.js catch
handler",id:"binrunjs-catch-handler",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.p,{children:["oclif handles intentionally - and unintentionally - thrown errors in two places. First in the ",(0,o.jsx)(n.code,{children:"Command.catch"})," method and then, finally, in the ",(0,o.jsx)(n.code,{children:"bin/run.js"})," ",(0,o.jsx)(n.code,{children:"catch"})," handler where the Error is printed and the CLI exits. This error flow makes it possible for you to control and respond to errors that occur in your CLI as you see fit."]}),"\n",(0,o.jsxs)(n.h2,{id:"error-handling-in-the-catch-method",children:["Error Handling in the ",(0,o.jsx)(n.code,{children:"catch"})," method"]}),"\n",(0,o.jsxs)(n.p,{children:["Every ",(0,o.jsx)(n.code,{children:"Command"})," instance has a ",(0,o.jsx)(n.code,{children:"catch"})," method that is called when an error occurs throughout the course of a command run. This method handles the edge case of users asking for help or version output, if applicable, otherwise, it re-throws the error. You can extend or overwrite the ",(0,o.jsx)(n.code,{children:"catch"})," method in your command class."]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",children:"import {Command, flags} from '@oclif/core'\n\nexport default class Hello extends Command {\n async catch(error) {\n // do something or\n // re-throw to be handled globally\n throw error;\n }\n}\n"})}),"\n",(0,o.jsxs)(n.p,{children:["If this type of error handling is being implemented across multiple commands consider using a ",(0,o.jsx)(n.a,{href:"/docs/base_class",children:"Custom Base Class"})," for your commands and overriding the ",(0,o.jsx)(n.code,{children:"catch"})," method."]}),"\n",(0,o.jsxs)(n.h2,{id:"binrunjs-catch-handler",children:["bin/run.js ",(0,o.jsx)(n.code,{children:"catch"})," handler"]}),"\n",(0,o.jsxs)(n.p,{children:["Every oclif CLI has a ",(0,o.jsx)(n.code,{children:"./bin/run.js"})," file that is the entry point of command invocation. Errors that occur in the CLI, including re-thrown errors from a Command, are caught and handled by oclif's ",(0,o.jsx)(n.code,{children:"handle"})," function, which displays the error to the user."]}),"\n",(0,o.jsxs)(n.p,{children:["If you generated your CLI using ",(0,o.jsx)(n.code,{children:"oclif generate"}),", then you will see an ",(0,o.jsx)(n.code,{children:"execute"})," function that's responsible for running the CLI and catching any errors. You can, however, implement this yourself if you need to customize the error handling."]}),"\n",(0,o.jsxs)(n.p,{children:["Here's the generic ",(0,o.jsx)(n.code,{children:"bin/run.js"})," that comes with ",(0,o.jsx)(n.code,{children:"oclif generate"}),":"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-javascript",children:"#!/usr/bin/env node\n\nimport {execute} from '@oclif/core'\n\nawait execute({dir: import.meta.url})\n"})}),"\n",(0,o.jsxs)(n.p,{children:["To customize error handling, you'll want to use oclif's ",(0,o.jsx)(n.code,{children:"run"})," function instead of ",(0,o.jsx)(n.code,{children:"execute"}),":"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-javascript",children:"#!/usr/bin/env node\n\nimport {run, handle, flush} from '@oclif/core'\n\nawait run(process.argv.slice(2), import.meta.url)\n .catch(async (error) => handle(error))\n .finally(async () => flush())\n"})}),"\n",(0,o.jsxs)(n.p,{children:["The ",(0,o.jsx)(n.code,{children:"catch"})," handler can be swapped for any function that receives an error argument. If you chose to implement your own handler here, we still recommend you delegate finally to the ",(0,o.jsx)(n.code,{children:"handle"})," function for clean-up and exiting logic."]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",children:".catch((error) => {\n // do any extra work with error\n return handle(error);\n})\n"})})]})}function h(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>i});var o=r(6540);const t={},c=o.createContext(t);function s(e){const n=o.useContext(c);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:s(e.components),o.createElement(c.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
+"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5082],{492:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>s,default:()=>h,frontMatter:()=>c,metadata:()=>i,toc:()=>d});var o=r(4848),t=r(8453);const c={title:"Error Handling"},s=void 0,i={id:"error_handling",title:"Error Handling",description:"oclif handles intentionally - and unintentionally - thrown errors in two places. First in the Command.catch method and then, finally, in the bin/run.js catch handler where the Error is printed and the CLI exits. This error flow makes it possible for you to control and respond to errors that occur in your CLI as you see fit.",source:"@site/../docs/error_handling.md",sourceDirName:".",slug:"/error_handling",permalink:"/docs/error_handling",draft:!1,unlisted:!1,editUrl:"https://github.com/oclif/oclif.github.io/tree/docs/docs/../docs/error_handling.md",tags:[],version:"current",lastUpdatedBy:"Mike Donnalley",lastUpdatedAt:1711652444,formattedLastUpdatedAt:"Mar 28, 2024",frontMatter:{title:"Error Handling"},sidebar:"docs",previous:{title:"Help Classes",permalink:"/docs/help_classes"},next:{title:"JSON",permalink:"/docs/json"}},a={},d=[{value:"Error Handling in the catch
method",id:"error-handling-in-the-catch-method",level:2},{value:"bin/run.js catch
handler",id:"binrunjs-catch-handler",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.p,{children:["oclif handles intentionally - and unintentionally - thrown errors in two places. First in the ",(0,o.jsx)(n.code,{children:"Command.catch"})," method and then, finally, in the ",(0,o.jsx)(n.code,{children:"bin/run.js"})," ",(0,o.jsx)(n.code,{children:"catch"})," handler where the Error is printed and the CLI exits. This error flow makes it possible for you to control and respond to errors that occur in your CLI as you see fit."]}),"\n",(0,o.jsxs)(n.h2,{id:"error-handling-in-the-catch-method",children:["Error Handling in the ",(0,o.jsx)(n.code,{children:"catch"})," method"]}),"\n",(0,o.jsxs)(n.p,{children:["Every ",(0,o.jsx)(n.code,{children:"Command"})," instance has a ",(0,o.jsx)(n.code,{children:"catch"})," method that is called when an error occurs throughout the course of a command run. This method handles the edge case of users asking for help or version output, if applicable, otherwise, it re-throws the error. You can extend or overwrite the ",(0,o.jsx)(n.code,{children:"catch"})," method in your command class."]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",children:"import {Command, flags} from '@oclif/core'\n\nexport default class Hello extends Command {\n async catch(error) {\n // do something or\n // re-throw to be handled globally\n throw error;\n }\n}\n"})}),"\n",(0,o.jsxs)(n.p,{children:["If this type of error handling is being implemented across multiple commands consider using a ",(0,o.jsx)(n.a,{href:"/docs/base_class",children:"Custom Base Class"})," for your commands and overriding the ",(0,o.jsx)(n.code,{children:"catch"})," method."]}),"\n",(0,o.jsxs)(n.h2,{id:"binrunjs-catch-handler",children:["bin/run.js ",(0,o.jsx)(n.code,{children:"catch"})," handler"]}),"\n",(0,o.jsxs)(n.p,{children:["Every oclif CLI has a ",(0,o.jsx)(n.code,{children:"./bin/run.js"})," file that is the entry point of command invocation. Errors that occur in the CLI, including re-thrown errors from a Command, are caught and handled by oclif's ",(0,o.jsx)(n.code,{children:"handle"})," function, which displays the error to the user."]}),"\n",(0,o.jsxs)(n.p,{children:["If you generated your CLI using ",(0,o.jsx)(n.code,{children:"oclif generate"}),", then you will see an ",(0,o.jsx)(n.code,{children:"execute"})," function that's responsible for running the CLI and catching any errors. You can, however, implement this yourself if you need to customize the error handling."]}),"\n",(0,o.jsxs)(n.p,{children:["Here's the generic ",(0,o.jsx)(n.code,{children:"bin/run.js"})," that comes with ",(0,o.jsx)(n.code,{children:"oclif generate"}),":"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-javascript",children:"#!/usr/bin/env node\n\nimport {execute} from '@oclif/core'\n\nawait execute({dir: import.meta.url})\n"})}),"\n",(0,o.jsxs)(n.p,{children:["To customize error handling, you'll want to use oclif's ",(0,o.jsx)(n.code,{children:"run"})," function instead of ",(0,o.jsx)(n.code,{children:"execute"}),":"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-javascript",children:"#!/usr/bin/env node\n\nimport {run, handle, flush} from '@oclif/core'\n\nawait run(process.argv.slice(2), import.meta.url)\n .catch(async (error) => handle(error))\n .finally(async () => flush())\n"})}),"\n",(0,o.jsxs)(n.p,{children:["The ",(0,o.jsx)(n.code,{children:"catch"})," handler can be swapped for any function that receives an error argument. If you chose to implement your own handler here, we still recommend you delegate finally to the ",(0,o.jsx)(n.code,{children:"handle"})," function for clean-up and exiting logic."]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",children:".catch((error) => {\n // do any extra work with error\n return handle(error);\n})\n"})})]})}function h(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>i});var o=r(6540);const t={},c=o.createContext(t);function s(e){const n=o.useContext(c);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:s(e.components),o.createElement(c.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/2486267b.c1b6895d.js b/assets/js/2486267b.c1b6895d.js
deleted file mode 100644
index 44f82f20..00000000
--- a/assets/js/2486267b.c1b6895d.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9e3],{7413:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>r,default:()=>p,frontMatter:()=>i,metadata:()=>c,toc:()=>d});var n=s(4848),o=s(8453);const i={title:"Spinner"},r=void 0,c={id:"spinner",title:"Spinner",description:"@oclif/core provides a simple ux.action, for more complex progress indicators we recommend using the listr library.",source:"@site/../docs/spinner.md",sourceDirName:".",slug:"/spinner",permalink:"/docs/spinner",draft:!1,unlisted:!1,editUrl:"https://github.com/oclif/oclif.github.io/tree/docs/docs/../docs/spinner.md",tags:[],version:"current",lastUpdatedBy:"Mike Donnalley",lastUpdatedAt:1711648030,formattedLastUpdatedAt:"Mar 28, 2024",frontMatter:{title:"Spinner"},sidebar:"docs",previous:{title:"Prompting",permalink:"/docs/prompting"},next:{title:"Table",permalink:"/docs/table"}},a={},d=[{value:"ux.action
",id:"uxaction",level:2},{value:"listr",id:"listr",level:2}];function l(e){const t={a:"a",code:"code",h2:"h2",img:"img",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.a,{href:"https://github.com/oclif/core",children:"@oclif/core"})," provides a simple ",(0,n.jsx)(t.code,{children:"ux.action"}),", for more complex progress indicators we recommend using the ",(0,n.jsx)(t.a,{href:"https://www.npmjs.com/package/listr",children:"listr"})," library."]}),"\n",(0,n.jsx)(t.h2,{id:"uxaction",children:(0,n.jsx)(t.code,{children:"ux.action"})}),"\n",(0,n.jsx)(t.p,{children:"Shows a basic spinner"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-typescript",children:"import {Command, ux} from '@oclif/core'\n\nexport class MyCommand extends Command {\n async run() {\n // start the spinner\n ux.action.start('starting a process')\n // do some action...\n // stop the spinner\n ux.action.stop() // shows 'starting a process... done'\n\n // show on stdout instead of stderr\n ux.action.start('starting a process', 'initializing', {stdout: true})\n // do some action...\n // stop the spinner with a custom message\n ux.action.stop('custom message') // shows 'starting a process... custom message'\n }\n}\n"})}),"\n",(0,n.jsx)(t.p,{children:"This degrades gracefully when not connected to a TTY. It queues up any writes to stdout/stderr so they are displayed above the spinner."}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.img,{alt:"action demo",src:s(262).A+"",width:"563",height:"271"})}),"\n",(0,n.jsx)(t.h2,{id:"listr",children:"listr"}),"\n",(0,n.jsxs)(t.p,{children:["Here is an example of the complex workflows supported by ",(0,n.jsx)(t.a,{href:"https://www.npmjs.com/package/listr",children:"listr"}),"."]}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.img,{alt:"listr demo",src:s(1146).A+"",width:"1177",height:"709"})})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(l,{...e})}):l(e)}},262:(e,t,s)=>{s.d(t,{A:()=>n});const n=s.p+"assets/images/action-3dc2f1c9da2526e7dacc7ba55a2e3f5a.gif"},1146:(e,t,s)=>{s.d(t,{A:()=>n});const n=s.p+"assets/images/listr-fb034a43c5d3159c331547ffba3b6559.gif"},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>c});var n=s(6540);const o={},i=n.createContext(o);function r(e){const t=n.useContext(i);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:r(e.components),n.createElement(i.Provider,{value:t},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/258a6413.0362cb75.js b/assets/js/258a6413.5b8fe345.js
similarity index 97%
rename from assets/js/258a6413.0362cb75.js
rename to assets/js/258a6413.5b8fe345.js
index 32f3b8b2..64e27716 100644
--- a/assets/js/258a6413.0362cb75.js
+++ b/assets/js/258a6413.5b8fe345.js
@@ -1 +1 @@
-"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3651],{5453:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>r,contentTitle:()=>c,default:()=>m,frontMatter:()=>i,metadata:()=>a,toc:()=>l});var o=n(4848),s=n(8453);const i={title:"Single Command CLI"},c=void 0,a={id:"single_command_cli",title:"Single Command CLI",description:"Sometimes you may want your CLI's executable to also be the only command, similar to many bash utilities like ls or cat.",source:"@site/../docs/single_command_cli.md",sourceDirName:".",slug:"/single_command_cli",permalink:"/docs/single_command_cli",draft:!1,unlisted:!1,editUrl:"https://github.com/oclif/oclif.github.io/tree/docs/docs/../docs/single_command_cli.md",tags:[],version:"current",lastUpdatedBy:"Mike Donnalley",lastUpdatedAt:1711648030,formattedLastUpdatedAt:"Mar 28, 2024",frontMatter:{title:"Single Command CLI"},sidebar:"docs",previous:{title:"Flag Inheritance",permalink:"/docs/flag_inheritance"},next:{title:"ESM",permalink:"/docs/esm"}},r={},l=[];function d(e){const t={a:"a",code:"code",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:["Sometimes you may want your CLI's executable to also be the only command, similar to many bash utilities like ",(0,o.jsx)(t.code,{children:"ls"})," or ",(0,o.jsx)(t.code,{children:"cat"}),"."]}),"\n",(0,o.jsxs)(t.p,{children:["To support this, you will need to put your command logic into ",(0,o.jsx)(t.code,{children:"src/index.ts"})," and add the following to the oclif section of your package.json:"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-json",children:'{\n "oclif": {\n "commands": {\n "strategy": "single",\n "target": "./dist/index.js"\n }\n }\n}\n'})}),"\n",(0,o.jsxs)(t.p,{children:["where ",(0,o.jsx)(t.code,{children:"./dist/index.js"})," is a file that exports a ",(0,o.jsx)(t.code,{children:"Command"})," class. See ",(0,o.jsx)(t.a,{href:"./command_discovery_strategies",children:"Command Discovery Strategies"})," for more details."]})]})}function m(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>a});var o=n(6540);const s={},i=o.createContext(s);function c(e){const t=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),o.createElement(i.Provider,{value:t},e.children)}}}]);
\ No newline at end of file
+"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3651],{5453:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>r,contentTitle:()=>c,default:()=>m,frontMatter:()=>i,metadata:()=>a,toc:()=>l});var o=n(4848),s=n(8453);const i={title:"Single Command CLI"},c=void 0,a={id:"single_command_cli",title:"Single Command CLI",description:"Sometimes you may want your CLI's executable to also be the only command, similar to many bash utilities like ls or cat.",source:"@site/../docs/single_command_cli.md",sourceDirName:".",slug:"/single_command_cli",permalink:"/docs/single_command_cli",draft:!1,unlisted:!1,editUrl:"https://github.com/oclif/oclif.github.io/tree/docs/docs/../docs/single_command_cli.md",tags:[],version:"current",lastUpdatedBy:"Mike Donnalley",lastUpdatedAt:1711652444,formattedLastUpdatedAt:"Mar 28, 2024",frontMatter:{title:"Single Command CLI"},sidebar:"docs",previous:{title:"Flag Inheritance",permalink:"/docs/flag_inheritance"},next:{title:"ESM",permalink:"/docs/esm"}},r={},l=[];function d(e){const t={a:"a",code:"code",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:["Sometimes you may want your CLI's executable to also be the only command, similar to many bash utilities like ",(0,o.jsx)(t.code,{children:"ls"})," or ",(0,o.jsx)(t.code,{children:"cat"}),"."]}),"\n",(0,o.jsxs)(t.p,{children:["To support this, you will need to put your command logic into ",(0,o.jsx)(t.code,{children:"src/index.ts"})," and add the following to the oclif section of your package.json:"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-json",children:'{\n "oclif": {\n "commands": {\n "strategy": "single",\n "target": "./dist/index.js"\n }\n }\n}\n'})}),"\n",(0,o.jsxs)(t.p,{children:["where ",(0,o.jsx)(t.code,{children:"./dist/index.js"})," is a file that exports a ",(0,o.jsx)(t.code,{children:"Command"})," class. See ",(0,o.jsx)(t.a,{href:"./command_discovery_strategies",children:"Command Discovery Strategies"})," for more details."]})]})}function m(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>a});var o=n(6540);const s={},i=o.createContext(s);function c(e){const t=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),o.createElement(i.Provider,{value:t},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/2a33acc4.53e519de.js b/assets/js/2a33acc4.bf786006.js
similarity index 97%
rename from assets/js/2a33acc4.53e519de.js
rename to assets/js/2a33acc4.bf786006.js
index dbe32070..34d8ae91 100644
--- a/assets/js/2a33acc4.53e519de.js
+++ b/assets/js/2a33acc4.bf786006.js
@@ -1 +1 @@
-"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1427],{2130:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>l,frontMatter:()=>n,metadata:()=>r,toc:()=>d});var o=s(4848),i=s(8453);const n={title:"Topics"},c=void 0,r={id:"topics",title:"Topics",description:"As CLIs grow it can be useful to nest commands within topics. This is supported simply by placing command files in subdirectories. For example, with the Salesforce CLI we have a topic sf config with commands like sf config set and sf config get. The directory structure looks like this:",source:"@site/../docs/topics.md",sourceDirName:".",slug:"/topics",permalink:"/docs/topics",draft:!1,unlisted:!1,editUrl:"https://github.com/oclif/oclif.github.io/tree/docs/docs/../docs/topics.md",tags:[],version:"current",lastUpdatedBy:"Mike Donnalley",lastUpdatedAt:1711648030,formattedLastUpdatedAt:"Mar 28, 2024",frontMatter:{title:"Topics"},sidebar:"docs",previous:{title:"Command Discovery Strategies",permalink:"/docs/command_discovery_strategies"},next:{title:"Topic Separators",permalink:"/docs/topic_separator"}},a={},d=[];function p(e){const t={code:"code",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:["As CLIs grow it can be useful to nest commands within topics. This is supported simply by placing command files in subdirectories. For example, with the Salesforce CLI we have a topic ",(0,o.jsx)(t.code,{children:"sf config"})," with commands like ",(0,o.jsx)(t.code,{children:"sf config set"})," and ",(0,o.jsx)(t.code,{children:"sf config get"}),". The directory structure looks like this:"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{children:"package.json\nsrc/\n\u2514\u2500\u2500 commands/\n \u2514\u2500\u2500 config/\n \xa0 \u251c\u2500\u2500 index.ts\n \xa0\xa0\u251c\u2500\u2500 set.ts\n \xa0\xa0 \u2514\u2500\u2500 get.ts\n"})}),"\n",(0,o.jsxs)(t.p,{children:["The help descriptions will be the description of the first command within a directory. If you'd like to customize the help description, add it to the ",(0,o.jsx)(t.code,{children:"package.json"})," like so:"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-js",children:'{\n "oclif": {\n "topics": {\n "apps:favorites": { "description": "manage favorite apps" },\n "config": { "description": "manage heroku config variables" },\n }\n }\n}\n'})}),"\n",(0,o.jsx)(t.p,{children:"Subtopics can be created by making subdirectories within topic directories, but for UX reasons we generally discourage going more than 1 or 2 levels deep even for the largest CLIs."})]})}function l(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>c,x:()=>r});var o=s(6540);const i={},n=o.createContext(i);function c(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function r(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:c(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]);
\ No newline at end of file
+"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1427],{2130:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>l,frontMatter:()=>n,metadata:()=>r,toc:()=>d});var o=s(4848),i=s(8453);const n={title:"Topics"},c=void 0,r={id:"topics",title:"Topics",description:"As CLIs grow it can be useful to nest commands within topics. This is supported simply by placing command files in subdirectories. For example, with the Salesforce CLI we have a topic sf config with commands like sf config set and sf config get. The directory structure looks like this:",source:"@site/../docs/topics.md",sourceDirName:".",slug:"/topics",permalink:"/docs/topics",draft:!1,unlisted:!1,editUrl:"https://github.com/oclif/oclif.github.io/tree/docs/docs/../docs/topics.md",tags:[],version:"current",lastUpdatedBy:"Mike Donnalley",lastUpdatedAt:1711652444,formattedLastUpdatedAt:"Mar 28, 2024",frontMatter:{title:"Topics"},sidebar:"docs",previous:{title:"Command Discovery Strategies",permalink:"/docs/command_discovery_strategies"},next:{title:"Topic Separators",permalink:"/docs/topic_separator"}},a={},d=[];function p(e){const t={code:"code",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:["As CLIs grow it can be useful to nest commands within topics. This is supported simply by placing command files in subdirectories. For example, with the Salesforce CLI we have a topic ",(0,o.jsx)(t.code,{children:"sf config"})," with commands like ",(0,o.jsx)(t.code,{children:"sf config set"})," and ",(0,o.jsx)(t.code,{children:"sf config get"}),". The directory structure looks like this:"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{children:"package.json\nsrc/\n\u2514\u2500\u2500 commands/\n \u2514\u2500\u2500 config/\n \xa0 \u251c\u2500\u2500 index.ts\n \xa0\xa0\u251c\u2500\u2500 set.ts\n \xa0\xa0 \u2514\u2500\u2500 get.ts\n"})}),"\n",(0,o.jsxs)(t.p,{children:["The help descriptions will be the description of the first command within a directory. If you'd like to customize the help description, add it to the ",(0,o.jsx)(t.code,{children:"package.json"})," like so:"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-js",children:'{\n "oclif": {\n "topics": {\n "apps:favorites": { "description": "manage favorite apps" },\n "config": { "description": "manage heroku config variables" },\n }\n }\n}\n'})}),"\n",(0,o.jsx)(t.p,{children:"Subtopics can be created by making subdirectories within topic directories, but for UX reasons we generally discourage going more than 1 or 2 levels deep even for the largest CLIs."})]})}function l(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>c,x:()=>r});var o=s(6540);const i={},n=o.createContext(i);function c(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function r(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:c(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/2f98ad87.86268d63.js b/assets/js/2f98ad87.d123afc9.js
similarity index 99%
rename from assets/js/2f98ad87.86268d63.js
rename to assets/js/2f98ad87.d123afc9.js
index 4709785d..06530404 100644
--- a/assets/js/2f98ad87.86268d63.js
+++ b/assets/js/2f98ad87.d123afc9.js
@@ -1 +1 @@
-"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8664],{2678:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>i,contentTitle:()=>c,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>s});var r=o(4848),t=o(8453);const a={title:"Generator Commands"},c=void 0,l={id:"generator_commands",title:"Generator Commands",description:"- oclif generate NAME",source:"@site/../docs/generator_commands.md",sourceDirName:".",slug:"/generator_commands",permalink:"/docs/generator_commands",draft:!1,unlisted:!1,editUrl:"https://github.com/oclif/oclif.github.io/tree/docs/docs/../docs/generator_commands.md",tags:[],version:"current",lastUpdatedBy:"Mike Donnalley",lastUpdatedAt:1711648030,formattedLastUpdatedAt:"Mar 28, 2024",frontMatter:{title:"Generator Commands"},sidebar:"docs",previous:{title:"FAQs",permalink:"/docs/faqs"},next:{title:"Templates",permalink:"/docs/templates"}},i={},s=[{value:"oclif generate NAME
",id:"oclif-generate-name",level:2},{value:"oclif generate command NAME
",id:"oclif-generate-command-name",level:2},{value:"oclif generate hook NAME
",id:"oclif-generate-hook-name",level:2}];function d(e){const n={a:"a",code:"code",em:"em",h2:"h2",li:"li",p:"p",pre:"pre",ul:"ul",...(0,t.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#oclif-generate-name",children:(0,r.jsx)(n.code,{children:"oclif generate NAME"})})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#oclif-generate-command-name",children:(0,r.jsx)(n.code,{children:"oclif generate command NAME"})})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#oclif-generate-hook-name",children:(0,r.jsx)(n.code,{children:"oclif generate hook NAME"})})}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"oclif-generate-name",children:(0,r.jsx)(n.code,{children:"oclif generate NAME"})}),"\n",(0,r.jsx)(n.p,{children:"Generate a new CLI"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"USAGE\n $ oclif generate NAME [-y] [--author