mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 17:54:23 +01:00
fix: bash permission case
This commit is contained in:
@@ -115,22 +115,10 @@ export const BashTool = Tool.define("bash", {
|
|||||||
}
|
}
|
||||||
if (action === "ask") {
|
if (action === "ask") {
|
||||||
const pattern = (() => {
|
const pattern = (() => {
|
||||||
let head = ""
|
if (command.length === 0) return
|
||||||
let sub: string | undefined
|
const head = command[0]
|
||||||
for (let i = 0; i < node.childCount; i++) {
|
// Find first non-flag argument as subcommand
|
||||||
const child = node.child(i)
|
const sub = command.slice(1).find((arg) => !arg.startsWith("-"))
|
||||||
if (!child) continue
|
|
||||||
if (child.type === "command_name") {
|
|
||||||
if (!head) {
|
|
||||||
head = child.text
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if (!sub && child.type === "word") {
|
|
||||||
if (!child.text.startsWith("-")) sub = child.text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!head) return
|
|
||||||
return sub ? `${head} ${sub} *` : `${head} *`
|
return sub ? `${head} ${sub} *` : `${head} *`
|
||||||
})()
|
})()
|
||||||
if (pattern) {
|
if (pattern) {
|
||||||
|
|||||||
Reference in New Issue
Block a user