File: special/bbc-provided/files/help
base-0 patch-1
Line 1Line 0
#!/bin/sh

help_location=/share/doc/README

# if help_location is /share/doc/README, this script expects text files called
# /share/doc/README.foo, /share/doc/README.bar, etc. Each one should be a text
# file and should have a brief description of its contents on its first line.

if [ "$1" ]
then
        [ -f "$help_location.$1" ] && exec dialog --textbox $help_location.$1 0 0
        echo 'Type "help" for a list of available help topics."'
        exit 1
fi

# choice is good
choice=good

while [ $choice ]
do

choice=$((for i in $help_location*
do
echo -n -e $(echo -n $i | cut -d. -f2-)'\t'
head -1 $i
done
) | sed 's/ /\\ /g' | xargs dialog --menu 'Help is available on the following topics:' 0 0 0 2>&1 >/dev/tty)

[ $choice ] && dialog --textbox $help_location.$choice 0 0
done