Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a function to remove trailing whitespaces

  • Loading branch information...
commit d7c732b787657667642e80cdb33e2361ed8527e4 1 parent fd09248
Cainã Costa authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 functions/sr.sh
18 functions/sr.sh
View
@@ -20,3 +20,21 @@ function sr()
find . -name "$type" -exec gsed -i -e "s%$from%$to%g" "{}" \;
}
+
+# Remove all trailing whitespaces
+#
+# USAGE:
+# clean_whitespaces
+# clean_whitespaces $type
+#
+# Arguments:
+# $type - file type. DEFAULT: *.rb
+#
+# example:
+# clean_whitespaces
+# clean_whitespaces *.coffee
+function clean_whitespaces()
+{
+ local type=${1-*.rb}
+ sr "[ \t]*$" "" $type
+}
Please sign in to comment.
Something went wrong with that request. Please try again.