csv-editor 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd5c303e0caeb77eb22d4cf57b9ca6126306c11de9a5e34cd1a9708d5501afa3
4
- data.tar.gz: 11a15413cdabf43c0fac5b15ffc1d061ca28f3a411fc86d909e167374ed9310c
3
+ metadata.gz: 5dc5b463659219fefa46cf93805d645740d23fe016c9b76ee10a5df3cc6fbe00
4
+ data.tar.gz: ddf9178a309ae367664ac576601486c5b5c0bdc7ffad1a3440af2106b6337748
5
5
  SHA512:
6
- metadata.gz: '08bc45ac87edbc4d21b2a9979e809224a9a49bc1e44e3ecf65724c316953382673b04bcc4652cc51bbd191df65ebc8e60d3abf644b83709b761683fe8582da50'
7
- data.tar.gz: ec89e515578517eb8f1f1ee9632982bb66532b65c08a2efb96a6291ed89154614e0d911d3da78dae7a1ebaba089ae27dfea33b2ed36f12c4cb346b49bd66fccb
6
+ metadata.gz: 7f8b486c8b88766294bae6f933ddbb758e667f665dfe8488a51be01eb0daad933fee4fb0c1e59e444f014cbff06269d4f97077cdc0a36ba837e8762a7d92f68e
7
+ data.tar.gz: 455fdb05b2649aeec93ec9572346afab0d29ab8751de024ec8a873b9a15f22493a88160f508823b1bc467075ee3ed8696c49ce9330868cfc8a467d8cd88008e1
data/bin/csv-edit CHANGED
@@ -14,6 +14,8 @@ require 'io/console'
14
14
  csv_file = ARGV[0]
15
15
  raise("#{csv_file} not found") unless File.exist?(csv_file)
16
16
 
17
+ PER_PAGE = (ARGV[1] || 11).to_i
18
+
17
19
  def screen_width
18
20
  @screen_width ||= (IO.console.winsize[1] - 10)
19
21
  end
@@ -59,7 +61,7 @@ def pick_csv_row(prompt, rows, starting_row_idx, max_rows_to_display=100_000)
59
61
  break if choices.size > max_rows_to_display
60
62
  end
61
63
 
62
- prompt.select(('Pick row to edit'), choices)
64
+ prompt.select(('Pick row to edit'), choices, per_page: PER_PAGE)
63
65
  end
64
66
 
65
67
  def edit_row(prompt, row)
@@ -72,7 +74,7 @@ def edit_row(prompt, row)
72
74
  choices << {name: name, value: column_name}
73
75
  end
74
76
 
75
- choice = prompt.select('Edit?', choices)
77
+ choice = prompt.select('Edit?', choices, per_page: PER_PAGE)
76
78
  if choice == true
77
79
  done = true
78
80
  break
data/bin/csv-edit-row CHANGED
@@ -16,6 +16,8 @@ row_number = ARGV[1].to_i
16
16
  raise("#{csv_file} not found") unless File.exist?(csv_file)
17
17
  raise("CSV row number not specified") unless row_number >= 0
18
18
 
19
+ PER_PAGE = (ARGV[2] || 11).to_i
20
+
19
21
  csv_iterator = CSVUtils::CSVIterator.new(csv_file)
20
22
  raise("CSV row number exceeds max rows") if row_number > csv_iterator.size
21
23
 
@@ -61,7 +63,7 @@ while true
61
63
  choices << {name: name, value: column_name}
62
64
  end
63
65
 
64
- choice = prompt.select((row_number == 0 ? 'Add?' : 'Edit?'), choices)
66
+ choice = prompt.select((row_number == 0 ? 'Add?' : 'Edit?'), choices, per_page: PER_PAGE)
65
67
  new_value = prompt.ask("#{choice}: ", value: row[choice].to_s)
66
68
 
67
69
  row[choice] = new_value
data/csv-editor.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'csv-editor'
5
- s.version = '0.1.5'
5
+ s.version = '0.1.6'
6
6
  s.licenses = ['MIT']
7
7
  s.summary = 'CSV Editor'
8
8
  s.description = 'Command line CSV file editor'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csv-editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-06 00:00:00.000000000 Z
11
+ date: 2024-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: csv-utils
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  requirements: []
76
- rubygems_version: 3.2.3
76
+ rubygems_version: 3.5.3
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: CSV Editor