fatty 0.99.8.1 → 0.99.8.3
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 +4 -4
- data/lib/fatty/config.rb +49 -1
- data/lib/fatty/config_files/themes/cyberpunk.yml +1 -1
- data/lib/fatty/curses/context.rb +1 -0
- data/lib/fatty/log_formats/json.rb +1 -1
- data/lib/fatty/log_formats/text.rb +1 -2
- data/lib/fatty/renderer/curses.rb +6 -0
- data/lib/fatty/renderer.rb +4 -0
- data/lib/fatty/session/output_session.rb +3 -2
- data/lib/fatty/themes/manager.rb +2 -0
- data/lib/fatty/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f79cba23bcf8b408c343c3c732d0af6e93bdf677f3492838f3e1a16473bc05fd
|
|
4
|
+
data.tar.gz: f3c72c60150347df09d4f8f17238566c78c4ade01bd33b73dffe3db48f462f24
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a181c65be329a3e0ba0e4084538cee20f25f8250c98e764c9f60ededa9c95af7bda619f28a7ed54d747bbb46efb78ec5460a84263fb5ce4efdf2ba0f2b496e20
|
|
7
|
+
data.tar.gz: abafce8dfdfa7446f229b2742b2de1cf9adcfae99e41fb66348e766153efa971bcf13de6239eef5ef2843258381bb6da268f806b2c389fa729a62a5b1703db94
|
data/lib/fatty/config.rb
CHANGED
|
@@ -148,6 +148,35 @@ module Fatty
|
|
|
148
148
|
File.join(app_user_config_dir, "#{name}.yml")
|
|
149
149
|
end
|
|
150
150
|
|
|
151
|
+
# Persist a user-adjustable preference in the current application's config
|
|
152
|
+
# file. Preferences are kept in the app layer so applications using Fatty
|
|
153
|
+
# do not overwrite one another's selections. When no app layer is
|
|
154
|
+
# configured, use Fatty's global user config.
|
|
155
|
+
def self.set_preference(name, value)
|
|
156
|
+
path = app_config_path || File.join(user_config_dir, "config.yml")
|
|
157
|
+
|
|
158
|
+
config = if app_config_path
|
|
159
|
+
read_app("config")
|
|
160
|
+
elsif File.exist?(path)
|
|
161
|
+
YAML.safe_load_file(
|
|
162
|
+
path,
|
|
163
|
+
aliases: true,
|
|
164
|
+
permitted_classes: [Date, DateTime, Time],
|
|
165
|
+
symbolize_names: true,
|
|
166
|
+
) || {}
|
|
167
|
+
else
|
|
168
|
+
{}
|
|
169
|
+
end
|
|
170
|
+
config[name.to_sym] = value
|
|
171
|
+
FileUtils.mkdir_p(File.dirname(path))
|
|
172
|
+
File.write(path, YAML.dump(yaml_safe_value(config)))
|
|
173
|
+
reset_reader!
|
|
174
|
+
true
|
|
175
|
+
rescue StandardError => e
|
|
176
|
+
Fatty.warn("Could not save preference #{name.inspect}: #{e.class}: #{e.message}", tag: :config)
|
|
177
|
+
false
|
|
178
|
+
end
|
|
179
|
+
|
|
151
180
|
# The per-app themes directory, either under
|
|
152
181
|
# ~/.config/fatty/apps/<app_name>/themes (by default) or under the themes
|
|
153
182
|
# directory in the config directory the library consumer sets in
|
|
@@ -216,7 +245,12 @@ module Fatty
|
|
|
216
245
|
return {} unless path
|
|
217
246
|
return {} unless File.exist?(path)
|
|
218
247
|
|
|
219
|
-
YAML.
|
|
248
|
+
YAML.safe_load_file(
|
|
249
|
+
path,
|
|
250
|
+
aliases: true,
|
|
251
|
+
permitted_classes: [Date, DateTime, Time],
|
|
252
|
+
symbolize_names: true,
|
|
253
|
+
) || {}
|
|
220
254
|
end
|
|
221
255
|
|
|
222
256
|
def self.merge_config(base, overlay)
|
|
@@ -256,6 +290,19 @@ module Fatty
|
|
|
256
290
|
value || {}
|
|
257
291
|
end
|
|
258
292
|
|
|
293
|
+
def self.yaml_safe_value(value)
|
|
294
|
+
case value
|
|
295
|
+
when Hash
|
|
296
|
+
value.to_h { |key, item| [key.to_s, yaml_safe_value(item)] }
|
|
297
|
+
when Array
|
|
298
|
+
value.map { |item| yaml_safe_value(item) }
|
|
299
|
+
when Symbol
|
|
300
|
+
value.to_s
|
|
301
|
+
else
|
|
302
|
+
value
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
|
|
259
306
|
def self.normalize_app_name(name)
|
|
260
307
|
text = name.to_s.strip
|
|
261
308
|
text.empty? ? nil : text
|
|
@@ -269,6 +316,7 @@ module Fatty
|
|
|
269
316
|
private_class_method :merge_config
|
|
270
317
|
private_class_method :blank_config?
|
|
271
318
|
private_class_method :normalize_config_value
|
|
319
|
+
private_class_method :yaml_safe_value
|
|
272
320
|
private_class_method :normalize_app_name
|
|
273
321
|
end
|
|
274
322
|
end
|
data/lib/fatty/curses/context.rb
CHANGED
data/lib/fatty/renderer.rb
CHANGED
|
@@ -80,6 +80,7 @@ module Fatty
|
|
|
80
80
|
[]
|
|
81
81
|
when :clear
|
|
82
82
|
reset_output!
|
|
83
|
+
renderer.clear_physical_screen!
|
|
83
84
|
[]
|
|
84
85
|
when :resize
|
|
85
86
|
resize_output!
|
|
@@ -254,9 +255,9 @@ module Fatty
|
|
|
254
255
|
def visible_lines
|
|
255
256
|
@visible_lines ||=
|
|
256
257
|
if narrowed?
|
|
257
|
-
terms = narrow_query.split
|
|
258
|
+
terms = narrow_query.downcase.split
|
|
258
259
|
output.lines.each_with_index.filter_map do |text, index|
|
|
259
|
-
visible_text = visible_output_text(text)
|
|
260
|
+
visible_text = visible_output_text(text).downcase
|
|
260
261
|
next unless terms.all? { |term| visible_text.include?(term) }
|
|
261
262
|
|
|
262
263
|
VisibleLine.new(
|
data/lib/fatty/themes/manager.rb
CHANGED
data/lib/fatty/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fatty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.99.8.
|
|
4
|
+
version: 0.99.8.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel E. Doherty
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-09-08 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: curses
|
|
@@ -263,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
263
263
|
- !ruby/object:Gem::Version
|
|
264
264
|
version: '0'
|
|
265
265
|
requirements: []
|
|
266
|
-
rubygems_version:
|
|
266
|
+
rubygems_version: 3.6.2
|
|
267
267
|
specification_version: 4
|
|
268
268
|
summary: Stateful terminal UI with editable input and scrollback
|
|
269
269
|
test_files: []
|