From badc7eb5f159dd28a80c44c4ea57580cf16b049f Mon Sep 17 00:00:00 2001 From: Amolith Date: Sun, 18 Jan 2026 08:31:59 -0700 Subject: [PATCH] fix: add type annotations for lx check Assisted-by: Claude Opus 4.5 via Amp --- dist/wt | 5 ++++- src/main.lua | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/wt b/dist/wt index 4b82627d9265b50c402e5e4383d816aa6d88b3c8..deac93ddee43935b556e80173c21a06a3f70b2a8 100755 --- a/dist/wt +++ b/dist/wt @@ -1273,10 +1273,11 @@ end ---@return table[] array of {path: string, branch?: string, bare?: boolean, detached?: boolean} local function parse_worktree_list(output) local worktrees = {} + ---@type {path: string, branch?: string, bare?: boolean, detached?: boolean, head?: string}|nil local current = nil for line in output:gmatch("[^\n]+") do local key, value = line:match("^(%S+)%s*(.*)$") - if key == "worktree" then + if key == "worktree" and value then if current then table.insert(worktrees, current) end @@ -1769,6 +1770,8 @@ local function main() os.exit(EXIT_SUCCESS) end + ---@cast command string + -- Collect remaining args local subargs = {} for i = 2, #arg do diff --git a/src/main.lua b/src/main.lua index e897e28dbac278b29b4af7a924e6f212e3288e73..11ecf0457875be171c45faf1075f9393a0c88803 100644 --- a/src/main.lua +++ b/src/main.lua @@ -1269,10 +1269,11 @@ end ---@return table[] array of {path: string, branch?: string, bare?: boolean, detached?: boolean} local function parse_worktree_list(output) local worktrees = {} + ---@type {path: string, branch?: string, bare?: boolean, detached?: boolean, head?: string}|nil local current = nil for line in output:gmatch("[^\n]+") do local key, value = line:match("^(%S+)%s*(.*)$") - if key == "worktree" then + if key == "worktree" and value then if current then table.insert(worktrees, current) end @@ -1765,6 +1766,8 @@ local function main() os.exit(EXIT_SUCCESS) end + ---@cast command string + -- Collect remaining args local subargs = {} for i = 2, #arg do