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