-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathquilt.sh
29 lines (29 loc) · 929 Bytes
/
quilt.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
_patch_help() {
if [[ $# -eq 1 ]]; then
_patch_help_run_man $@ | sed '/^\s*Quilt commands reference/ c\Commands'
else
_patch_help_run_man $1 | \
gawk -v SUBCMD=$2 '{
if (match($0, /^\s*Quilt commands reference/)) {
commondZone = 1
} else if (match($0, /^[A-Z]/)) {
commondZone = 0
subcmdZone = 0
}
if (commondZone) {
if (match($0, /^ \S/)) {
if (match($0, "^ " SUBCMD "( |$)")) {
subcmdZone = 1
$0 = "Usage: " gensub(/^\s*/, "", 1, $0)
} else {
subcmdZone = 0
}
}
}
if (subcmdZone) {
print gensub(/^ {6}/, "", 1, $0)
}
}' | \
sed '/^\s*-p n/,+2 d'
fi
}