--link-handling Flag for MOVE Operations (#48)
This release adds link handling modes to control behavior when MOVE encounters symlinks/junctions that would create cycles with the destination.
The Problem
After using preserve MOVE ... -L junction to relocate subdirectories, users couldn't move parent directories because the nested junctions pointed back to the destination:
# Step 1: Move subdirectory with junction
preserve MOVE "C:\cache\huggingface" --dst "E:\cache\huggingface" -L junction
# Step 2: Later, try to consolidate parent - BLOCKED!
preserve MOVE "C:\cache" --dst "E:\cache"
# Error: Cycle detected - nested junction points to destinationThe Solution
New --link-handling MODE flag:
| Mode | Behavior |
|---|---|
block |
(default) Block operation if cycle-creating links found |
skip |
Skip links, move non-link content only |
unlink |
Remove links pointing to destination after successful move |
# Skip the problematic links, move everything else
preserve MOVE "C:\cache" --dst "E:\cache" --link-handling skip
# Consolidation mode - remove links after move
preserve MOVE "C:\cache" --dst "E:\cache" --link-handling unlinkAdded
--link-handlingCLI flag withblock,skip,unlinkmodesLinkHandlingModeenum withfrom_string()parserLinkInfodataclass for link analysisanalyze_link()anddecide_link_action()functionscreates_cyclefield in link report- 19 new unit tests (284 total)
Phase 2 (Future)
recreatemode: Copy links to destination with adjusted targetsaskmode: Interactive prompt for each link
See #48 for progress on Phase 2.