···57# lh-pairall
5859Uses lighthouse_console to reset all SteamVR dongles, then put them all into pairing mode.
00000000
···57# lh-pairall
5859Uses lighthouse_console to reset all SteamVR dongles, then put them all into pairing mode.
60+61+# relink
62+63+Update symlink targets from an old target directory to a new one
64+65+Example: If you moved all files in `~/Development/tools` to `~/Applications`, you can update all
66+symlinks in `~/.local/bin` that point to the old location with
67+`relink ~/.local/bin ~/Development/tools ~/Applications`
+31
scripts/relink.nu
···0000000000000000000000000000000
···1+#!/usr/bin/nu
2+3+use std log
4+5+# Update symlink targets from an old target directory to a new one
6+#
7+# Example: If you moved `~/Development/tools` to `~/Applications`, update all
8+# symlinks in `~/.local/bin` that point to the old location:
9+# `relink ~/.local/bin ~/Development/tools ~/Applications`
10+def main [
11+ directory: path
12+ old_target_dir: path
13+ new_target_dir: path
14+] {
15+ let directory = $directory | path expand
16+ let old_target_dir = $old_target_dir | path expand
17+ let new_target_dir = $new_target_dir | path expand
18+19+ log info $"Updating symlinks in ($directory): ($old_target_dir)/.* -> ($new_target_dir)/.*"
20+21+ ls -l $directory
22+ | where type == symlink and target starts-with $old_target_dir
23+ | par-each {|link|
24+ let new_target = $link.target | str replace ($old_target_dir + "/") ($new_target_dir + "/")
25+ ln -sf $new_target $link.name
26+ log info $"Updated ($link.name) target: ($link.target) -> ($new_target)"
27+ }
28+29+ log info "Done!"
30+}
31+