src/wt/cmd/add.lua 🔗
@@ -77,6 +77,7 @@ function M.cmd_add(args)
.. existing_wt.path
.. "\nhint: run `git worktree prune` to clean up stale entries"
)
+ return
end
wt_check:close()
Amolith created
Add ---@cast annotations in clone.lua and new.lua where the type checker
couldn't infer that loop-bounded array access returns non-nil.
Add early return after shell.die() in add.lua so type checker knows file
handle is non-nil when close() is called.
Assisted-by: Claude Opus 4.5 via Amp
src/wt/cmd/add.lua | 1 +
src/wt/cmd/clone.lua | 1 +
src/wt/cmd/new.lua | 1 +
3 files changed, 3 insertions(+)
@@ -77,6 +77,7 @@ function M.cmd_add(args)
.. existing_wt.path
.. "\nhint: run `git worktree prune` to clean up stale entries"
)
+ return
end
wt_check:close()
@@ -26,6 +26,7 @@ function M.cmd_clone(args)
local positional = {}
while i <= #args do
local a = args[i]
+ ---@cast a string
if a == "--remote" then
if not args[i + 1] then
shell.die("--remote requires a name")
@@ -25,6 +25,7 @@ function M.cmd_new(args)
local positional = {}
while i <= #args do
local a = args[i]
+ ---@cast a string
if a == "--remote" then
if not args[i + 1] then
shell.die("--remote requires a name")