Update version number to 1.0.0 marking the first stable release of the Modern Dotfiles Management System with unified command interface and intelligent machine profile detection. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
204 lines
6.8 KiB
Bash
Executable File
204 lines
6.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# Modern Dotfiles Management System - Unified Command Interface
|
|
# Usage: dot <action> [subaction] [flags]
|
|
|
|
# Source required functions
|
|
DOTFILES_DIR="$HOME/.dotfiles"
|
|
if [[ -f "$DOTFILES_DIR/shared/functions" ]]; then
|
|
source "$DOTFILES_DIR/shared/functions"
|
|
fi
|
|
if [[ -f "$DOTFILES_DIR/shared/sync" ]]; then
|
|
source "$DOTFILES_DIR/shared/sync"
|
|
fi
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
CYAN='\033[0;36m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Function to print colored output
|
|
print_color() {
|
|
local color=$1
|
|
local message=$2
|
|
echo -e "${color}${message}${NC}"
|
|
}
|
|
|
|
# Function to show help
|
|
show_help() {
|
|
print_color "$CYAN" "Modern Dotfiles Management System"
|
|
echo ""
|
|
print_color "$YELLOW" "Usage: dot <action> [subaction] [flags]"
|
|
echo ""
|
|
print_color "$BLUE" "SYNC MANAGEMENT:"
|
|
echo " dot sync [--force] Sync dotfiles with remote repository"
|
|
echo " dot sync status Show sync status and last update"
|
|
echo " dot sync on Enable automatic syncing"
|
|
echo " dot sync off Disable automatic syncing"
|
|
echo ""
|
|
print_color "$BLUE" "PACKAGE MANAGEMENT:"
|
|
echo " dot packages [list] Show package status for current profile"
|
|
echo " dot packages install Install all packages for current profile"
|
|
echo " dot packages check Check package installation status"
|
|
echo " dot packages update Install pending updates"
|
|
echo " dot packages status Show update status"
|
|
echo " dot packages check-updates Check for package updates (fast)"
|
|
echo ""
|
|
print_color "$BLUE" "PROFILE MANAGEMENT:"
|
|
echo " dot profile [show] Show current machine profile"
|
|
echo " dot profile set <name> Switch to specified profile"
|
|
echo " dot profile detect Re-detect machine type"
|
|
echo ""
|
|
print_color "$BLUE" "RESET OPERATIONS:"
|
|
echo " dot reset Interactive reset menu"
|
|
echo " dot reset --soft Remove configs, restore originals"
|
|
echo " dot reset --hard Soft reset + uninstall packages"
|
|
echo " dot reset --nuclear Complete removal (back to vanilla)"
|
|
echo ""
|
|
print_color "$BLUE" "GENERAL:"
|
|
echo " dot help Show this help message"
|
|
echo " dot version Show version information"
|
|
echo ""
|
|
print_color "$GREEN" "Examples:"
|
|
echo " dot sync --force Force sync now"
|
|
echo " dot profile set dev Switch to development profile"
|
|
echo " dot packages update Update all packages"
|
|
echo " dot reset --soft Safely reset configurations"
|
|
}
|
|
|
|
# Function to show version
|
|
show_version() {
|
|
print_color "$CYAN" "Modern Dotfiles Management System"
|
|
print_color "$YELLOW" "Version: 1.0.0"
|
|
print_color "$GREEN" "Repository: https://git.turnersrus.com/razzam21/dotfiles"
|
|
}
|
|
|
|
# Main command router
|
|
main() {
|
|
local action="$1"
|
|
local subaction="$2"
|
|
local flag="$3"
|
|
|
|
case "$action" in
|
|
"sync")
|
|
case "$subaction" in
|
|
"status")
|
|
dotfiles_sync_status
|
|
;;
|
|
"on")
|
|
dotfiles_sync_enable
|
|
;;
|
|
"off")
|
|
dotfiles_sync_disable
|
|
;;
|
|
"--force"|"force")
|
|
dotfiles_sync_force
|
|
;;
|
|
"")
|
|
if [[ "$flag" == "--force" ]]; then
|
|
dotfiles_sync_force
|
|
else
|
|
dotfiles_sync_now
|
|
fi
|
|
;;
|
|
*)
|
|
print_color "$RED" "Error: Unknown sync subaction '$subaction'"
|
|
echo "Use 'dot help' for available commands"
|
|
return 1
|
|
;;
|
|
esac
|
|
;;
|
|
"packages"|"pkg")
|
|
case "$subaction" in
|
|
"list"|"")
|
|
dotfiles_packages_status
|
|
;;
|
|
"install")
|
|
dotfiles_install_packages
|
|
;;
|
|
"check")
|
|
dotfiles_check_packages
|
|
;;
|
|
"update")
|
|
dotfiles_update_install
|
|
;;
|
|
"status")
|
|
dotfiles_update_status
|
|
;;
|
|
"check-updates")
|
|
dotfiles_update_check
|
|
;;
|
|
*)
|
|
print_color "$RED" "Error: Unknown packages subaction '$subaction'"
|
|
echo "Use 'dot help' for available commands"
|
|
return 1
|
|
;;
|
|
esac
|
|
;;
|
|
"profile")
|
|
case "$subaction" in
|
|
"show"|"")
|
|
dotfiles_profile_status
|
|
;;
|
|
"set")
|
|
if [[ -z "$flag" ]]; then
|
|
print_color "$RED" "Error: Profile name required"
|
|
echo "Usage: dot profile set <profile_name>"
|
|
return 1
|
|
fi
|
|
dotfiles_profile_set "$flag"
|
|
;;
|
|
"detect")
|
|
dotfiles_profile_detect
|
|
;;
|
|
*)
|
|
print_color "$RED" "Error: Unknown profile subaction '$subaction'"
|
|
echo "Use 'dot help' for available commands"
|
|
return 1
|
|
;;
|
|
esac
|
|
;;
|
|
"reset")
|
|
case "$subaction" in
|
|
"--soft"|"soft")
|
|
"$HOME/.dotfiles/reset.sh" --soft
|
|
;;
|
|
"--hard"|"hard")
|
|
"$HOME/.dotfiles/reset.sh" --hard
|
|
;;
|
|
"--nuclear"|"nuclear")
|
|
"$HOME/.dotfiles/reset.sh" --nuclear
|
|
;;
|
|
"")
|
|
"$HOME/.dotfiles/reset.sh"
|
|
;;
|
|
*)
|
|
print_color "$RED" "Error: Unknown reset option '$subaction'"
|
|
echo "Available options: --soft, --hard, --nuclear"
|
|
return 1
|
|
;;
|
|
esac
|
|
;;
|
|
"help"|"-h"|"--help")
|
|
show_help
|
|
;;
|
|
"version"|"-v"|"--version")
|
|
show_version
|
|
;;
|
|
"")
|
|
print_color "$RED" "Error: No action specified"
|
|
echo "Use 'dot help' for available commands"
|
|
return 1
|
|
;;
|
|
*)
|
|
print_color "$RED" "Error: Unknown action '$action'"
|
|
echo "Use 'dot help' for available commands"
|
|
return 1
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# Execute main function with all arguments
|
|
main "$@" |