lib/yac.rb in yac-1.0.2 vs lib/yac.rb in yac-1.0.3
- old
+ new
@@ -158,12 +158,14 @@
end
file = full_path(args+suffix)
end
def show_single(args)
- file = search_name(args,"Show")
- format_file(file)
+ loop do
+ file = search_name(args,"Show")
+ file ? format_file(file) : break
+ end
end
def rm_single(args)
file = search_name(args,"Remove")
if confirm("You Are Removing #{file}.")
@@ -187,10 +189,13 @@
path = (args =~ /^(@)/) ? [@main_path] : [@main_path , @pri_path]
result = []
path.each do |x|
result.concat(`find "#{x}" -type f -iwholename '#{x}*#{args.sub(/^@/,'').strip}*' -not -iwholename '*.git*'| sed 's/^.*\\(private\\|main\\)\\//#{x=~/main/ ? '@':'' }/'`.to_a)
end
+ #For loop show filename
+ (format_file(full_path(result[0]));return nil) if msg =~ /show/i && result.size == 1
+
return result.empty? ? (colorful("Nothing Found About < #{args} >","warn")) :
(colorful("The Results About < #{args} > To #{msg || "Operate"} :","notice");full_path(choose_one(result)))
end
def search_content(args)
@@ -208,10 +213,10 @@
all_result.concat(stuff[0].to_a)
end
loop do
colorful("All files Contain #{args.strip},Choose one to show","notice")
file = full_path(choose_one(all_result))
- file ? format_file(file) : exit
+ file ? format_file(file) : break
end
end
def full_path(args)
return false unless args