awk/↕
This commit is contained in:
parent
2183d22f4e
commit
c70ce687bc
1 changed files with 34 additions and 34 deletions
|
@ -112,41 +112,8 @@ function parse(string) {
|
|||
|
||||
# FIXME handle no action
|
||||
|
||||
# tasks
|
||||
if (action == "tasks") {
|
||||
line++
|
||||
if (match($0, RE_MODULE)) {
|
||||
line = 1
|
||||
if (output_tasks) {
|
||||
print ""
|
||||
print output_module
|
||||
print output_tasks
|
||||
output_tasks = ""
|
||||
}
|
||||
doc = ""
|
||||
match_task = 0
|
||||
output_module = ". " extract($0, "module")
|
||||
} else if (match($0, RE_TASK)) {
|
||||
if (target) {
|
||||
if (target == extract($0, "task")) {
|
||||
match_task = 1
|
||||
}
|
||||
} else {
|
||||
match_task = 1
|
||||
}
|
||||
append(line ": " $0)
|
||||
} else if (match($0, RE_COMMENT)) {
|
||||
append(line ": " $0)
|
||||
} else {
|
||||
if (match_task) {
|
||||
output_tasks = output_tasks "\n" doc
|
||||
}
|
||||
doc = ""
|
||||
match_task = 0
|
||||
}
|
||||
|
||||
# doc
|
||||
} else if (action == "doc") {
|
||||
if (action == "doc") {
|
||||
# doc
|
||||
if (match($0, RE_SHEBANG)) {
|
||||
append("! " extract($0, "shebang"))
|
||||
|
@ -212,6 +179,39 @@ if (action == "tasks") {
|
|||
}
|
||||
}
|
||||
|
||||
# tasks
|
||||
} else if (action == "tasks") {
|
||||
line++
|
||||
if (match($0, RE_MODULE)) {
|
||||
line = 1
|
||||
if (output_tasks) {
|
||||
print ""
|
||||
print output_module
|
||||
print output_tasks
|
||||
output_tasks = ""
|
||||
}
|
||||
doc = ""
|
||||
match_task = 0
|
||||
output_module = ". " extract($0, "module")
|
||||
} else if (match($0, RE_TASK)) {
|
||||
if (target) {
|
||||
if (target == extract($0, "task")) {
|
||||
match_task = 1
|
||||
}
|
||||
} else {
|
||||
match_task = 1
|
||||
}
|
||||
append(line ": " $0)
|
||||
} else if (match($0, RE_COMMENT)) {
|
||||
append(line ": " $0)
|
||||
} else {
|
||||
if (match_task) {
|
||||
output_tasks = output_tasks "\n" doc
|
||||
}
|
||||
doc = ""
|
||||
match_task = 0
|
||||
}
|
||||
|
||||
# function
|
||||
} else if (action == "function") {
|
||||
if (match($0, re["command"])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue