Sha256: 52e30835a35db1aed5d98c8abad4fcf099d6786058db754e751217492c91a90e
Contents?: true
Size: 927 Bytes
Versions: 3
Compression:
Stored size: 927 Bytes
Contents
class Eco::API::UseCases::Default::Utils::GroupCsv class Cli < Eco::API::UseCases::Cli str_desc = 'Groups the csv rows by a pivot field. ' str_desc << 'It assumes the sorting field is sorted ' str_desc << '(same values should be consecutive)' desc str_desc callback do |_session, options, _usecase| if (file = SCR.get_file(cli_name, required: true, should_exist: true)) options.deep_merge!(input: {file: {name: file}}) end end add_option("-start-at", "Get only the last N-start_at rows") do |options| count = SCR.get_arg("-start-at", with_param: true) options.deep_merge!(input: {file: {start_at: count}}) end add_option('-by', 'The column that should be used to group') do |options| if (file = SCR.get_arg("-by", with_param: true)) options.deep_merge!(input: {group_by_field: file}) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems