···5757# lh-pairall
58585959Uses lighthouse_console to reset all SteamVR dongles, then put them all into pairing mode.
6060+6161+# relink
6262+6363+Update symlink targets from an old target directory to a new one
6464+6565+Example: If you moved all files in `~/Development/tools` to `~/Applications`, you can update all
6666+symlinks in `~/.local/bin` that point to the old location with
6767+`relink ~/.local/bin ~/Development/tools ~/Applications`
+31
scripts/relink.nu
···11+#!/usr/bin/nu
22+33+use std log
44+55+# Update symlink targets from an old target directory to a new one
66+#
77+# Example: If you moved `~/Development/tools` to `~/Applications`, update all
88+# symlinks in `~/.local/bin` that point to the old location:
99+# `relink ~/.local/bin ~/Development/tools ~/Applications`
1010+def main [
1111+ directory: path
1212+ old_target_dir: path
1313+ new_target_dir: path
1414+] {
1515+ let directory = $directory | path expand
1616+ let old_target_dir = $old_target_dir | path expand
1717+ let new_target_dir = $new_target_dir | path expand
1818+1919+ log info $"Updating symlinks in ($directory): ($old_target_dir)/.* -> ($new_target_dir)/.*"
2020+2121+ ls -l $directory
2222+ | where type == symlink and target starts-with $old_target_dir
2323+ | par-each {|link|
2424+ let new_target = $link.target | str replace ($old_target_dir + "/") ($new_target_dir + "/")
2525+ ln -sf $new_target $link.name
2626+ log info $"Updated ($link.name) target: ($link.target) -> ($new_target)"
2727+ }
2828+2929+ log info "Done!"
3030+}
3131+