feat(nushell): fast wt add by default (--pr opt-in) and hierarchical worktree paths
6783dcce912710ba9154158267994e36f6ecb27c
Oliver Krylow <o.krylow@isp-insoft.de> ·
SSH signature · not checked
- Parent 1: d40c346f5269
bugabingas dorkfiles
6783dcce912710ba9154158267994e36f6ecb27c
Oliver Krylow <o.krylow@isp-insoft.de> ·
SSH signature · not checked
+35 / −18 text lines
+35 / −18 text lines
# Branch name -> path-safe suffix. | split row "/" | each {|segment| let cleaned = ($segment | str replace --all --regex $illegal '-' | str replace --all --regex '(-)+' '-' | str trim --char '-') if ($cleaned | is-empty) { null } else if ($cleaned | str uppercase) in $reserved { $"($cleaned)-" } else { $cleaned } } | where {|seg| $seg != null } | str join "/" reduce --fold [] {|candidate, acc| if ($candidate.branch in ($acc | get --optional branch)) { $acc } else { $acc | append $candidate } } $in | sort-by branch | uniq-by branchdef pick-add-candidate [query?: string] {def pick-add-candidate [query?: string, include-prs: bool = false] { raw-add-candidates | where {|candidate| add-candidate-matches $candidate $query } raw-add-candidates $include-prs | where {|candidate| add-candidate-matches $candidate $query } --base (-b): string = $HEAD # Explicitly create a new branch from this base instead of picking --pr # Only show PR candidates (gh/fj); local/remote branches excluded