@darkrymit/crunes-cli 0.14.0 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -212,7 +212,7 @@ async function createScriptRune({ key, lang, runeRelPath, name, description, con
212
212
  output.info(`Run: crunes run ${key}`);
213
213
  }
214
214
  function template(key, format) {
215
- const imports = format === "tree" ? `import { md, section, tree } from '@utils'` : `import { md, section } from '@utils'`;
215
+ const imports = format === "tree" ? `import { md, rune, section, tree } from '@utils'` : `import { md, rune, section } from '@utils'`;
216
216
  const header = [
217
217
  `// permissions:`,
218
218
  `// run:`,
@@ -221,17 +221,19 @@ function template(key, format) {
221
221
  ``,
222
222
  imports,
223
223
  ``,
224
- `// export async function args(b) {`,
225
- `// return b`,
226
- `// .option('-v, --verbose', 'Verbose output', false)`,
227
- `// .build()`,
228
- `// }`,
224
+ `export async function args(b) {`,
225
+ ` return b`,
226
+ ` .option('-h, --help', 'Show help')`,
227
+ ` .option('-v, --verbose', 'Verbose output', false)`,
228
+ `}`,
229
229
  ``,
230
230
  `export async function run(args) {`,
231
+ ` const stop = rune.guard(args)`,
232
+ ` if (stop) return stop`,
233
+ ``,
231
234
  ` // args._ \u2014 data positionals (command tokens stripped)`,
232
235
  ` // args.$rest \u2014 unmapped positional arguments`,
233
- ` // args.verbose \u2014 named flag (if args export is defined above)`,
234
- ` // utils.fs.cwd() \u2014 absolute path to the project root`
236
+ ` // args.verbose \u2014 named flag (defined in args() above)`
235
237
  ].join("\n");
236
238
  if (format === "tree") {
237
239
  return header + "\n" + [