mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-29 12:45:20 +02:00
dsv/dsv: allow -p and -u to be used together
In this case, first the path and then the URL is printed. Before, you'd either get and error or one of the options would be ignored.
This commit is contained in:
parent
676c6a2715
commit
bbb6513b42
44
dsv/dsv
44
dsv/dsv
@ -30,7 +30,7 @@ DSV_DIR=.dsv
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "usage: $0 [-p|-u] <component>" 2>&1
|
||||
echo "usage: $0 [-p] [-u] <component>" 2>&1
|
||||
echo " $0 help" 2>&1
|
||||
echo " $0 [ls]" 2>&1
|
||||
echo " $0 setup <info-file> ..." 2>&1
|
||||
@ -158,17 +158,6 @@ search()
|
||||
if [ -d $DSV_DIR ]; then
|
||||
name=`echo "$1" | sed 's/%/%25/g;s|/|%2F|g'`
|
||||
if [ -r "$DSV_DIR/dsv-$name" ]; then
|
||||
if $show_url; then
|
||||
url=`sed 1d "$DSV_DIR/dsv-$name"`
|
||||
if [ "$url" ]; then
|
||||
echo "$url"
|
||||
exit
|
||||
else
|
||||
echo "$DSV_DIR/dsv-$name" \
|
||||
"does not contain an URL - please regenerate" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
file=`sed 1q "$DSV_DIR/dsv-$name"`
|
||||
if [ ! -r "$DSV_DIR/$file" ]; then
|
||||
echo "$1 -> $file: does not exist" 2>&1
|
||||
@ -176,9 +165,19 @@ search()
|
||||
fi
|
||||
if $path; then
|
||||
echo "`pwd`/$DSV_DIR/$file"
|
||||
else
|
||||
elif ! $show_url; then
|
||||
${DSV_VIEWER:-${DSV_PDFVIEWER:-xdg-open}} "$DSV_DIR/$file"
|
||||
fi
|
||||
if $show_url; then
|
||||
url=`sed 1d "$DSV_DIR/dsv-$name"`
|
||||
if [ "$url" ]; then
|
||||
echo "$url"
|
||||
else
|
||||
echo "$DSV_DIR/dsv-$name" \
|
||||
"does not contain an URL - please regenerate" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
@ -192,14 +191,17 @@ search()
|
||||
|
||||
path=false
|
||||
show_url=false
|
||||
if [ "$1" = -p ]; then
|
||||
path=true
|
||||
shift
|
||||
fi
|
||||
if [ "$1" = -u ]; then
|
||||
show_url=true
|
||||
shift
|
||||
fi
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
-p) path=true
|
||||
shift;;
|
||||
-u) show_url=true
|
||||
shift;;
|
||||
-*) usage;;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "$1" in
|
||||
help|-*) usage;;
|
||||
|
Loading…
Reference in New Issue
Block a user