Skip to content

Commit

Permalink
fixed subcommands help
Browse files Browse the repository at this point in the history
  • Loading branch information
rafapaezbas committed Feb 17, 2025
1 parent e364545 commit b00cf56
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions cmd/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
const { header, footer, command, flag, arg, summary, description, bail, sloppy } = require('paparam')
const { header, footer, command, flag, arg, summary, description, bail, sloppy, rest } = require('paparam')
const { usage, print } = require('./iface')
const { CHECKOUT } = require('../constants')
const errors = require('../errors')
Expand Down Expand Up @@ -199,30 +199,17 @@ module.exports = async (ipc, argv = Bare.argv.slice(1)) => {
() => { console.log(data.help()) }
)

const help = command('help', arg('[command]'), summary('View help for command'), (h) => {
if (h.args.command) console.log(cmd.help(h.args.command))
const help = command('help', rest('[command]'), summary('View help for command'), (h) => {
if (h.rest) console.log(cmd.help(...h.rest))
else console.log(cmd.overview({ full: true }))
})

const commands = { init, dev, stage, seed, run, release, info, dump, touch, shift, reset, sidecar, gc, versions, data, help }

const cmd = command('pear',
...def.pear,
...Object.values(commands),
header(usage.header),
init,
dev,
stage,
seed,
run,
release,
info,
dump,
touch,
shift,
reset,
sidecar,
gc,
versions,
data,
help,
footer(usage.footer),
bail(explain),
pear
Expand Down

0 comments on commit b00cf56

Please sign in to comment.