summaryrefslogtreecommitdiff
path: root/neovim/lua/vimrc/azure.lua
blob: 9b6b2451ca75a2ed28cdca2ec60e676cf7fac45a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
local M = {}

function M.setup(opts)
    -- assert(opts.org_url, "org url is required. ")
    -- assert(opts.pipeline_id, "pipeline id is required. ")
    -- assert(opts.api_version, "api version is required. ")
    -- assert(opts.basic_auth_token, "basic auth token is required. ")

    -- local functions = {}
    -- functions.pipeline_bug = function(output_qf)
    --     local cmd = {
    --             "/bin/sh",
    --             "-c",
    --             [[curl -sSL --compressed -X POST -H ]] ..
    --             [['Authorization: Basic ]] .. opts.basic_auth_token .. [[' ]] ..
    --             [[-H 'Content-Type: application/json' ]] ..
    --             [[--data-raw "{ \"previewRun\": true }" ]] ..
    --             opts.org_url .. "/_apis/pipelines/" .. opts.pipeline_id .. "/preview?api-version=" .. opts.api_version ..
    --             " | jq .finalYaml | xargs -0 printf %b | sed -e 's@^\"@@' -e 's@\"$@@'"
    --         }
    --     P(cmd)
    --     require('firvish.job_control').start_job({
    --         cmd = cmd,
    --         filetype = "log",
    --         title = "pipeline",
    --         listed = true,
    --         output_qf = output_qf,
    --         is_background_job = false,
    --         cwd = opts.chart_dir,
    --     })
    -- end

    -- _G.azure_functions = functions

    -- cmd [[command! -bang PipelineBug :lua _G.azure_functions.pipeline_bug("<bang>" ~= "!")]]

end

return M