mawk/shebang
This commit is contained in:
parent
596126bb85
commit
8beb437ce0
1 changed files with 5 additions and 2 deletions
|
@ -28,6 +28,9 @@ function extract(string, type) {
|
||||||
} else if (type == "module") {
|
} else if (type == "module") {
|
||||||
split(string, array, "#\\.")
|
split(string, array, "#\\.")
|
||||||
return trim(array[2])
|
return trim(array[2])
|
||||||
|
} else if (type == "shebang") {
|
||||||
|
split(string, array, "#!")
|
||||||
|
return trim(array[2])
|
||||||
} else if ((type == "constant") || (type == "variable")) {
|
} else if ((type == "constant") || (type == "variable")) {
|
||||||
split(string, array, "=")
|
split(string, array, "=")
|
||||||
return trim(array[1])
|
return trim(array[1])
|
||||||
|
@ -152,8 +155,8 @@ BEGIN {
|
||||||
}
|
}
|
||||||
} else if (action == "doc") {
|
} else if (action == "doc") {
|
||||||
# doc
|
# doc
|
||||||
if (match($0, RE_SHEBANG, m)) {
|
if (match($0, RE_SHEBANG)) {
|
||||||
append("! " m[1])
|
append("! " extract($0, "shebang"))
|
||||||
} else if (match($0, RE_DOC, m)) {
|
} else if (match($0, RE_DOC, m)) {
|
||||||
if (f) {
|
if (f) {
|
||||||
append($0)
|
append($0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue