diff --git a/lib/qwandry/launcher.rb b/lib/qwandry/launcher.rb index 4f3174d..86768ac 100644 --- a/lib/qwandry/launcher.rb +++ b/lib/qwandry/launcher.rb @@ -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. diff --git a/lib/qwandry/package.rb b/lib/qwandry/package.rb index 729a087..687640b 100644 --- a/lib/qwandry/package.rb +++ b/lib/qwandry/package.rb @@ -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