def post_option_parser(configuration)
unless (configuration.include?(:agent) && configuration.include?(:action))
if ARGV.length >= 2
configuration[:agent] = ARGV[0]
ARGV.delete_at(0)
configuration[:action] = ARGV[0]
ARGV.delete_at(0)
ARGV.each do |v|
if v =~ /^(.+?)=(.+)$/
configuration[:arguments] = [] unless configuration.include?(:arguments)
configuration[:arguments] << v
else
STDERR.puts("Could not parse --arg #{v}")
exit(1)
end
end
else
STDERR.puts("No agent, action and arguments specified")
exit(1)
end
end
args = configuration[:arguments].clone
configuration[:arguments] = {}
args.each do |v|
if v =~ /^(.+?)=(.+)$/
configuration[:arguments][$1.to_sym] = $2
end
end
end