Method: Flagger#parse_flags

Defined in:
lib/cli_tools.rb

#parse_flags(args) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/cli_tools.rb', line 41

def parse_flags(args)
  start_flag_checking
  while not args.empty?
    flag_set  = args.shift
    flag_set.shift
    unless flag_set.flag?
      while not flag_set.empty?
        @active_flags.merge!({flag_key_for(flag_set.shift) => (flag_set.empty? && args.first) ? (args.first.flag? or args.shift ) : true})
      end
    else
      flag_set.shift
      @active_flags.merge!({flag_key_for(flag_set) => (args.first ? (args.first.flag? or args.shift) : true) })
    end
  end
  @active_flags
end