summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2022-02-06 18:18:23 +0100
committerDaniel Weipert <code@drogueronin.de>2022-02-06 18:18:23 +0100
commit3285bbffe926ba5f54d1684f323d54fd4311a08e (patch)
tree80391bbc7896fa15d7e0fed8e3f6ef41b155d3b5
parentae6bb93ba269e923592d2a6675962543ca744974 (diff)
Evacuate building local mount path to function
-rw-r--r--lua/rclone.lua24
1 files changed, 18 insertions, 6 deletions
diff --git a/lua/rclone.lua b/lua/rclone.lua
index 0f94916..df7aec6 100644
--- a/lua/rclone.lua
+++ b/lua/rclone.lua
@@ -152,6 +152,23 @@ local function build_cmd_remote_path(config, remote)
end
---
+-- Add local mount path
+--
+-- @param local_path string
+-- @param options table
+-- @param config table
+--
+-- @return string
+local function build_cmd_local_mount_path(local_path, options, config)
+ local mount_directory = options['directory'] or
+ config.vim_rclone_mount_directory or
+ vim.g.vim_rclone_mount_directory or
+ 'rclone.mount'
+
+ return local_path .. '/' .. mount_directory
+end
+
+---
-- Add config location path
--
-- @return string
@@ -441,12 +458,7 @@ local function mount(options)
local local_path = prepare_cmd_local_path(config)
local remote_path = build_cmd_remote_path(config, remote)
-
- local mount_directory = options['directory'] or
- config.vim_rclone_mount_directory or
- vim.g.vim_rclone_mount_directory or
- 'rclone.mount'
- local local_mount_path = local_path .. '/' .. mount_directory
+ local local_mount_path = build_cmd_local_mount_path(local_path, options, config)
local cmd =
'rclone mount ' ..