Skip to content

Commit

Permalink
Fix several distant commands where optional parameters were not parse…
Browse files Browse the repository at this point in the history
…d in the correct format
  • Loading branch information
chipsenkbeil committed Jul 24, 2023
1 parent 3e726f2 commit 17bcd37
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 9 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ enables users to edit remote files from the comfort of their local environment.

Visit https://distant.dev/editors/neovim/ for full documentation!

🚧 **(Alpha stage software) This plugin is in rapid development and may
break or change frequently!** 🚧

## Installation

### lazy.nvim
Expand Down
5 changes: 1 addition & 4 deletions lua/distant/commands/distant_cancel_search.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
local plugin = require('distant')
local utils = require('distant.commands.utils')

--- DistantCancelSearch
--- @param cmd NvimCommand
--- @diagnostic disable-next-line:unused-local
local function command(cmd)
local input = utils.parse_args(cmd.args)
utils.paths_to_number(input.opts, { 'timeout', 'interval' })

plugin.editor.cancel_search()
end

Expand Down
2 changes: 1 addition & 1 deletion lua/distant/commands/distant_check_health.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--- DistantCancelSearch
--- DistantCheckHealth
--- @param cmd NvimCommand
--- @diagnostic disable-next-line:unused-local
local function command(cmd)
Expand Down
1 change: 1 addition & 0 deletions lua/distant/commands/distant_metadata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local utils = require('distant.commands.utils')
local function command(cmd)
local input = utils.parse_args(cmd.args)
utils.paths_to_number(input.opts, { 'timeout', 'interval' })
utils.paths_to_bool(input.opts, { 'canonicalize', 'resolve_file_type' })

local path = input.args[1]
input.opts.path = path
Expand Down
1 change: 1 addition & 0 deletions lua/distant/commands/distant_mkdir.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local utils = require('distant.commands.utils')
local function command(cmd)
local input = utils.parse_args(cmd.args)
utils.paths_to_number(input.opts, { 'timeout', 'interval' })
utils.paths_to_bool(input.opts, { 'all' })

local path = input.args[1]
input.opts.path = path
Expand Down
14 changes: 13 additions & 1 deletion lua/distant/commands/distant_open.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@ local utils = require('distant.commands.utils')
--- @param cmd NvimCommand
local function command(cmd)
local input = utils.parse_args(cmd.args)
utils.paths_to_number(input.opts, { 'buf', 'win' })
utils.paths_to_number(input.opts, {
'bufnr',
'winnr',
'line',
'col',
'client_id',
'timeout',
'interval',
})
utils.paths_to_bool(input.opts, {
'reload',
'no_focus',
})
local opts = input.opts

local path = input.args[1]
Expand Down
13 changes: 11 additions & 2 deletions lua/distant/commands/distant_search.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ local utils = require('distant.commands.utils')
--- @param cmd NvimCommand
local function command(cmd)
local input = utils.parse_args(cmd.args)
utils.paths_to_number(input.opts, { 'pagination', 'limit', 'max_depth', 'timeout', 'interval' })
utils.paths_to_bool(input.opts, { 'follow_symbolic_links' })
utils.paths_to_number(input.opts, {
'pagination',
'limit',
'max_depth',
'timeout',
'interval',
})
utils.paths_to_bool(input.opts, {
'follow_symbolic_links',
'upward',
})

local timeout = tonumber(input.opts.timeout)
local interval = tonumber(input.opts.interval)
Expand Down
2 changes: 1 addition & 1 deletion lua/distant/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ end
---
--- Will fail with an error if the shell fails to spawn.
---
--- @param opts {bufnr:number, winnr?:number, cmd?:string|string[], cwd?:string, env?:table<string, string>}
--- @param opts {bufnr?:number, winnr?:number, cmd?:string|string[], cwd?:string, env?:table<string, string>}
--- @return number bufnr
function M:spawn_shell(opts)
opts = opts or {}
Expand Down

0 comments on commit 17bcd37

Please sign in to comment.