forked from defunkt/toes
The deploy script now builds the CLI binary and copies it to /usr/local/bin. SSH passes commands as `toes -c "command args"`, so parse that form before falling through to the interactive shell or normal arg handling.
20 lines
573 B
TypeScript
Executable File
20 lines
573 B
TypeScript
Executable File
#!/usr/bin/env bun
|
|
import { program } from './setup'
|
|
|
|
const isCliUser = process.env.USER === 'cli'
|
|
const noArgs = process.argv.length <= 2
|
|
const isTTY = !!process.stdin.isTTY
|
|
|
|
// SSH login shell passes commands as: toes -c "command args"
|
|
const shellExec = process.argv[1] === '-c' ? process.argv.slice(2).join(' ') : null
|
|
|
|
if (shellExec) {
|
|
const tokens = shellExec.split(/\s+/).filter(Boolean)
|
|
program.parse(['node', 'toes', ...tokens])
|
|
} else if (isCliUser && noArgs && isTTY) {
|
|
const { shell } = await import('./shell')
|
|
await shell()
|
|
} else {
|
|
program.parse()
|
|
}
|