lib/rcoli/model.rb in rcoli-0.5.0 vs lib/rcoli/model.rb in rcoli-0.5.1
- old
+ new
@@ -69,20 +69,20 @@
end
end
parse_args(args, result)
end
+ def find_command(name)
+ commands.find{|command| command.value_of_name.eql? name}
+ end
+
private
def find_option(name)
options.find{|opt| opt.correspond?(name)}
end
-
- def find_command(name)
- commands.find{|command| command.value_of_name.eql? name}
- end
-
+
def is_option?(value)
value.start_with?('-')
end
end
@@ -138,9 +138,19 @@
def initialize(name)
@name = name
end
include CommandContainer
+
+ def full_command
+ command = self
+ result = []
+ while(command.parent) do
+ result << command.value_of_name
+ command = command.parent
+ end
+ return result.reverse.join(' ')
+ end
end
class Program
\ No newline at end of file