feat(config): add per-host/bucket extra args for SSH, S3, and FTP
Problem: `extra_scp_args`, `extra_s3_args`, and `extra_curl_args` are global — there's no way to pass adapter-specific args only to a single host or bucket (e.g. `-O` for a Synology NAS that requires legacy SCP protocol, or `--endpoint-url` for an R2 bucket). Solution: add `ssh_hosts`, `s3_buckets`, and `ftp_hosts` config tables that map exact hostnames/bucket names to per-target arg lists. Per-target args are appended after the global args at call time. The `scp()` helper in `ssh.lua` accepts a `hosts` list so cross-host copies deduplicate host lookups. `create_s3_command` in `s3fs.lua` extracts the bucket from the command args with no call-site changes needed. `resolved_curl_args` in `ftp.lua` is called by both `curl()` and `ftpcmd()`. Based on: stevearc/oil.nvim#607
This commit is contained in:
parent
6845cfe64a
commit
1e5c96ca2c
7 changed files with 227 additions and 22 deletions
|
|
@ -118,6 +118,9 @@ local default_config = {
|
|||
extra_s3_args = {},
|
||||
-- Extra arguments to pass to curl for FTP operations
|
||||
extra_curl_args = {},
|
||||
ssh_hosts = {},
|
||||
s3_buckets = {},
|
||||
ftp_hosts = {},
|
||||
-- EXPERIMENTAL support for performing file operations with git
|
||||
git = {
|
||||
-- Return true to automatically git add/mv/rm files
|
||||
|
|
@ -233,6 +236,15 @@ default_config.adapter_aliases = {}
|
|||
-- here we can get some performance wins
|
||||
default_config.view_options.highlight_filename = nil
|
||||
|
||||
---@class (exact) oil.SshHostConfig
|
||||
---@field extra_scp_args? string[]
|
||||
|
||||
---@class (exact) oil.S3BucketConfig
|
||||
---@field extra_s3_args? string[]
|
||||
|
||||
---@class (exact) oil.FtpHostConfig
|
||||
---@field extra_curl_args? string[]
|
||||
|
||||
---@class oil.Config
|
||||
---@field adapters table<string, string> Hidden from SetupOpts
|
||||
---@field adapter_aliases table<string, string> Hidden from SetupOpts
|
||||
|
|
@ -259,6 +271,9 @@ default_config.view_options.highlight_filename = nil
|
|||
---@field extra_scp_args string[]
|
||||
---@field extra_s3_args string[]
|
||||
---@field extra_curl_args string[]
|
||||
---@field ssh_hosts table<string, oil.SshHostConfig>
|
||||
---@field s3_buckets table<string, oil.S3BucketConfig>
|
||||
---@field ftp_hosts table<string, oil.FtpHostConfig>
|
||||
---@field git oil.GitOptions
|
||||
---@field float oil.FloatWindowConfig
|
||||
---@field preview_win oil.PreviewWindowConfig
|
||||
|
|
@ -294,6 +309,9 @@ local M = {}
|
|||
---@field extra_scp_args? string[] Extra arguments to pass to SCP when moving/copying files over SSH
|
||||
---@field extra_s3_args? string[] Extra arguments to pass to aws s3 when moving/copying files using aws s3
|
||||
---@field extra_curl_args? string[] Extra arguments to pass to curl for FTP operations
|
||||
---@field ssh_hosts? table<string, oil.SshHostConfig> Per-host SCP arg overrides
|
||||
---@field s3_buckets? table<string, oil.S3BucketConfig> Per-bucket S3 arg overrides
|
||||
---@field ftp_hosts? table<string, oil.FtpHostConfig> Per-host curl arg overrides
|
||||
---@field git? oil.SetupGitOptions EXPERIMENTAL support for performing file operations with git
|
||||
---@field float? oil.SetupFloatWindowConfig Configuration for the floating window in oil.open_float
|
||||
---@field preview_win? oil.SetupPreviewWindowConfig Configuration for the file preview window
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue