1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-10-02 18:50:43 +03:00

dsv/dsv: change indentation to tab instead of 4 spaces; fix typo

This commit is contained in:
Werner Almesberger 2014-03-07 08:34:15 -03:00
parent 7067c00a90
commit 8c5d7d7bcd

23
dsv/dsv
View File

@ -109,8 +109,7 @@ set_value()
A:|a:) alias="$alias \"$value\"";; A:|a:) alias="$alias \"$value\"";;
D:|d:) url=$value;; D:|d:) url=$value;;
Z:|z:) zip=$value;; Z:|z:) zip=$value;;
"") "") ;; # first iteration
;; # first iteration
*) echo "unrecognized tag \"$tag\"" 2>&1 *) echo "unrecognized tag \"$tag\"" 2>&1
exit 1;; exit 1;;
esac esac
@ -139,8 +138,10 @@ setup()
cat -E "$n" | sed 's/[^$]$/&\n/;s/$$//' | { cat -E "$n" | sed 's/[^$]$/&\n/;s/$$//' | {
while read line; do while read line; do
[ "$line" = "${line###}" ] || continue [ "$line" = "${line###}" ] || continue
tmp=`echo "$line" | awk '/^[^\t ]/ { print $1 }'` tmp=`echo "$line" |
tail=`echo "$line" | sed 's/^[^\t ]*[\t ]*//;s/[\t ]*$//'` awk '/^[^\t ]/ { print $1 }'`
tail=`echo "$line" |
sed 's/^[^\t ]*[\t ]*//;s/[\t ]*$//'`
if [ -z "$tmp" ]; then if [ -z "$tmp" ]; then
[ -z "$tail" ] || value="$value $tail" [ -z "$tail" ] || value="$value $tail"
else else
@ -160,13 +161,20 @@ list()
{ {
while true; do while true; do
if [ -d $DSV_DIR ]; then if [ -d $DSV_DIR ]; then
ls -b -1 $DSV_DIR | sed 's/^dsv-//p;d' | sed 's|%2F|/|g;s/%25/%/g' ls -b -1 $DSV_DIR | sed 's/^dsv-//p;d' |
sed 's|%2F|/|g;s/%25/%/g'
fi fi
up || break up || break
done | sort | uniq | column done | sort | uniq | column
} }
view()
{
${DSV_VIEWER:-${DSV_PDFVIEWER:-xdg-open}} "$@"
}
search() search()
{ {
while true; do while true; do
@ -181,7 +189,7 @@ search()
if $path; then if $path; then
echo "`pwd`/$DSV_DIR/$file" echo "`pwd`/$DSV_DIR/$file"
elif ! $show_url; then elif ! $show_url; then
${DSV_VIEWER:-${DSV_PDFVIEWER:-xdg-open}} "$DSV_DIR/$file" view "$DSV_DIR/$file"
fi fi
if $show_url; then if $show_url; then
url=`sed 1d "$DSV_DIR/dsv-$name"` url=`sed 1d "$DSV_DIR/dsv-$name"`
@ -189,7 +197,8 @@ search()
echo "$url" echo "$url"
else else
echo "$DSV_DIR/dsv-$name" \ echo "$DSV_DIR/dsv-$name" \
"does not contain an URL - please regenerate" 1>&2 "does not contain a URL" \
"- please regenerate" 1>&2
exit 1 exit 1
fi fi
fi fi