forked from defunkt/toes
Reduce nesting in SSH-disabled command setup with early continue
This commit is contained in:
parent
0abf03e64e
commit
35a9053308
|
|
@ -239,14 +239,13 @@ if (process.env.USER === 'cli') {
|
|||
const disabled = ['shell', 'get', 'open']
|
||||
for (const name of disabled) {
|
||||
const cmd = program.commands.find((c) => c.name() === name)
|
||||
if (cmd) {
|
||||
cmd.helpInformation = () => ''
|
||||
;(cmd as any)._hidden = true
|
||||
cmd.action(() => {
|
||||
console.error(`"${name}" is not available over SSH`)
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
||||
if (!cmd) continue
|
||||
cmd.helpInformation = () => ''
|
||||
;(cmd as any)._hidden = true
|
||||
cmd.action(() => {
|
||||
console.error(`"${name}" is not available over SSH`)
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user