error handling and help added
This commit is contained in:
parent
d0db372c83
commit
76401afece
|
@ -5,12 +5,21 @@ localPuzzleDir="$HOME/.puzzles"
|
||||||
systemPuzzleDir="/var/puzzles"
|
systemPuzzleDir="/var/puzzles"
|
||||||
|
|
||||||
if [ -n "$puzChoice" ]; then
|
if [ -n "$puzChoice" ]; then
|
||||||
puzChoiceFile="${localPuzzleDir}/${puzChoice}.puz"
|
if [ "$puzChoice" = "-h" ]; then
|
||||||
if [ ! -f "$puzChoiceFile" ]; then
|
printf "Run program without arguments for list of puzzles. Add puzzle name as argument to start puzzle.\\n"
|
||||||
mkdir -p "$localPuzzleDir"
|
else
|
||||||
cp "${systemPuzzleDir}/${puzChoice}.puz" "$puzChoiceFile"
|
sysPuzChoiceFile="${systemPuzzleDir}/${puzChoice}.puz"
|
||||||
|
localPuzChoiceFile="${localPuzzleDir}/${puzChoice}.puz"
|
||||||
|
if [ -f "$sysPuzChoiceFile" ]; then
|
||||||
|
if [ ! -f "$localPuzChoiceFile" ]; then
|
||||||
|
mkdir -p "$localPuzzleDir"
|
||||||
|
cp "$sysPuzChoiceFile" "$localPuzChoiceFile"
|
||||||
|
fi
|
||||||
|
cursewords "$localPuzChoiceFile"
|
||||||
|
else
|
||||||
|
printf "puzzle not found.\\n"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
cursewords "$puzChoiceFile"
|
|
||||||
else
|
else
|
||||||
for f in "${systemPuzzleDir}"/*.puz; do
|
for f in "${systemPuzzleDir}"/*.puz; do
|
||||||
puzzleFilename=$(basename "$f")
|
puzzleFilename=$(basename "$f")
|
||||||
|
|
Loading…
Reference in New Issue