From 217b6fa0ccaa97fb9932e881bb83f0b7968f7f9a Mon Sep 17 00:00:00 2001 From: Adam Sharp Date: Fri, 20 Nov 2015 14:46:47 +1100 Subject: [PATCH] go(): reformat ridiculous pipeline and document it --- functions | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/functions b/functions index e055c75..c4d5e80 100644 --- a/functions +++ b/functions @@ -13,9 +13,18 @@ function go() findopts=(-type d -maxdepth 4) excludes='.cocoapods|.vim/bundle' - # find -H -> follow symlinks - dir=$(find -H $base ${findopts[*]} -path '*/.git' 2>/dev/null | sed 's,/.git$,,' | grep -vE "$excludes" | xargs -I{} stat -f '%m %N' '{}' | sort -nr | sed -E 's,^[0-9]+ ,,' | sed -E "s,^$base/(src/)?,," | sed 's,/.git$,,' | selecta) + dir=$( + find -H $base ${findopts[*]} -path '*/.git' 2>/dev/null \ # find all git repositories ('-H' means follow symlinks) + | sed 's,/.git$,,' \ # strip the .git suffix + | grep -vE "$excludes" \ # exclude some noise + | xargs -I{} stat -f '%m %N' '{}' | sort -nr \ # sort by most recently modified + | sed -E 's,^[0-9]+ ,,' \ # strip the prefixed modification time + | sed -E "s,^$base/(src/)?,," \ # remove the directory prefix for display + | sed 's,/.git$,,' \ # strip .git suffix (again?) + | selecta + ) + # after selecting a project, expand it back out to its full path and jump to it if [ -n "$dir" ]; then dest=$base/$dir if [ ! -d "$dest" ]; then