sphinx/btest-rst-include
raw| 1 | #! /usr/bin/env bash |
| 2 | |
| 3 | base=$(dirname "$0") |
| 4 | |
| 5 | function usage() { |
| 6 | echo "usage: $(basename "$0") [-n <max-lines>] <file>" |
| 7 | exit 1 |
| 8 | } |
| 9 | |
| 10 | lines="" |
| 11 | |
| 12 | while getopts "n:" opt; do |
| 13 | case $opt in |
| 14 | n) lines=$OPTARG ;; |
| 15 | *) usage ;; |
| 16 | esac |
| 17 | done |
| 18 | |
| 19 | shift $((OPTIND - 1)) |
| 20 | |
| 21 | if [ "$1" = "" ]; then |
| 22 | usage |
| 23 | fi |
| 24 | |
| 25 | if [ "$lines" != "" ]; then |
| 26 | lines="-n $lines" |
| 27 | fi |
| 28 | |
| 29 | "$base/btest-rst-cmd" "$lines" -o cat "$1" |