def parse_cli
cli.defaults = { try_load: false }
cli.parse do |opt|
cli.opt_object(opt, [:project, :dataset_opt, :result])
opt.on(
'--key STRING',
'Return only the value of the requested key'
) { |v| cli[:key] = v }
opt.on(
'--compute-and-save',
'Compute and save the statistics'
) { |v| cli[:compute] = v }
opt.on(
'--try-load',
'Check if stat exists instead of computing on --compute-and-save'
) { |v| cli[:try_load] = v }
opt.on(
'--ignore-empty',
'If the result does not exist, exit without throwing exceptions'
) { |v| cli[:ignore_result_empty] = v }
end
end