Revision: 12589 http://sourceforge.net/p/skim-app/code/12589 Author: hofman Date: 2021-11-30 15:35:39 +0000 (Tue, 30 Nov 2021) Log Message: ----------- Add optional argument -z to displayline script to interpret line number aas zero-based
Modified Paths: -------------- trunk/displayline Modified: trunk/displayline =================================================================== --- trunk/displayline 2021-11-30 10:30:28 UTC (rev 12588) +++ trunk/displayline 2021-11-30 15:35:39 UTC (rev 12589) @@ -2,14 +2,15 @@ # displayline (Skim) # -# Usage: displayline [-r] [-b] [-g] LINE PDFFILE [TEXSOURCEFILE] +# Usage: displayline [-r] [-b] [-g] [-z] LINE PDFFILE [TEXSOURCEFILE] if [[ $# -eq 0 || "$1" == "-h" || "$1" == "-help" ]]; then - echo "Usage: displayline [-r] [-b] [-g] LINE PDFFILE [TEXSOURCEFILE] + echo "Usage: displayline [-r] [-b] [-g] [-z] LINE PDFFILE [TEXSOURCEFILE] Options: -r, -revert Revert the file from disk if it was open -b, -readingbar Indicate the line using the reading bar --g, -background Do not bring Skim to the foreground" +-g, -background Do not bring Skim to the foreground +-z, -zerobased LINE is zero-based rather than one-based" exit 0 fi @@ -17,6 +18,7 @@ revert=false bar=false activate=true +zerobased= while [[ "${1:0:1}" == "-" ]]; do if [[ "$1" == "-r" || "$1" == "-revert" ]]; then revert=true @@ -24,6 +26,8 @@ bar=true elif [[ "$1" == "-g" || "$1" == "-background" ]]; then activate=false + elif [[ "$1" == "-z" || "$1" == "-zerobased" ]]; then + zerobased=1 fi shift done @@ -36,6 +40,8 @@ [[ "${file:0:1}" == "/" ]] || file="${PWD}/${file}" [[ "${src}" == "" || "${src:0:1}" == "/" ]] || src="${PWD}/${src}" +[[ -z $zerobased ]] || (( line+=1 )) + # run AppleScript /usr/bin/osascript << EOF set theLine to $line as integer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit