Browse Source

Jump to first object mention in object mode

Alois Mahdal 5 years ago
parent
commit
0bec8ed937
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      src/bin/sfdoc

+ 7
- 2
src/bin/sfdoc View File

@@ -93,6 +93,7 @@ main() {
93 93
     local RealModuleName    # name to override eg. if accessing via filename
94 94
     local encoding          # encoding
95 95
     local mpath             # path to module file
96
+    local jump              # jump to first occurence of this
96 97
     action=man
97 98
     format=markdown
98 99
     encoding=utf8
@@ -125,7 +126,9 @@ main() {
125 126
     esac
126 127
     case $spectype in
127 128
         obj) module=$(find_by "$mspec") \
128
-              || die "no module found with: $mspec" ;;
129
+              || die "no module found with: $mspec"
130
+             jump="$mspec"
131
+             ;;
129 132
         *)   module=$mspec ;;
130 133
     esac
131 134
     case $action in
@@ -164,7 +167,9 @@ main() {
164 167
              || die "pod2man is missing; cannot use man page mode"
165 168
             manfile=$(mktemp -t "sfdoc.manfile.XXXXXXXX")
166 169
             sfdoc__export manpage "${RealModuleName:-$module}" "$mpath" "$encoding" >"$manfile"
167
-            man "$manfile"
170
+            manless="$LESS"
171
+            test -n "$jump" && manless+=" +/$jump"
172
+            LESS="$manless" man "$manfile"
168 173
             rm "$manfile"
169 174
             ;;
170 175
         src)