fileverse 0.1.5 → 0.1.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa201a13fbd4310e92d1abb0f0589a84612898af61e5971ba7c6edfa349c47b6
4
- data.tar.gz: 5896f09dd563c6df50b91cd4171a9bef539e926c36c761f3780ace0be32cfebb
3
+ metadata.gz: 5edf7aff9bcb4c6c6b9f59f9cc0b50d1413183e884aad9f38de7e2be7057eb80
4
+ data.tar.gz: 2c62e407c449f6985232d838be9d04ba3c4b50ad55658afa74c251507e5ef42f
5
5
  SHA512:
6
- metadata.gz: 118538226ff51aa2065abafb8e5a2aa09c0314756619a119e36ef09a6bbc8179085a5c7e98f8a0aa05483be0e22cfcba060afcfd7d0cd1e5789ec318f0220b09
7
- data.tar.gz: 6a487fb4a144e40aa398917d942adfae39e20608a994b0370005f8f213bd4ddd78705a69284606bc0723e8a51a31eb248ad0548022c6e708b8c5abbc9435082d
6
+ metadata.gz: 40729a548fafc408dc36a2484e151e42af3e1fd5cff309a28814c4f3e2f00da2a6ca7799b99608d6747d0135537fd2ad83979ea191b68f7f8de7b6f901867ec2
7
+ data.tar.gz: 713f376692bc057597933f737a4686aca65153b83d6ad7093617bf7782afa1a67fa54efc5a27b8dda1464198fd8f793cbcdb210b58bbd6f4358463523f314605
data/lib/fileverse/cli.rb CHANGED
@@ -34,6 +34,8 @@ module Fileverse
34
34
  @previewer.preview_content = preview_content
35
35
  Files.write_content(@path, @previewer.to_writable_lines)
36
36
  Files.write_content(@hidden_path, @parser.to_writable_lines)
37
+ rescue StandardError => e
38
+ puts e.message
37
39
  end
38
40
  map "p" => "preview"
39
41
 
@@ -79,7 +81,7 @@ module Fileverse
79
81
  Files.write_content(@path, template_content)
80
82
  end
81
83
 
82
- def preview_content
84
+ def preview_content # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
83
85
  if options[:name]
84
86
  @parser.snapshot_content_by_name(options[:name])
85
87
  elsif options[:bwd]
@@ -88,6 +90,8 @@ module Fileverse
88
90
  @parser.snapshot_content_forward
89
91
  elsif options[:index]
90
92
  @parser.snapshot_content_by_index(options[:index])
93
+ else
94
+ @parser.cursor_content
91
95
  end
92
96
  end
93
97
  end
@@ -17,10 +17,17 @@ module Fileverse
17
17
  end
18
18
  end
19
19
 
20
- # Error for invalid cursor
21
- class InvalidCursorPointer < StandardError
22
- def initialize(section = nil)
23
- super("Invalid cursor.#{section}")
20
+ # Error for negative cursor
21
+ class NegativeCursorPointer < StandardError
22
+ def initialize
23
+ super("Cursor can not be negative.")
24
+ end
25
+ end
26
+
27
+ # Error for maximum cursor
28
+ class MaxCursorPointer < StandardError
29
+ def initialize
30
+ super("Cursor can not be larger that snapped length.")
24
31
  end
25
32
  end
26
33
  end
@@ -105,7 +105,8 @@ module Fileverse
105
105
  end
106
106
 
107
107
  def cursor_content
108
- raise InvalidCursorPointer if @cursor.negative? || @cursor > @snapshots.length
108
+ raise NegativeCursorPointer if @cursor.negative?
109
+ raise MaxCursorPointer if @cursor >= @snapshots.length
109
110
 
110
111
  @snapshots[@cursor].content
111
112
  end
@@ -115,9 +116,7 @@ module Fileverse
115
116
  end
116
117
 
117
118
  def snapshot_content_by_index(index)
118
- raise InvalidCursorPointer if index.negative? || index > @snapshots.length
119
-
120
- @cursor = value
119
+ @cursor = index
121
120
  cursor_content
122
121
  end
123
122
 
@@ -173,14 +172,10 @@ module Fileverse
173
172
  end
174
173
 
175
174
  def decrement_cursor
176
- raise InvalidCursorPointer if (@cursor - 1).negative?
177
-
178
175
  @cursor -= 1
179
176
  end
180
177
 
181
178
  def increment_cursor
182
- raise InvalidCursorPointer if @cursor + 1 >= @snapshots.length
183
-
184
179
  @cursor += 1
185
180
  end
186
181
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fileverse
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fileverse
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
  - Unegbu Kingsley
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-04-16 00:00:00.000000000 Z
11
+ date: 2025-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor