-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Willem Jan Noort
committed
Jun 7, 2024
1 parent
62067c6
commit c24de76
Showing
9 changed files
with
102 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +0,0 @@ | ||
secret.lua | ||
res.lua | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
---@class adopure.InternalConfig | ||
---@field pat_token string|nil | ||
local InternalConfig = {} | ||
function InternalConfig:new() | ||
local default_config = { | ||
pat_token = os.getenv("AZURE_DEVOPS_EXT_PAT"), | ||
} | ||
local user_config = type(vim.g.adopure) == "function" and vim.g.adopure() or vim.g.adopure or {} | ||
local config = vim.tbl_deep_extend("force", default_config, user_config or {}) | ||
self.__index = self | ||
self = setmetatable(config, self) | ||
return self | ||
end | ||
|
||
function InternalConfig:access_token() | ||
local message = table.concat({ | ||
"No pat_token found in config.", | ||
"Set AZURE_DEVOPS_EXT_PAT environment variable,", | ||
"or check the docs to find other ways of configuring it.", | ||
}, " ") | ||
assert(self.pat_token, message) | ||
return require("b64").enc(":" .. self.pat_token) | ||
end | ||
|
||
local config = InternalConfig:new() | ||
return config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
---@class adopure.Config | ||
---@field pat_token? string | ||
|
||
local config = {} | ||
|
||
---@type adopure.Config | fun():adopure.Config | nil | ||
vim.g.adopure = vim.g.adopure | ||
|
||
return config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters