-
Notifications
You must be signed in to change notification settings - Fork 2
/
RcloneHelper
executable file
·28 lines (24 loc) · 1.05 KB
/
RcloneHelper
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
#!/usr/bin/env bash
. "${BASH_SOURCE[0]%/*}/function.sh" app script || exit
usage()
{
ScriptUsage "$1" "\
Usage: $(ScriptName) [OPTION]... close|IsInstalled|IsRunning|profile|program|stop
$(ScriptName) commands."
}
init()
{
profileName="rclone" profileDir="$HOME/.config/rclone" profileMask="*"
program="rclone"
}
stopCommand() { closeCommand; }
closeCommand() { [[ $force ]] && ! isRunningCommand && return 0; pkill -15 "$program" > "$quietOutput"; }
guiCommand() { git annex webapp; }
isInstalledCommand() { InPath "$program"; }
isRunningCommand() { IsProcessRunning "$program"; }
profileUsage() { echot "Usage: $(ScriptName) profile dir|SaveDir|save|restore [<profile name>|default](latest)\n$(ScriptName) configuration."; }
profileArgs() { profileArgs=( "$@" ); (( shift+=$# )); return 0; }
profileCommand() { profile $noPrompt --app "$profileName" --method "$profileDir" --files "$profileMask" "${profileArgs[@]}"; }
programCommand() { echo "$program"; }
versionCommand() { AppInstallCheck && "$program" --version | head -1 | cut -d"v" -f 2; }
ScriptRun "$@"