lib/parse_arg.rb
def parse_extra_args(args)
  # Special case: consider a single argument
  if (ARGV.length == 1)
    return (ARGV[0].start_with?('-')) ? [] : [ARGV[0]]
  end
  
  args[0..-2].each_index do |i|
    if (args[i].start_with?('-'))
      # Delete the flag, and its value if present
      args.delete_at(i+1) unless(args[i+1].nil? || args[i+1].start_with?('-'))
      args.delete_at(i)
    end
  end
  
  # Special case: consider the last argument
  if (ARGV[-2].start_with?('-') && !ARGV[-1].start_with?('-'))
    args.unshift(ARGV[-1])
  end
  return args
end
# Return an array containing all 'unaffiliated' arguments, 
# meaning they are not preceeded by a parameter starting with '-'

Return an array containing all 'unaffiliated' arguments,
meaning they are not preceeded by a parameter starting with '-'
Return an array containing all ' unaffiliated ' arguments meaning they are not preceeded by a parameter starting with ' - '
def parse_extra_args(args)
  if (ARGV.length == 1)
    return (ARGV[0].start_with?('-')) ? [] : [ARGV[0]]
  end
  args[0..-2].each_index do |i|
    if (args[i].start_with?('-'))
      args.delete_at(i+1) unless(args[i+1].nil? || args[i+1].start_with?('-'))
      args.delete_at(i)
    end
  end
  if (ARGV[-2].start_with?('-') && !ARGV[-1].start_with?('-'))
    args.unshift(ARGV[-1])
  end
  return args
end
def parse_extra_args ( args ) if ( ARGV . length == 1 ) return ( ARGV [ 0 ] . start_with? ( '-' ) ) ? [ ] : [ ARGV [ 0 ] ] end args [ 0 .. - 2 ] . each_index do | i | if ( args [ i ] . start_with? ( '-' ) ) args . delete_at ( i + 1 ) unless ( args [ i + 1 ] . nil? || args [ i + 1 ] . start_with? ( '-' ) ) args . delete_at ( i ) end end if ( ARGV [ - 2 ] . start_with? ( '-' ) && ! ARGV [ - 1 ] . start_with? ( '-' ) ) args . unshift ( ARGV [ - 1 ] ) end return args end
Return an array containing all 'unaffiliated' arguments,
meaning they are not preceeded by a parameter starting with '-'
Return an array containing all ' unaffiliated ' arguments meaning they are not preceeded by a parameter starting with ' - '
# Special case: consider a single argument
 # Delete the flag, and its value if present
 # Special case: consider the last argument

args