#!/bin/sh

usage="\
Moves a file in the filesystem and updates the path in TMSU

Usage: $(basename $0) SRCFILE DESTFILE"

if test $# -ne 2; then
    echo "${usage}" 1>&2
    exit 1
fi

DEST=$2
if [ -d "$2" ]; then
    BASE=$(basename "$1")
    DEST="$DEST/$BASE"
fi

mv "$1" "$DEST" && tmsu repair --manual "$1" "$DEST"
