SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]
Fix searching for flag-like strings, e.g., search_file "--flag"
CodeCreatorb13c1b8fecd8
diff --git a/config/commands/search.sh b/config/commands/search.shindex 8db25c2b..b6a2fc89 100644--- a/config/commands/search.sh+++ b/config/commands/search.sh@@ -27,7 +27,7 @@ search_dir() {returnfidir=$(realpath "$dir")- local matches=$(find "$dir" -type f ! -path '*/.*' -exec grep -nIH "$search_term" {} + | cut -d: -f1 | sort | uniq -c)+ local matches=$(find "$dir" -type f ! -path '*/.*' -exec grep -nIH -- "$search_term" {} + | cut -d: -f1 | sort | uniq -c)# if no matches, returnif [ -z "$matches" ]; thenecho "No matches found for \"$search_term\" in $dir"@@ -87,7 +87,7 @@ search_file() {local search_term="$1"file=$(realpath "$file")# Use grep to directly get the desired formatted output- local matches=$(grep -nH "$search_term" "$file")+ local matches=$(grep -nH -- "$search_term" "$file")# Check if no matches were foundif [ -z "$matches" ]; thenecho "No matches found for \"$search_term\" in $file"@@ -152,4 +152,4 @@ find_file() {local num_matches=$(echo "$matches" | wc -l | awk '{$1=$1; print $0}')echo "Found $num_matches matches for \"$file_name\" in $dir:"echo "$matches" | awk '{print $0}'-}\ No newline at end of file+}