diff --git a/lib/mercenary/command.rb b/lib/mercenary/command.rb index 1d2437c..8410c9a 100644 --- a/lib/mercenary/command.rb +++ b/lib/mercenary/command.rb @@ -31,11 +31,6 @@ def initialize(name, parent = nil) @aliases = [] end - # Public: Returns true if this command has no parent - def root? - parent.nil? - end - # Public: Sets or gets the command version # # version - the command version (optional) diff --git a/lib/mercenary/presenter.rb b/lib/mercenary/presenter.rb index bcf20aa..11685fe 100644 --- a/lib/mercenary/presenter.rb +++ b/lib/mercenary/presenter.rb @@ -31,8 +31,9 @@ def options_presentation def command_options_presentation return nil if command.options.empty? + options = command.options - options -= command.parent.options unless command.root? + options -= command.parent.options if command.parent options.map(&:to_s).join("\n") end diff --git a/spec/command_spec.rb b/spec/command_spec.rb index adf328d..85d766b 100644 --- a/spec/command_spec.rb +++ b/spec/command_spec.rb @@ -36,11 +36,6 @@ expect(add_sub.call(command).parent).to eq(command) end - it "can tell whether it is a parent command or not" do - expect(command.root?).to be true - expect(command_with_parent.root?).to be false - end - it "can set its version" do version = "1.4.2" command.version version