ChatGPT.nvim icon indicating copy to clipboard operation
ChatGPT.nvim copied to clipboard

`api_key_cmd` won't work if command argument contain spaces

Open traysh opened this issue 2 years ago • 0 comments

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.

traysh avatar Jan 08 '24 18:01 traysh