Browse files

Fixed ruby script to use STDIN, and pipe ll output to script

  • Loading branch information...
1 parent 647e18e commit 7c7aedce0389f2bc5b5878d00e9e5b74c7b18732 @ndbroadbent committed Oct 23, 2012
Showing with 4 additions and 6 deletions.
  1. +4 −6 lib/git/shell_shortcuts.sh
View
10 lib/git/shell_shortcuts.sh
@@ -91,12 +91,10 @@ fi
# Adds numbered shortcuts to output of ls -l, just like 'git status'
unalias ll > /dev/null 2>&1; unset -f ll > /dev/null 2>&1
function ls_with_file_shortcuts {
- local ll_output=''
-
if [ -z $_ls_bsd ]; then
- ll_output="$(ls -lhv --group-directories-first --color "$@")"
+ local ll_output="$(ls -lhv --group-directories-first --color "$@")"
else
- ll_output="$(CLICOLOR_FORCE=1 ls -l -G "$@")"
+ local ll_output="$(CLICOLOR_FORCE=1 ls -l -G "$@")"
fi
# Parse path from args
@@ -127,8 +125,8 @@ function ls_with_file_shortcuts {
fi
# Use ruby to inject numbers into ls output
- ruby -e "$( cat <<EOF
-output = "$ll_output"
+ echo "$ll_output" | ruby -e "$( cat <<EOF
+output = STDIN.read
e = 1
re = /^(([^ ]* +){8})/
output.lines.each do |line|

0 comments on commit 7c7aedc

Please sign in to comment.