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:
Barrett Ruth 2026-03-18 12:37:14 -04:00
parent 6845cfe64a
commit 1e5c96ca2c
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
7 changed files with 227 additions and 22 deletions

View file

@ -175,6 +175,21 @@ The full list of options with their defaults:
extra_s3_args = {},
-- Extra arguments to pass to curl for FTP operations
extra_curl_args = {},
-- Per-host SCP arg overrides. Args are appended after global extra_scp_args.
-- Keys are exact hostnames as they appear in the SSH URL.
ssh_hosts = {
-- ["myserver.com"] = { extra_scp_args = { "-O" } },
},
-- Per-bucket S3 arg overrides. Args are appended after global extra_s3_args.
-- Keys are exact S3 bucket names.
s3_buckets = {
-- ["my-r2-bucket"] = { extra_s3_args = { "--endpoint-url", "https://..." } },
},
-- Per-host curl arg overrides for FTP. Args are appended after global extra_curl_args.
-- Keys are exact hostnames as they appear in the FTP URL.
ftp_hosts = {
-- ["ftp.internal.com"] = { extra_curl_args = { "--insecure" } },
},
-- EXPERIMENTAL support for performing file operations with git
git = {
-- Return true to automatically git add/mv/rm files
@ -337,6 +352,35 @@ preview_win.max_file_size *oil.preview_win*
than this limit will show a placeholder message instead of being loaded.
Set to `nil` to disable the limit.
ssh_hosts *oil.ssh_hosts*
type: `table<string, {extra_scp_args?: string[]}>` default: `{}`
Per-host SCP argument overrides. Keys are exact hostnames as they appear
in the SSH URL. Per-host args are appended after the global
`extra_scp_args`. Example: >lua
ssh_hosts = {
["nas.local"] = { extra_scp_args = { "-O" } },
}
<
s3_buckets *oil.s3_buckets*
type: `table<string, {extra_s3_args?: string[]}>` default: `{}`
Per-bucket S3 argument overrides. Keys are exact S3 bucket names.
Per-bucket args are appended after the global `extra_s3_args`. Example: >lua
s3_buckets = {
["my-r2-bucket"] = { extra_s3_args = { "--endpoint-url", "https://..." } },
}
<
ftp_hosts *oil.ftp_hosts*
type: `table<string, {extra_curl_args?: string[]}>` default: `{}`
Per-host curl argument overrides for FTP operations. Keys are exact
hostnames as they appear in the FTP URL. Per-host args are appended after
the global `extra_curl_args`. Example: >lua
ftp_hosts = {
["ftp.internal.com"] = { extra_curl_args = { "--insecure" } },
}
<
--------------------------------------------------------------------------------
API *oil-api*