@@ -6,9 +6,10 @@ function show_usage {
66 echo " Usage: switch [OPTIONS] [PROFILE]"
77 echo
88 echo " Options:"
9- echo " --brew Run brew bundle after successful switch"
10- echo " --no-gc Skip running nix garbage collection"
11- echo " --help Show this help message"
9+ echo " --brew Run brew bundle after successful switch"
10+ echo " --no-gc Skip running nix garbage collection"
11+ echo " --skip-todos Allow switch even if TODO comments exist"
12+ echo " --help Show this help message"
1213 echo
1314 echo " If PROFILE is not specified, username@hostname will be used."
1415 exit 0
@@ -17,6 +18,7 @@ function show_usage {
1718# Parse command line arguments
1819RUN_BREW=true
1920RUN_GC=true
21+ SKIP_TODOS=false
2022PROFILE=" "
2123TRACE=" "
2224FAST=false
@@ -42,6 +44,10 @@ while [[ $# -gt 0 ]]; do
4244 FAST=true
4345 shift
4446 ;;
47+ --skip-todos)
48+ SKIP_TODOS=true
49+ shift
50+ ;;
4551 * )
4652 PROFILE=" $1 "
4753 shift
5258if [ " $FAST " = true ]; then
5359 RUN_GC=false
5460 RUN_BREW=false
61+ SKIP_TODOS=true
5562fi
5663
5764# Use default profile if none specified
5865if [ -z " $PROFILE " ]; then
5966 PROFILE=" $( whoami) @$( hostname -s) "
6067fi
6168
69+ # Check for TODO comments
70+ if [ " $SKIP_TODOS " = false ]; then
71+ TODO_FILES=$( grep -rl --exclude-dir=.git " TODO" . 2> /dev/null || true)
72+ if [ -n " $TODO_FILES " ]; then
73+ echo " Error: TODO comments found in the following files:"
74+ echo " $TODO_FILES "
75+ echo
76+ echo " Resolve the TODOs or use --skip-todos to proceed anyway."
77+ exit 1
78+ fi
79+ fi
80+
6281echo " Switching to profile: $PROFILE "
6382
6483# Run home-manager with the selected profile
0 commit comments