taste-edit-data-view 834 Bytes
Newer Older
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
#!/bin/bash -e

echo TASTE Data View Editor - Use only the SAVE button - not \"Save as..\" !

if [ ! -z $(which kate) ]
then
    EDITOR="kate -n"
elif [ ! -z $(which gvim) ]
then
    EDITOR="gvim -f"
else
    EDITOR=vi
fi

if [ ! -f "$1" ]
then
    if [ -f DataView.asn ]
    then
        echo 'Opening DataView.asn'
        DATAVIEW=DataView.asn
    else
        echo Error: no data view found
        echo Usage: taste-edit-data-view DataView.asn
        exit 1
    fi
else
    echo Opening "$1"
    DATAVIEW="$1"
fi


before=$(md5sum "$DATAVIEW")
$EDITOR "$DATAVIEW" 2>/dev/null
after=$(md5sum "$DATAVIEW")

if [ ! -f DataView.aadl ]
then
    before=
fi

cp $(taste-config --prefix)/share/taste-types/taste-types.asn .

if [ "$before" != "$after" ] ; then
    taste-update-data-view $1
else
    echo File unchanged
    exit 0
fi