feat(move): tsk move <id> --to <path> for cross-file migration#9
Merged
Conversation
…tion
Moves one or more tasks between `.tsk.md` files. Useful when a task
belongs in a different project, or when archiving completed work
to a separate file.
Flags
--to <path> destination .tsk.md (required)
--dry-run preview move without touching disk
--keep-ids preserve source IDs in destination (errors on collision)
By default, IDs are reassigned in the destination via its nextID().
With --keep-ids, a collision (same id already present in destination)
fails fast before either file is modified.
Atomicity
Destination is saved first, source is purged second. If destination
save fails, source is untouched. Worst case is duplication (both files
contain the task), which is detectable via `tsk doctor`.
Refuses to move when --to resolves to the same canonical path as the
source store ("same file" error).
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
Add
tsk move <id...> --to <path>for migrating tasks between.tsk.mdfiles.I use multiple
.tsk.mdfiles (one per project), and there was no way to move tasks between them without copy-pasting markdown. This fixes that.Flags
--to <path>.tsk.md(required)--dry-run--keep-idsBy default IDs are reassigned in the destination (using its
nextID()), so they slot in naturally next to existing tasks.--keep-idsis for migrations where you want to keep history-stable IDs and you've verified no collisions.Atomicity
The implementation saves the destination first, then removes from source. If the destination save fails, the source is untouched. The worst case is a duplicate (both files contain the task), which is detectable via the new
tsk doctorcommand (PR #8).Example
Tests
9 new tests in
internal/commands/move_test.go:--dry-runpreserves source and skips destination write--toflag rejected--keep-idscollision detected