pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.24k stars 124 forks source link

gh_env no longer accepts a function #549

Closed mrjones2014 closed 3 weeks ago

mrjones2014 commented 1 month ago

Issue Description

Type: bug report

Describe what happened (or what feature you want)

The gh_env option no longer accepts a function; it should accept a table or a function returning a table

Describe what you expected to happen

I can use a function like

{
  'pwntester/octo.nvim',
  cmd = 'Octo',
  opts = {
    gh_env = function()
      local github_token = require('op').get_secret('GitHub', 'token')
      if not github_token or not vim.startswith(github_token, 'ghp_') then
        error('Failed to get GitHub token.')
      end

      return { GITHUB_TOKEN = github_token }
    end,
  },
}

How to reproduce it (as minimally and precisely as possible)

  1. Use the above config for gh_env
  2. Try to use octo.nvim
  3. Get an error that config is invalid

Tell us your environment

Anything else we need to know?