@@ -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
@@ -59,6 +65,18 @@ if [ -z "$PROFILE" ]; then
5965 PROFILE=" $( whoami) @$( hostname -s) "
6066fi
6167
68+ # Check for TODO comments
69+ if [ " $SKIP_TODOS " = false ]; then
70+ TODO_FILES=$( grep -rl --exclude-dir=.git " TODO" . 2> /dev/null || true)
71+ if [ -n " $TODO_FILES " ]; then
72+ echo " Error: TODO comments found in the following files:"
73+ echo " $TODO_FILES "
74+ echo
75+ echo " Resolve the TODOs or use --skip-todos to proceed anyway."
76+ exit 1
77+ fi
78+ fi
79+
6280echo " Switching to profile: $PROFILE "
6381
6482# Run home-manager with the selected profile
0 commit comments