jackMort / jackMort/ChatGPT.nvim
`api_key_cmd` won't work if command argument contain spaces
- Dominant language
- Lua
- Stars
- 4k
- Forks
- 317
- PR merge metrics
- No merged PRs in 30d
Description
I get `Config api_key_cmd did not return a value when executed` when using the following config:
```
require("chatgpt").setup({
api_key_cmd = "/usr/bin/secret-tool lookup Path 'OpenAI API Key - chatGPT.nvim'"
})
```
But looking up a key that doesn't contain spaces works:
```
require("chatgpt").setup({
api_key_cmd = "/usr/bin/secret-tool lookup Uuid 112c0e39f57244d4b25fed63c68b7c65"
})
```
Please note the 2 commands above lookup the same entry and both work on the terminal. Therefore, parsing `api_key_cmd` does not work when arguments contain spaces, such as `'OpenAI API Key - chatGPT.nvim'`. The problem probably lies in [this function](https://github.com/jackMort/ChatGPT.nvim/blob/48c59167beeb6ee0caa501c46cecc97b9be8571d/lua/chatgpt/api.lua#L162).
Contributor guide
No contributing guide indexed for this repository
Research direction
Inspect the command-handling function in lua/chatgpt/api.lua around line 162, starting with how api_key_cmd is parsed and executed. Reproduce the issue with the two configurations in the report; done means commands whose arguments contain spaces return the API key just like the working command.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, neovim
- Domain
- cli, security
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100