forked from defunkt/toes
Disable shell, get, and open commands for SSH sessions
These commands require local access and cannot function when connected over SSH (USER=cli). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a9f8a3885d
commit
0abf03e64e
|
|
@ -234,4 +234,20 @@ program
|
||||||
await shell()
|
await shell()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Hide and disable commands that don't work over SSH
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export { program }
|
export { program }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user