-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmsu-rm
executable file
·36 lines (31 loc) · 1.11 KB
/
tmsu-rm
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
#!/usr/bin/env fish
# tmsu-rm - trash or delete a file, then run tmsu repair to remove it from the database.
# FIX: add an argument to force using rm instead of trash, and make the default behavior to only use trash-put and error if it's not found.
set -- script "$(path basename (status filename))"
argparse -n "$script" 'h/help' -- $argv
if set -q _flag_h
echo "$script - trash or delete a file, then run tmsu repair to remove it from the database."
echo "Usage: $script [arguments]"
echo
echo " -h/--help - Print help and exit."
echo " -r/--rm - Force use of rm to remove files."
echo " -t/--trash - Force use of trash-put to remove files."
exit
end
if set -q _flag_r
if not command -qs rm
echo "$script: Could not find 'rm' in PATH." >&2
exit 1
end
set rm_cmd 'rm'
else if set -q _flag_t
if not command -qs rm
echo "$script: Could not find 'trash-put' in PATH." >&2
exit 1
end
set rm_cmd 'trash-put'
else
set rm_cmd (if command -qs trash-put; echo 'trash-put'; else; echo 'rm'; end)
end
command "$rm_cmd" $argv
tmsu untag --all $argv