commit d2ed293948558b49204c2a47195e301aac796640 parent 0576444e523330110f9a7534645a8e5e8037438e Author: Chris Bracken <chris@bracken.jp> Date: Fri, 15 May 2026 15:11:40 +0900 zsh: add use_flutter function Swings the ~/Developer/flutter/flutter symlink to the specified path. Diffstat:
| M | .config/zsh/functions | | | 17 | +++++++++++++++++ |
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/.config/zsh/functions b/.config/zsh/functions @@ -4,3 +4,20 @@ tt() { echo -n "\033]0;$*\007" } + +use_flutter() { + if (( $# == 0 )); then + print -u2 "Usage: use_flutter <path_to_workspace>" + return 1 + fi + local LINK_PATH="$HOME/Developer/flutter/flutter" + local TARGET_ABS="${1:A}" + if [[ -h "$LINK_PATH" || -e "$LINK_PATH" ]]; then + rm -f "$LINK_PATH" + fi + ln -s "$TARGET_ABS" "$LINK_PATH" + # If we're currently under the symlink, reattach to the new inode. + if [[ "$PWD" = "$LINK_PATH"* ]]; then + cd . + fi +}