feat(sync): interactive setup, auth continuation, and credential resolution fixes (#70)
* feat(sync): add `setup` command to configure credentials interactively
Problem: users had to manually create a JSON credentials file at the
correct path before authenticating, with no guidance from the plugin.
Solution: add `OAuthClient:setup()` that prompts for client ID and
secret via `vim.ui.input`, writes to the shared
`google_credentials.json`, then immediately starts the OAuth flow.
Expose as `:Pending {gtasks,gcal} setup`. Also extend
`resolve_credentials()` to fall back to a shared `google_credentials.json`
so one file covers both backends.
* fix(sync): improve `setup` input loop with validation and masking
Problem: `setup()` used async `vim.ui.input` for both prompts, causing
newline and re-prompt issues when validation failed. The secret was also
echoed in plain text.
Solution: switch to synchronous `vim.fn.input` / `vim.fn.inputsecret`
loops with `vim.cmd.redraw()` + `nvim_echo` for inline error display and
re-prompting. Validate client ID format and `GOCSPX-` secret prefix
before saving.
* fix(oauth): fix `ipairs` nil truncation in `resolve_credentials` and add file-path setup option
Problem: `resolve_credentials` built `cred_paths` with a potentially nil
first element (`credentials_path`), causing `ipairs` to stop immediately
and always fall through to bundled placeholder credentials.
Solution: build `cred_paths` without nil entries using `table.insert`.
Also add a `2. Load from JSON file path` option to `setup()` via
`vim.fn.inputlist`, with `vim.fn.expand` for `~`/`$HOME` support and
the `installed` wrapper unwrap.
* doc: cleanup
* ci: format
This commit is contained in:
parent
715b6d4d12
commit
517a6c0aed
4 changed files with 115 additions and 26 deletions
19
README.md
19
README.md
|
|
@ -1,6 +1,8 @@
|
|||
# pending.nvim
|
||||
|
||||
Edit tasks like text. `:w` saves them.
|
||||
Edit tasks like text. Inspired by
|
||||
[oil.nvim](https://github.com/stevearc/oil.nvim),
|
||||
[vim-fugitive](https://github.com/tpope/vim-fugitive)
|
||||
|
||||

|
||||
|
||||
|
|
@ -24,21 +26,6 @@ luarocks install pending.nvim
|
|||
:help pending.nvim
|
||||
```
|
||||
|
||||
## Icons
|
||||
|
||||
All display characters are configurable. Defaults produce markdown-style checkboxes (`[ ]`, `[x]`, `[!]`):
|
||||
|
||||
```lua
|
||||
vim.g.pending = {
|
||||
icons = {
|
||||
pending = ' ', done = 'x', priority = '!',
|
||||
due = '.', recur = '~', category = '#',
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
See `:help pending.Icons` for nerd font examples.
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
- [dooing](https://github.com/atiladefreitas/dooing)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue