Skip to content

Commit

Permalink
add a way to automatically accept tos
Browse files Browse the repository at this point in the history
  • Loading branch information
tjdevries committed Jul 6, 2023
1 parent f3290d7 commit f923a46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lua/sg/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ local write_cody_data = function(cody_data)
vim.fn.writefile({ vim.json.encode(cody_data) }, data_file)
end

local accept_tos = function()
local accept_tos = function(opts)
local cody_data = get_cody_data()
if opts.accept_tos then
cody_data.tos_accepted = true
end

if not cody_data.tos_accepted then
local choice = vim.fn.inputlist {
"By using Cody, you agree to its license and privacy statement:"
Expand All @@ -53,7 +57,7 @@ end
M.setup = function(opts)
opts = opts or {}

accept_tos()
accept_tos(opts)
require("sg.lsp").setup { on_attach = opts.on_attach }
end

Expand Down
4 changes: 2 additions & 2 deletions scripts/gendocs.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Setup telescope with defaults
(R or require)("sg").setup()
-- Setup sg with defaults
(R or require)("sg").setup { accept_tos = true }

-- tree-sitter-lua docgen
local _ = (R or require) "docgen.transformers"
Expand Down

0 comments on commit f923a46

Please sign in to comment.