more helps

This commit is contained in:
ville rantanen
2014-07-19 21:30:33 +03:00
parent 800858e5af
commit 90e2242a06

View File

@@ -197,7 +197,7 @@ function fcd() {
# gcd future fork # gcd future fork
local cdto local cdto
{ cdto=$( python -c ' { cdto=$( python -c '
import sys,os,re,termios,tty import sys,os,re
if len(sys.argv)==1: if len(sys.argv)==1:
print("Arguments: [dir/]pattern_to_match_folders") print("Arguments: [dir/]pattern_to_match_folders")
sys.exit(0) sys.exit(0)
@@ -241,9 +241,9 @@ matches=[repl_case.sub(G()+"\g<1>"+Z(),d) for d in matching_folders]
if len(matching_folders)==0: if len(matching_folders)==0:
match_nocase=re.compile(".*"+pat_base+".*",re.I) match_nocase=re.compile(".*"+pat_base+".*",re.I)
repl_nocase=re.compile(pat_base,re.I) repl_nocase=re.compile("("+pat_base+")",re.I)
matching_folders=[d for d in current_folders if match_nocase.match(d)] matching_folders=[d for d in current_folders if match_nocase.match(d)]
matches=[repl_case.sub(G()+pat_base+Z(),d) for d in matching_folders] matches=[repl_nocase.sub(G()+"\g<1>"+Z(),d) for d in matching_folders]
if len(matching_folders)==1: if len(matching_folders)==1:
print(matches[0]) print(matches[0])
@@ -254,6 +254,9 @@ if len(matching_folders)==0:
sys.exit(1) sys.exit(1)
for i,m in enumerate(matches[0:20]): for i,m in enumerate(matches[0:20]):
print(CS()[i]+": "+m) print(CS()[i]+": "+m)
if len(matches)>20:
print("Skipping rest...")
import termios,tty
ch=getch() ch=getch()
key_in=ch.get() key_in=ch.get()
try: try: