warnings/exception because of already used aliases more verbose.
This commit is contained in:
parent
a630da465a
commit
ba922fe52c
|
@ -120,17 +120,17 @@ class DenCli::Sub
|
||||||
name = name.to_s unless name.nil?
|
name = name.to_s unless name.nil?
|
||||||
@subs[name] = obj
|
@subs[name] = obj
|
||||||
if @noshortaliases
|
if @noshortaliases
|
||||||
warn "Command/Alias already exists: #{full_cmd.join ' '} #{name}" if @aliases.has_key? name
|
warn "Command/Alias for [#{obj.full_cmd}] already exists: #{full_cmd.join ' '} #{name}. Used by: #{@aliases[name].full_cmd}" if @aliases.has_key? name
|
||||||
@aliases[name] = obj
|
@aliases[name] = obj
|
||||||
else
|
else
|
||||||
DenCli.gen_aliases name, min do |a|
|
DenCli.gen_aliases name, min do |a|
|
||||||
warn "Command/Alias already exists: #{full_cmd.join ' '} #{a}" if @aliases.has_key? a
|
warn "Command/Alias for [#{obj.full_cmd}] already exists: #{full_cmd.join ' '} #{a}. Used by: #{@aliases[a].full_cmd}" if @aliases.has_key? a
|
||||||
@aliases[a] ||= obj
|
@aliases[a] ||= obj
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if aliases
|
if aliases
|
||||||
[*aliases].each do |a|
|
[*aliases].each do |a|
|
||||||
raise ArgumentError, "Alias already exists: #{full_cmd.join ' '} #{a}" if @aliases.has_key? a
|
raise ArgumentError, "Alias for [#{obj.full_cmd}] already exists: #{full_cmd.join ' '} #{a}. Used by: #{@aliases[a].full_cmd}" if @aliases.has_key? a
|
||||||
@aliases[a] = obj
|
@aliases[a] = obj
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue