#!/usr/bin/env bash
# Help and version display

show_version() {
  echo "git-auto-switch version $GAS_VERSION"
}

show_help() {
  cat <<EOF
git-auto-switch - Manage multiple GitHub accounts with automatic identity switching

USAGE:
  git-auto-switch <command> [options]
  gas <command> [options]

COMMANDS:
  init        Initialize configuration (first-time setup)
  add         Add a new account
  remove [id] Remove an account (interactive if no ID provided)
  list        List all configured accounts
  apply [id]  Apply configuration to system (no id) or a single account
              to the current repository (id or ssh_alias given)
  validate    Validate configuration and check for issues
  audit       Audit repositories for identity mismatches (--fix to auto-fix)
  current     Show current active account for this directory
  help        Show this help message
  version     Show version information

EXAMPLES:
  # First-time setup
  git-auto-switch init

  # Add a new account
  git-auto-switch add

  # Remove an account
  git-auto-switch remove personal

  # List all accounts
  git-auto-switch list

  # Apply configuration after changes (system-wide)
  git-auto-switch apply

  # Apply a specific account to the current repository only
  # (argument may be the account id or its ssh_alias)
  cd ~/some/repo
  git-auto-switch apply gh-work

  # Check for issues
  git-auto-switch validate

  # Audit repositories
  git-auto-switch audit

  # Audit and fix issues
  git-auto-switch audit --fix

  # Show current active account
  git-auto-switch current

CONFIG FILE:
  $CONFIG_FILE

DOCUMENTATION:
  https://github.com/luongnv89/git-auto-switch

EOF
}
