#!/bin/bash
# Core wa shell functions
#
# Source this in your shell profile (~/.bashrc, ~/.zshrc):
#   source ~/Desktop/projects/casemgr_umbrella/wa/scripts/workarea-functions.sh
#
# These functions provide interactive shortcuts for the wa CLI.
# For project-specific examples, see scripts/examples/

# cd to a worktree by alias (activates it as current)
cdwa() {
  cd $(wa get wa --alias=$1 --activate) || return
}

# open VS Code for a worktree by alias
codewa() {
  cd $(wa get wa --alias=$1) && wa code || return
}

# cd to the root of the current worktree
home() {
  cd $(wa get wt --worktree) || return
}

# checkout the main branch
main() {
  wa co br --bn=main
}

# list all worktree aliases
aliases() {
  wa ls wa --aliases
}
