Differentiate between identically named repositories
This commit is contained in:
parent
320133c4a5
commit
b16af67f73
|
@ -18,8 +18,19 @@ module Qwandry
|
||||||
packages.concat(repo.scan(pattern))
|
packages.concat(repo.scan(pattern))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
differentiate packages
|
||||||
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.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
module Qwandry
|
module Qwandry
|
||||||
class Package
|
class Package
|
||||||
attr_reader :name
|
attr_accessor :name
|
||||||
attr_reader :paths
|
attr_accessor :paths
|
||||||
attr_reader :repository
|
attr_reader :repository
|
||||||
|
|
||||||
def initialize(name, paths, repository)
|
def initialize(name, paths, repository)
|
||||||
@name = name
|
@name = name
|
||||||
|
|
Loading…
Reference in New Issue