#!/bin/bash

alias f=fg
alias k=kubectl
alias vcat=vimcat

# git
alias g='git'
alias gst='git status'
alias gco='git checkout'
alias gcm='git commit -m'

alias p=pnpm
alias t=turbo

if command -v eza >/dev/null; then
  alias ls='eza'
fi

if command -v bat >/dev/null; then
  alias cat='bat'
fi

function vim() {
  nvim $*
}

function kubecomplete() {
  source <(kubectl completion zsh)
}

function mkcd() {
  mkdir $1
  cd $1
}

function start_colima() {
  colima start --arch aarch64 --vm-type=vz --vz-rosetta --cpu 4 --memory 8 --mount-inotify
}

function awsso() {
  export AWS_PROFILE="$(cat ~/.aws/credentials | rg '^\[(.+)\] # sso$' -r '$1' | fzf --header "choose aws profile" --height 20)"

  if [ -z "$AWS_PROFILE" ]; then
    echo "noop: no profile selected" >/dev/stderr
    exit 1
  fi

  echo "logging in to $AWS_PROFILE"

  aws sso login --profile "$AWS_PROFILE"
}
