-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmsu-mv
executable file
·32 lines (27 loc) · 871 Bytes
/
tmsu-mv
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
#!/usr/bin/env fish
# tmsu-mv - move a file, then run tmsu repair for the new name and location.
argparse -n tmsu-mv 'h/help' -- $argv
if test -n "$_flag_h"
echo "tmsu-mv - move a file, then run tmsu repair for the new name and location."
echo "Usage: tmsu-mv [arguments]"
echo
echo " -h/--help - Print help and exit."
exit
end
set destination $argv[-1]
set maybe_sources $argv[1..-2]
set sources
for source in $maybe_sources
if test -e $source
set -a sources $source
else
if not string match -q -- '-*' $source
echo "tmsu-mv: source $source doesn't appear to exist, nor does it seem to be a command option."
end
end
end
for i in (mv -v $argv)
echo "$i" | string match -qr "renamed '(?<from>.+?)' -> '(?<to>.+?)'"
echo tmsu repair --manual $from $to
tmsu repair --manual $from $to
end