Skip to content

Commit

Permalink
go(): reformat ridiculous pipeline and document it
Browse files Browse the repository at this point in the history
  • Loading branch information
sharplet committed Nov 20, 2015
1 parent d8cc016 commit 217b6fa
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions functions
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 217b6fa

Please sign in to comment.