mirror of
https://github.com/ivabus/pantry
synced 2025-06-08 08:20:32 +03:00
+portable auto(conf|make) (#129)
This commit is contained in:
parent
8f45e8da16
commit
0459c70fc9
1 changed files with 10 additions and 10 deletions
|
@ -47,18 +47,18 @@ for (const path of Deno.args) {
|
|||
const [line0, ...lines] = txt.split("\n") //lol
|
||||
|
||||
const match = line0.match(/^#!\s*(\/[^\s]+)/)
|
||||
if (match) {
|
||||
switch (match[1]) {
|
||||
case "/usr/bin/env":
|
||||
case "/bin/sh":
|
||||
console.verbose({ line0, path })
|
||||
console.verbose("^^ skipped acceptable shebang")
|
||||
continue
|
||||
}
|
||||
if (!match) throw new Error()
|
||||
const interpreter = match[1]
|
||||
|
||||
switch (interpreter) {
|
||||
case "/usr/bin/env":
|
||||
case "/bin/sh":
|
||||
console.verbose({ line0, path })
|
||||
console.verbose("^^ skipped acceptable shebang")
|
||||
continue
|
||||
}
|
||||
|
||||
const interpreter = new Path(line0.slice(2)).basename()
|
||||
const shebang = `#!/usr/bin/env ${interpreter}`
|
||||
const shebang = `#!/usr/bin/env ${new Path(interpreter).basename()}`
|
||||
|
||||
const rewrite = undent`
|
||||
${shebang}
|
||||
|
|
Loading…
Reference in a new issue