Skip to main content

Module scripts

Module scripts 

Source
Expand description

Script builders — ports of script_cd / script_mkdir_cd / script_clone / script_worktree / script_delete / script_ascend / script_rename (try.rb:1411-1467). Every byte matters: the emitted strings are pinned by test_05/07/12/16/31/37.

Functions§

script_ascend
script_ascend (try.rb:1441-1457): git worktree move when the source has a .git file (worktree marker), plain mv otherwise; then a symlink back into the tries dir, the Graduated: echo (with a literal →), and a cd to the destination.
script_cd
script_cd (try.rb:1411-1413). The leading touch bumps mtime, which feeds base_score recency — selecting a try boosts its future ranking. That feedback loop is a feature, not an accident.
script_clone
script_clone (try.rb:1419-1421). Upstream hardcodes single quotes around the URI (git clone '#{uri}') instead of q() — preserved.
script_delete
script_delete (try.rb:1434-1439): cd into the base, test -d guard per basename, then restore the original PWD with a base-path fallback.
script_mkdir_cd
script_mkdir_cd (try.rb:1415-1417).
script_rename
script_rename (try.rb:1459-1467).
script_worktree
script_worktree (try.rb:1423-1432). The inner sh -c guard adds the worktree (detached) only when inside a work tree and always exits 0, so a non-git source still mkdir+cds. repo = None is the current-directory variant (no -C); src is what the echo names.