@@ -46,7 +46,7 @@ local function parse_opts(opts, target)
4646 return query
4747end
4848
49- local function msgLoadingPopup (msg , cmd , complete_fn )
49+ local function msgLoadingPopup (msg , cmd , cwd , complete_fn )
5050 local row = math.floor ((vim .o .lines - 5 ) / 2 )
5151 local width = math.floor (vim .o .columns / 1.5 )
5252 local col = math.floor ((vim .o .columns - width ) / 2 )
@@ -69,7 +69,7 @@ local function msgLoadingPopup(msg, cmd, complete_fn)
6969 end
7070 vim .defer_fn (
7171 vim .schedule_wrap (function ()
72- local results = utils .get_os_command_output (cmd )
72+ local results = utils .get_os_command_output (cmd , cwd )
7373 if not pcall (vim .api .nvim_win_close , prompt_win , true ) then
7474 log .trace (" Unable to close window: " , " ghcli" , " /" , prompt_win )
7575 end
@@ -86,7 +86,7 @@ B.gh_issues = function(opts)
8686 local opts_query = parse_opts (opts , " issue" )
8787 local cmd = vim .iter ({ " gh" , " issue" , " list" , opts_query }):flatten ():totable ()
8888 local title = " Issues"
89- msgLoadingPopup (" Loading " .. title , cmd , function (results )
89+ msgLoadingPopup (" Loading " .. title , cmd , opts . cwd , function (results )
9090 if results [1 ] == " " then
9191 print (" Empty " .. title )
9292 return
@@ -125,7 +125,7 @@ B.gh_pull_request = function(opts)
125125 local opts_query = parse_opts (opts , " pr" )
126126 local cmd = vim .iter ({ " gh" , " pr" , " list" , opts_query }):flatten ():totable ()
127127 local title = " Pull Requests"
128- msgLoadingPopup (" Loading " .. title , cmd , function (results )
128+ msgLoadingPopup (" Loading " .. title , cmd , opts . cwd , function (results )
129129 if results [1 ] == " " then
130130 print (" Empty " .. title )
131131 return
@@ -170,10 +170,10 @@ B.gh_pull_request_files = function(opts, pr_number)
170170 local cmd = pr_number and { " gh" , " pr" , " view" , pr_number , " --json" , " files" , " --jq" , " .files.[].path" }
171171 or { " gh" , " pr" , " view" , " --json" , " files" , " --jq" , " .files.[].path" }
172172
173- local pr_title = ' "' .. utils .get_os_command_output (title_cmd )[1 ] .. ' "'
173+ local pr_title = ' "' .. utils .get_os_command_output (title_cmd , opts . cwd )[1 ] .. ' "'
174174 local title = " Modified Files for " .. pr_title
175175
176- msgLoadingPopup (" Loading " .. title , cmd , function (results )
176+ msgLoadingPopup (" Loading " .. title , cmd , opts . cwd , function (results )
177177 if results [1 ] == " " then
178178 print (" Empty " .. title )
179179 return
@@ -183,7 +183,7 @@ B.gh_pull_request_files = function(opts, pr_number)
183183 prompt_title = title ,
184184 finder = finders .new_table {
185185 results = results ,
186- entry_maker = make_entry .gen_from_file (),
186+ entry_maker = make_entry .gen_from_file (opts ),
187187 },
188188 previewer = conf .file_previewer (opts ),
189189 })
@@ -197,7 +197,7 @@ B.gh_gist = function(opts)
197197 local opts_query = parse_opts (opts , " gist" )
198198 local title = " Gist"
199199 local cmd = vim .iter ({ " gh" , " gist" , " list" , opts_query }):flatten ():totable ()
200- msgLoadingPopup (" Loading " .. title , cmd , function (results )
200+ msgLoadingPopup (" Loading " .. title , cmd , opts . cwd , function (results )
201201 if results [1 ] == " " then
202202 print (" Empty " .. title )
203203 return
@@ -229,7 +229,7 @@ B.gh_secret = function(opts)
229229 local opts_query = parse_opts (opts , " secret" )
230230 local title = " Secret"
231231 local cmd = vim .iter ({ " gh" , " secret" , " list" , opts_query }):flatten ():totable ()
232- msgLoadingPopup (" Loading " .. title , cmd , function (results )
232+ msgLoadingPopup (" Loading " .. title , cmd , opts . cwd , function (results )
233233 if results [1 ] == " " then
234234 print (" Empty " .. title )
235235 return
@@ -271,7 +271,7 @@ B.gh_run = function(opts)
271271 local opts_query = parse_opts (opts , " run" )
272272 local cmd = vim .iter ({ " gh" , " run" , " list" , opts_query }):flatten ():totable ()
273273 local title = " Workflow runs"
274- msgLoadingPopup (" Loading " .. title , cmd , function (results )
274+ msgLoadingPopup (" Loading " .. title , cmd , opts . cwd , function (results )
275275 if results [1 ] == " " then
276276 print (" Empty " .. title )
277277 return
0 commit comments