tidying up.
This commit is contained in:
parent
b16af67f73
commit
ec37f3b59f
|
@ -22,16 +22,6 @@ module Qwandry
|
||||||
packages
|
packages
|
||||||
end
|
end
|
||||||
|
|
||||||
def differentiate(packages)
|
|
||||||
named_groups = Hash.new{|h,k| h[k] = []}
|
|
||||||
packages.each{|p| named_groups[p.name] << p }
|
|
||||||
named_groups.each do |name, packages|
|
|
||||||
if packages.length > 1
|
|
||||||
packages.each{|p| p.name = "#{p.name} (#{p.paths.first})"}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Launches a Package or path represented by a String. Unless `editor` will
|
# Launches a Package or path represented by a String. Unless `editor` will
|
||||||
# check against the environment by default.
|
# check against the environment by default.
|
||||||
def launch(package, editor=nil)
|
def launch(package, editor=nil)
|
||||||
|
@ -50,5 +40,19 @@ module Qwandry
|
||||||
system(*(editor_and_options + paths))
|
system(*(editor_and_options + paths))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# If there are multiple packages named the same, append their path to the name.
|
||||||
|
# This could later be handled in other ways, for instance by merging the paths.
|
||||||
|
def differentiate(packages)
|
||||||
|
named_groups = Hash.new{|h,k| h[k] = []}
|
||||||
|
packages.each{|p| named_groups[p.name] << p }
|
||||||
|
named_groups.each do |name, packages|
|
||||||
|
if packages.length > 1
|
||||||
|
packages.each{|p| p.name = "#{p.name} (#{p.paths.first})"}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue