you grab GITHUB_TOKEN from vim.env. I would like to use the 1Password CLI to populate the GITHUB_TOKEN.
Currently I have it set up like so (using the op.nvim 1Password Neovim plugin):
local github_token = require('op.api').item.get({ '[item uuid here]', '--fields', 'token' })[1]
if not github_token or not vim.startswith(github_token, 'ghp_') then
error('Failed to get GitHub token.')
end
vim.env.GITHUB_TOKEN = github_token
require('octo').setup()
However, this means I am prompted for auth immediately, instead of only when octo.nvim actually goes to run the gh CLI.
Would it be possible to have an option in setup like so:
require('octo').setup({
get_gh_token = function()
local github_token = require('op.api').item.get({ '[item uuid here]', '--fields', 'token' })[1]
if not github_token or not vim.startswith(github_token, 'ghp_') then
error('Failed to get GitHub token.')
end
return github_token
end,
})
I see that in https://github.com/pwntester/octo.nvim/blob/master/lua/octo/gh/init.lua
you grab
GITHUB_TOKEN
fromvim.env
. I would like to use the 1Password CLI to populate theGITHUB_TOKEN
.Currently I have it set up like so (using the
op.nvim
1Password Neovim plugin):However, this means I am prompted for auth immediately, instead of only when
octo.nvim
actually goes to run thegh
CLI.Would it be possible to have an option in
setup
like so: