feat(s3): create bucket interactively during auth when unconfigured
Problem: when a user runs `:Pending s3 auth` with no bucket configured, auth succeeds but offers no way to create the bucket. The user must manually run `aws s3api create-bucket` and update their config. Solution: add `util.input()` coroutine-aware prompt wrapper and a `create_bucket()` flow in `s3.lua` that prompts for bucket name and region, handles the `us-east-1` LocationConstraint quirk, and logs a config snippet on success. Called automatically from `auth()` when `sync.s3.bucket` is absent.
This commit is contained in:
parent
ee75e6844e
commit
58804fcfc7
3 changed files with 303 additions and 0 deletions
|
|
@ -35,6 +35,21 @@ function M.system(args, opts)
|
|||
return coroutine.yield() --[[@as { code: integer, stdout: string, stderr: string }]]
|
||||
end
|
||||
|
||||
---@param opts? {prompt?: string, default?: string}
|
||||
---@return string?
|
||||
function M.input(opts)
|
||||
local co = coroutine.running()
|
||||
if not co then
|
||||
error('util.input() must be called inside a coroutine')
|
||||
end
|
||||
vim.ui.input(opts or {}, function(result)
|
||||
vim.schedule(function()
|
||||
coroutine.resume(co, result)
|
||||
end)
|
||||
end)
|
||||
return coroutine.yield() --[[@as string?]]
|
||||
end
|
||||
|
||||
---@param name string
|
||||
---@param fn fun(): nil
|
||||
function M.with_guard(name, fn)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue