32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/nandoc/cli/option-methods/exclusive-options.rb', line 32
def parse cmd, opts
these = @exclusive_flag_keys & opts.keys
if these.empty? && @default_key
if @notice_stream
msg =
["using default: "+unnormalize_opt_key(@default_key),
@default_short ? "(#{@default_short})" : nil
].compact.join(' ')
@notice_stream.puts msg
end
these.push(@default_key)
end
if these.size > 1
flags = unnormalize_opt_keys(@exclusive_flag_keys)
cmd.command_abort <<-ABORT.gsub(/^ */,'')
#{flags.join(' and ')} are mutually exclusive.
usage: #{cmd.usage}
#{cmd.invite_to_more_command_help}
ABORT
end
these.first
end
|