9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/project_types/theme/commands/common/root_helper.rb', line 9
def root_value(options, name)
argv = default_argv(options)
command_index = argv.index(name.to_s)
return "." if command_index.nil?
next_index = command_index + 1
option_by_key = options_map(options)
while next_index < argv.size
element = argv[next_index]
key, value = key_value_tuple(element)
option = option_by_key[key]
return element if option.nil?
next_index += 1 if !option.arg.nil? && !value
if option.arg =~ /PATTERN/ && !value
next_index += 1 while option_argument?(argv, next_index, option_by_key)
next
end
next_index += 1
end
"."
end
|