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))
|
||||
end
|
||||
|
||||
differentiate packages
|
||||
packages
|
||||
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
|
||||
# check against the environment by default.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
module Qwandry
|
||||
class Package
|
||||
attr_reader :name
|
||||
attr_reader :paths
|
||||
attr_reader :repository
|
||||
attr_accessor :name
|
||||
attr_accessor :paths
|
||||
attr_reader :repository
|
||||
|
||||
def initialize(name, paths, repository)
|
||||
@name = name
|
||||
|
|
Loading…
Reference in New Issue