2727# Options:
2828# --enable-npm-scan Enable Node.js package scanning
2929# --disable-npm-scan Disable Node.js package scanning
30- # --search-dir DIR Add DIR to search paths (repeatable, appends to SEARCH_DIRS )
30+ # --search-dirs DIR [DIR...] Search DIRs instead of $HOME (replaces default; repeatable )
3131# --verbose Show progress messages
3232# --color=WHEN auto | always | never (default: auto)
3333# -v, --version Show version
@@ -51,12 +51,13 @@ COLOR_MODE="auto" # auto | always | never
5151QUIET=true # Suppress progress messages by default in community mode
5252ENABLE_NODE_PACKAGE_SCAN=" auto" # auto | true | false
5353
54- # Directories to search for projects and extensions (space-separated )
54+ # Directories to search for projects and extensions (bash array )
5555# Default: user's home directory. Customize as needed, e.g.:
56- # SEARCH_DIRS="$HOME /Volumes/code" # home + encrypted partition
57- # SEARCH_DIRS="/Volumes/code" # only encrypted partition
58- # SEARCH_DIRS="$HOME /Volumes/code /opt/work $HOME/project" # multiple locations
59- SEARCH_DIRS=" \$ HOME"
56+ # SEARCH_DIRS=("\$HOME" "/Volumes/code") # home + encrypted partition
57+ # SEARCH_DIRS=("/Volumes/code") # only encrypted partition
58+ # SEARCH_DIRS=("\$HOME" "/Volumes/code" "/opt/work") # multiple locations
59+ SEARCH_DIRS=(" \$ HOME" )
60+ _SEARCH_DIRS_SET=false
6061
6162# ==============================================================================
6263# STEPSECURITY ENTERPRISE CONFIGURATION
@@ -536,7 +537,7 @@ resolve_search_directories() {
536537 local user_home=" $1 "
537538 local resolved_dirs=()
538539
539- for dir in $ SEARCH_DIRS; do
540+ for dir in " ${ SEARCH_DIRS[@]} " ; do
540541 # Resolve $HOME to the actual user home directory
541542 local resolved=" ${dir/ \$ HOME/ $user_home } "
542543 if [ -d " $resolved " ]; then
@@ -3607,7 +3608,7 @@ Output formats (community mode, mutually exclusive):
36073608 --html FILE HTML report saved to FILE
36083609
36093610Options:
3610- --search-dir DIR Add DIR to search paths (repeatable, appends to SEARCH_DIRS )
3611+ --search-dirs DIR [DIR...] Search DIRs instead of \$ HOME (replaces default; repeatable )
36113612 --enable-npm-scan Enable Node.js package scanning
36123613 --disable-npm-scan Disable Node.js package scanning
36133614 --verbose Show progress messages (suppressed by default)
@@ -3621,7 +3622,9 @@ Examples:
36213622 $( basename " $0 " ) --json > scan.json # JSON to file
36223623 $( basename " $0 " ) --html report.html # HTML report
36233624 $( basename " $0 " ) --verbose --enable-npm-scan # Verbose with npm scan
3624- $( basename " $0 " ) --search-dir /Volumes/code # Also search /Volumes/code
3625+ $( basename " $0 " ) --search-dirs /Volumes/code # Search only /Volumes/code
3626+ $( basename " $0 " ) --search-dirs /tmp /opt # Multiple dirs, one flag
3627+ $( basename " $0 " ) --search-dirs "/path/with spaces" --search-dirs /opt # Mixed styles
36253628 $( basename " $0 " ) send-telemetry # Enterprise telemetry
36263629
36273630https://github.com/step-security/dev-machine-guard
@@ -3677,13 +3680,20 @@ while [ $# -gt 0 ]; do
36773680 fi
36783681 shift
36793682 ;;
3680- --search-dir)
3681- if [ -z " ${2:- } " ]; then
3682- print_error " --search-dir requires a directory path argument"
3683+ --search-dirs)
3684+ shift
3685+ if [ $# -eq 0 ] || [[ " $1 " == --* ]]; then
3686+ print_error " --search-dirs requires at least one directory path argument"
36833687 exit 1
36843688 fi
3685- SEARCH_DIRS=" ${SEARCH_DIRS} $2 "
3686- shift 2
3689+ if [ " $_SEARCH_DIRS_SET " = false ]; then
3690+ SEARCH_DIRS=()
3691+ _SEARCH_DIRS_SET=true
3692+ fi
3693+ while [ $# -gt 0 ] && [[ " $1 " != --* ]]; do
3694+ SEARCH_DIRS+=(" $1 " )
3695+ shift
3696+ done
36873697 ;;
36883698 --verbose)
36893699 QUIET=false
0 commit comments