Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

improved user feedback: show matched string using 'grep --color'

Signed-off-by: Tj Holowaychuk <tj@vision-media.ca>
  • Loading branch information...
commit e28c359a7ae43ecc325fb65be3c8f3ee023f7b05 1 parent 89e2047
@jweslley jweslley authored tj committed
Showing with 7 additions and 5 deletions.
  1. +6 −4 bin/git-ignore
  2. +1 −1  etc/gitignore
View
10 bin/git-ignore
@@ -9,12 +9,14 @@ done
if [ ! -z "$template" ]; then
gitignoredir="`dirname $0`/../etc/gitignore"
- selected_template=$(find $gitignoredir -type f -name *.gitignore | xargs -i basename {} .gitignore | sort | grep $template)
- count=$(echo $selected_template | wc -w)
+ selected_template() {
+ find $gitignoredir -type f -name *.gitignore | xargs -i basename {} .gitignore | sort | grep $template
+ }
+ count=$(selected_template | wc -w)
case "$count" in
0) echo "The pattern '$template' does not match any available templates." && exit 1;;
- 1) find $gitignoredir -name $selected_template.gitignore -exec cat {} \; >> .gitignore && echo "... added patterns from template '$selected_template'";;
- *) echo "Be more specific. $count macthes found:\n$selected_template" && exit 2;;
+ 1) find $gitignoredir -name $(selected_template).gitignore -exec cat {} \; >> .gitignore && echo "... added patterns from template '$(selected_template)'";;
+ *) echo "Be more specific. $count macthes found:" && selected_template | grep --color $template && exit 2;;
esac
fi
2  etc/gitignore
@@ -1 +1 @@
-Subproject commit 0a41318dba7094f7f97646280a0096e30b6cd596
+Subproject commit acbcdb02e5e608cfd1c9a93eba67c6a73d632870
Please sign in to comment.
Something went wrong with that request. Please try again.