#!/bin/bash

# Determine the user's shell
if [[ -n "$BASH_VERSION" ]]; then
  shell="bash"
elif [[ -n "$ZSH_VERSION" ]]; then
  shell="zsh"
else
  echo "Unknown shell. Please add the aliases manually."
  exit 1
fi

# Set the aliases to be added to the shell configuration file
aliases=(
  "na='na-cli'"
  "na-gen='na-cli gen'"
  "na-env-yaml='na-cli env-yaml'"
  "na-yaml-env='na-cli yaml-env'"
)

# Check if each alias already exists in the shell configuration file
for alias in "${aliases[@]}"; do
  if ! grep -q "^alias $alias" "$HOME/.${shell}rc"; then
    echo "Adding alias: $alias"
    echo "alias $alias" >> "$HOME/.${shell}rc"
  fi
done

# Reload the shell configuration file to apply changes
source "$HOME/.${shell}rc"
