Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ return {
across all boards (read-only — items show their `[board]`; only open-link is
offered).
- `:ShepherdStats` — open shepherd's stats charts in the floating terminal.
- `:ShepherdBoards` — pick a board (shows `open/total`, `*` marks current),
then **switch** the session to it, **rename**, **archive**, or **delete** it
(delete shows a dry-run preview and asks to confirm first). Switching overrides
the configured `board` until you switch again or restart.
- `:ShepherdBoards` — pick a board (shows `open/total`, `*` marks current, and
its working **dir** if set), then **switch** the session to it, **rename**,
set its **dir** (working directory; empty clears), **archive**, or **delete**
it (delete shows a dry-run preview and asks to confirm first). Switching
overrides the configured `board` until you switch again or restart, and
`:tcd`s to the board's dir when it has one.
- `:ShepherdBoardsArchived` — pick an archived board to unarchive.
- `:ShepherdCapture` — turn the current line into a todo; in visual mode
(`:'<,'>ShepherdCapture`) the selection. Strips a leading comment marker and
Expand Down
18 changes: 16 additions & 2 deletions lua/shepherd/board.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ local function fetch(args, cb)
end

local function plabel(b)
return string.format("%s %s (%d/%d)", b.current and "*" or " ", b.name, b.open, b.total)
local s = string.format("%s %s (%d/%d)", b.current and "*" or " ", b.name, b.open, b.total)
if b.dir and b.dir ~= "" then
s = s .. " " .. vim.fn.fnamemodify(b.dir, ":~")
end
return s
end

-- confirm_delete previews the removal with --dry-run, then requires an explicit
Expand Down Expand Up @@ -57,11 +61,21 @@ function M.switch()
if not b then
return
end
vim.ui.select({ "switch", "rename", "archive", "delete" }, { prompt = b.name }, function(act)
vim.ui.select({ "switch", "rename", "dir", "archive", "delete" }, { prompt = b.name }, function(act)
if act == "switch" then
sh.set_active_board(b.name)
if b.dir and b.dir ~= "" then
vim.cmd.tcd(vim.fn.fnamemodify(b.dir, ":p"))
end
sh.refresh()
vim.notify("shepherd: board " .. b.name)
elseif act == "dir" then
-- omit to show is CLI-only; here empty clears, a path sets it
vim.ui.input({ prompt = "dir: ", default = b.dir or "" }, function(v)
if v ~= nil then
sh._run({ "board", "dir", b.name, v }, "dir " .. b.name, { no_board = true })
end
end)
elseif act == "rename" then
vim.ui.input({ prompt = "rename to: ", default = b.name }, function(v)
if v and v ~= "" and v ~= b.name then
Expand Down
Loading