#!/bin/sh # AtomicParsley wrapper for use with help2man basename="$(basename "$0")" basedir="$(dirname "$0")" case "$1" in --help) "$basedir/../$basename" --longhelp | sed -e 's/^[-]*$/\n/' -e 's/Usage: /\nUsage:\n/' ;; --version) grep '^#define AP_VER' "$basedir/../src/config.h" | awk -F\" '{print $2}' ;; --description) echo "read, parse and set metadata of MPEG-4 and 3gp files" ;; --test) help2man "./$basename" \ | perl -0 -p \ -e 's/^\.PP\noptions:\n\.PP$/.SH OPTIONS/m; # fix marking options as a headline' \ -e 's/^(\\fB\\-\\-.*?)=\\fR([^ ]*)/$1\\fR=\\fI$2\\fR/mg; # fix option value hilite' \ -e 's/^(\w)$/.B $1/mg; # fix mode flags hilite' \ -e 's/^(\.TP\n\.B.*\n[^\.].*\n)\.IP(\n\(.*)\n\.PP$/$1.RS$2/mg; # keep option lines together' # -e 's/^\\fB\\-\\-(.*?)\\fR([^ ]*) +/.TP\n.B \\--$1$2\n/mg; # improve option listing' \ ;; *) echo 1>&2 "ERROR: unknown argument \"$1\"" exit 1 ;; esac