feat(cli): add dispatch path to print a session directory#332
Merged
Conversation
Add a `dispatch path <id|--last|--current>` command that prints only a session's working directory, so you can `cd "$(dispatch path x)"`. It resolves the session the same way `dispatch open` does (full ID, alias, short ID prefix, --last, --current) by reusing open's resolver seams. It errors when the session has no recorded directory or when that directory no longer exists on disk, so `cd "$(...)"` fails loudly instead of landing in the wrong place. Wires the command into the CLI dispatch switch, the four shell completion lists, the usage banner, the man examples, the README, and the changelog. Closes #330 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 732fe147-a68b-4784-8e17-ef089fb70ba3
# Conflicts: # CHANGELOG.md # cmd/dispatch/cli.go # cmd/dispatch/main.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
dispatch pathcommand that prints only a session's working directory, so you can change into it from a subshell:Why
dispatch infoprints a full summary anddispatch open --printprints a resume command. Neither gives you just the directory, so scripting acdinto a session folder meant parsing output.pathfills that gap with a single-line, cd-friendly result.Details
opendoes (full ID, alias, short ID prefix,--last,--current) by reusing open's resolver seams, so matching rules stay identical.cd "$(...)"fails loudly instead of landing somewhere wrong.Tests
parsePathArgstable tests: id, alias,--last,-l,--current, and the error cases (no selector, combined selectors, extra args, unknown flag).runPathtests via the seam stubs: resolve by ID, by alias,--last,--current, empty-directory error, missing-directory error, unknown ID.Verification
go build ./...,go vet ./...,go test ./...,golangci-lint run, andmage deadcodeall pass.Closes #330