summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2021-12-15 23:16:01 +0100
committerDaniel Weipert <code@drogueronin.de>2022-01-10 13:28:28 +0100
commit3d29da167e1e0071b4cde3700c825c5c6e40448d (patch)
tree644f4abf1202133d112e9e0a0d76100acaa86871
parentb5dd4f9123ae7464708bd84c76fd7f554bd350c2 (diff)
Add --dry-run option to preview rclone command
-rw-r--r--lua/rclone.lua24
1 files changed, 18 insertions, 6 deletions
diff --git a/lua/rclone.lua b/lua/rclone.lua
index c584b6b..27809bf 100644
--- a/lua/rclone.lua
+++ b/lua/rclone.lua
@@ -221,8 +221,12 @@ local function copy(options)
build_cmd_exclude(local_path) .. ' ' ..
build_cmd_logging()
- os.execute(cmd)
- print(cmd)
+ if options['--dry-run'] then
+ print(cmd)
+ else
+ os.execute(cmd)
+ end
+
print("Copied!")
return config
@@ -255,8 +259,12 @@ local function copyFile(options)
build_cmd_exclude(local_path) .. ' ' ..
build_cmd_logging()
- os.execute(cmd)
- print(cmd)
+ if options['--dry-run'] then
+ print(cmd)
+ else
+ os.execute(cmd)
+ end
+
print("Copied file!")
return config
@@ -283,8 +291,12 @@ local function sync(options)
build_cmd_exclude(local_path) .. ' ' ..
build_cmd_logging()
- os.execute(cmd)
- print(cmd)
+ if options['--dry-run'] then
+ print(cmd)
+ else
+ os.execute(cmd)
+ end
+
print("Synced!")
return config