sycsvpro 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sycsvpro (0.1.11)
4
+ sycsvpro (0.1.12)
5
5
  gli (= 2.9.0)
6
6
  timeleap (~> 0.0.1)
7
7
 
data/bin/sycsvpro CHANGED
@@ -89,6 +89,38 @@ command :extract do |c|
89
89
  end
90
90
  end
91
91
 
92
+ desc 'Remove duplicate rows from a file. Duplicates are identified by key '+
93
+ 'columns'
94
+ command :unique do |c|
95
+ c.desc 'Rows to consider'
96
+ c.arg_name '1,2,10-30,45-EOF,REGEXP,BEGINlogical_expressionEND'
97
+ c.flag [:r, :row], :must_match => row_regex
98
+
99
+ c.desc 'Columns to extract'
100
+ c.arg_name '1,2,10-30'
101
+ c.flag [:c, :col], :must_match => /\d+(?:,\d+|-\d+)*/
102
+
103
+ c.desc 'Key columns to check for duplication'
104
+ c.arg_name '0,1-4'
105
+ c.flag [:k, :key]
106
+
107
+ c.desc 'Format of date values'
108
+ c.arg_name '%d.%m.%Y|%m/%d/%Y|...'
109
+ c.flag [:df]
110
+
111
+ c.action do |global_options,options,args|
112
+ print "Removing duplicates ..."
113
+ unique = Sycsvpro::Unique.new(infile: global_options[:f],
114
+ outfile: global_options[:o],
115
+ rows: options[:r],
116
+ cols: options[:c],
117
+ key: options[:k],
118
+ df: options[:df])
119
+ unique.execute
120
+ puts "done"
121
+ end
122
+ end
123
+
92
124
  desc 'Collect values of specified rows and columns from the file and group '+
93
125
  'them in categories'
94
126
  command :collect do |c|
@@ -411,6 +443,7 @@ command :join do |c|
411
443
  c.flag [:i, :insert]
412
444
 
413
445
  c.action do |global_options,options,args|
446
+ print 'Joining...'
414
447
  join = Sycsvpro::Join.new(infile: global_options[:f],
415
448
  outfile: global_options[:o],
416
449
  source: args[0],
@@ -421,7 +454,6 @@ command :join do |c|
421
454
  headerless: options[:headerless],
422
455
  header: options[:h],
423
456
  insert_header: options[:i])
424
- print 'Joining...'
425
457
  join.execute
426
458
  print 'done'
427
459
  end
data/lib/sycsvpro.rb CHANGED
@@ -16,3 +16,4 @@ require 'sycsvpro/aggregator.rb'
16
16
  require 'sycsvpro/table.rb'
17
17
  require 'sycsvpro/join.rb'
18
18
  require 'sycsvpro/merger.rb'
19
+ require 'sycsvpro/unique.rb'
@@ -1,5 +1,5 @@
1
1
  # Operating csv files
2
2
  module Sycsvpro
3
3
  # Version number of sycsvpro
4
- VERSION = '0.1.11'
4
+ VERSION = '0.1.12'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sycsvpro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: