Skip to content

Commit

Permalink
hide directories that no longer exist, remove a debug
Browse files Browse the repository at this point in the history
  • Loading branch information
rupa committed Mar 5, 2009
1 parent 07f18e6 commit ffa5795
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions j.sh
Expand Up @@ -53,6 +53,7 @@ j() {
awk -v q="$*" -v t="$(date +%s)" -v r="$r" -F"|" '
BEGIN { f = 2; split(q,a," "); if( r ) f = 3 }
{
if( system("test -d \"" $1 "\"") ) next
for( i in a ) $1 !~ a[i] && $1 = ""
if( $1 ) if( f == 3 ) { print t - $f "\t" $1 } else print $f "\t" $1
}
Expand All @@ -64,9 +65,11 @@ j() {
if( substr(q,1,5) == "j --r" ) {
split(substr(q,7),a," ")
} else split(substr(q,3),a," ")
for( i in a ) print i, a[i] >> "/home/rupa/aargh"
}
{ for( i in a ) $1 !~ a[i] && $1 = ""; if( $1 ) print $1 }
{
if( system("test -d \"" $1 "\"") ) next
for( i in a ) $1 !~ a[i] && $1 = ""; if( $1 ) print $1
}
' $jfile 2>/dev/null
# if we hit enter on a completion just go there (ugh, this is ugly)
elif [[ "$*" =~ "/" ]]; then
Expand All @@ -83,11 +86,15 @@ j() {
f = 2
}
}
{ for( i in a ) $1 !~ a[i] && $1 = ""; if( $1 ) { print $f "\t" $1; x = 1 } }
{
if( system("test -d \"" $1 "\"") ) next
for( i in a ) $1 !~ a[i] && $1 = ""; if( $1 ) { print $f "\t" $1; x = 1 }
}
END {
if( x ) exit
close(FILENAME)
while( getline < FILENAME ) {
if( system("test -d \"" $1 "\"") ) continue
for( i in a ) tolower($1) !~ tolower(a[i]) && $1 = ""
if( $1 ) print $f "\t" $1
}
Expand Down

0 comments on commit ffa5795

Please sign in to comment.