mirror of
https://github.com/sst/opencode.git
synced 2025-09-01 18:57:24 +00:00
Add stdin support to run command
Allow piping content to opencode run when no message arguments are provided, enabling standard Unix pipe patterns for better CLI integration. 🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode <noreply@opencode.ai>
This commit is contained in:
parent
9253a3ca9e
commit
c51de945a5
1 changed files with 8 additions and 1 deletions
|
@ -54,7 +54,14 @@ export const RunCommand = cmd({
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handler: async (args) => {
|
handler: async (args) => {
|
||||||
const message = args.message.join(" ")
|
let message = args.message.join(" ")
|
||||||
|
|
||||||
|
// Read from stdin if no message provided and stdin is available
|
||||||
|
if (!message && !process.stdin.isTTY) {
|
||||||
|
message = await Bun.stdin.text()
|
||||||
|
message = message.trim()
|
||||||
|
}
|
||||||
|
|
||||||
await bootstrap({ cwd: process.cwd() }, async () => {
|
await bootstrap({ cwd: process.cwd() }, async () => {
|
||||||
const session = await (async () => {
|
const session = await (async () => {
|
||||||
if (args.continue) {
|
if (args.continue) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue