From e6ad742cc79119c8e94f47e6eaf964365a6cb654 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Sun, 14 Oct 2012 13:34:56 +1300 Subject: [PATCH] Fallback to default ll if too many files --- lib/git/shell_shortcuts.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/git/shell_shortcuts.sh b/lib/git/shell_shortcuts.sh index 89338b0..916499d 100644 --- a/lib/git/shell_shortcuts.sh +++ b/lib/git/shell_shortcuts.sh @@ -100,9 +100,17 @@ if [ -n "$_ll_command" ]; then # 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 ll { + local ll_output="$(eval $_ll_command $@)" + + if [ "$(echo "$ll_output" | wc -l)" -gt "50" ]; then + echo -e "\e[33mToo many files to create shortcuts. Running plain ll command...\e[0m" + echo "$ll_output" + return 1 + fi + # Use ruby to inject numbers into ls output ruby -e "$( cat <