filecon 0.7.2 → 0.7.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/CHANGELOG.md +7 -0
- data/README.md +6 -7
- data/bin/filecon +13 -7
- data/config.yaml +5 -2
- data/filecon.1 +6 -11
- data/lib/filecon/version.rb +1 -1
- data/lib/filecon.rb +30 -38
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d1df26a13e05bbbd9358e84639c2c0b00084ba9886a0d6e625ff70f215e02d05
|
|
4
|
+
data.tar.gz: bde313532c0862fbd2374d7e1c58be32d1a3c08eb04679220af34725436a5ab6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 59cb001046d5108727fce82ad16e7786b1eb78763bd0861153bd32d3075c674bca8cf3de2ff40ae082a411b5860547f704f3964bd93cd93e38e3729f81ffdd8e
|
|
7
|
+
data.tar.gz: 2657815430c1b069a49e7465d5510bb7e8ccb9595abcab68e66c9a805271f49e489d3ca46b790aac5102aa2819eb96f4bc3a2ff90c7a287eef84a47b40e2f0df
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## [vx.y.z] — __DATE__
|
|
4
4
|
|
|
5
|
+
## [v0.7.3] — 2026-10-30
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- All command prompts (`x` execute, the alt-edits, and `%str`) call `Typr.read_line` directly and keep their completions without any `prefixes:` config — the keys fall back to the legacy `|+=!` set
|
|
9
|
+
- `%str` prompting gains TAB completion against the shell, Up/Down command history, and `:shell` highlighting; the partial command loads as editable text and the accepted line replaces it instead of being appended to
|
|
10
|
+
- Configuration stopped layering: the bundled `config.yaml` is the base and `~/.config/filecon/config.yaml` is merged over it (nested maps merge key by key, nulls replace) — the `/etc` cascade and the standalone merge helpers (`layer`, `load_config`) are gone, replaced by one hash merge in the launcher
|
|
11
|
+
|
|
5
12
|
## [v0.7.2] — 2026-10-19
|
|
6
13
|
|
|
7
14
|
### Fixed
|
data/README.md
CHANGED
|
@@ -87,14 +87,13 @@ Command and history popups open in `/` narrow mode. Type a few characters to **n
|
|
|
87
87
|
|
|
88
88
|
### Configuration
|
|
89
89
|
|
|
90
|
-
Config
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
Config loads in two layers: the bundled `config.yaml` as the base and
|
|
91
|
+
`~/.config/filecon/config.yaml` merged on top — nested mappings merge key by
|
|
92
|
+
key, explicit nulls replace an inherited value. On first run the user file is
|
|
93
93
|
created from the bundled config with every setting commented out except a
|
|
94
94
|
live + prefix with your detected terminal — a documented template that
|
|
95
|
-
overrides nothing else until edited
|
|
96
|
-
|
|
97
|
-
deletes an inherited key. It includes:
|
|
95
|
+
overrides nothing else until edited. Delete the file to reseed the template
|
|
96
|
+
on the next launch. It includes:
|
|
98
97
|
|
|
99
98
|
- Color settings (named colors, 8-bit palette, RGB triplets, base-palette overrides) — including the `colors.commands` pair used by the command picker and status line
|
|
100
99
|
- The `e[x]ecute` prompt always tints with the `:shell` scheme (first word red, `--options` blue); the `=` output viewer uses `:generic`
|
|
@@ -111,7 +110,7 @@ State and history files live under `~/.local/share/filecon/`.
|
|
|
111
110
|
- `=` — display output in the text viewer
|
|
112
111
|
- `!` — evaluate as Ruby code
|
|
113
112
|
|
|
114
|
-
**Substitution variables:** `%name` (file path), `%dir` (directory picker), `%file` (file picker), `%cmd` (PATH executable picker), `%str` (text input)
|
|
113
|
+
**Substitution variables:** `%name` (file path), `%dir` (directory picker), `%file` (file picker), `%cmd` (PATH executable picker), `%str` (text input; TAB completes against the shell, Up/Down recalls command history)
|
|
115
114
|
|
|
116
115
|
See `filecon(1)` for the full manual.
|
|
117
116
|
|
data/bin/filecon
CHANGED
|
@@ -24,9 +24,15 @@ begin
|
|
|
24
24
|
|
|
25
25
|
parse = ->(p) { File.readlines(p).map { |l| s = l.chomp.scrub.split(",", 2); [s[0].to_i, s[1]] } rescue [] }
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
deep = ->(a, b) { b.each { |k, v|
|
|
28
|
+
v.nil? ? a.delete(k) : (Hash === v && Hash === a[k] ? a[k] = deep[a[k], v] : a[k] = v) } ; a }
|
|
29
|
+
config = deep[
|
|
30
|
+
YAML.safe_load(File.read(bundled_path), permitted_classes: [Symbol]) || {},
|
|
31
|
+
File.exist?(config_path) ?
|
|
32
|
+
YAML.safe_load(File.read(config_path), permitted_classes: [Symbol]) || {} : {}]
|
|
33
|
+
colors = config["colors"] ||= {}
|
|
28
34
|
|
|
29
|
-
Typr.init
|
|
35
|
+
Typr.init colors["default"]
|
|
30
36
|
Typr.clear
|
|
31
37
|
|
|
32
38
|
app = Filecon::App.new( right: -1, bottom: -1,
|
|
@@ -35,13 +41,13 @@ begin
|
|
|
35
41
|
path: { config: config_path, state: state_dir, dir_history: dh_path,
|
|
36
42
|
cmd_history: ch_path },
|
|
37
43
|
directory: ARGV.first || ?., keymap: { cmd_history: ?c, dir_history: ?d, recurse: ?R, open_current: ?` },
|
|
38
|
-
colors:
|
|
39
|
-
views: config["views"]
|
|
40
|
-
commands: config["commands"]
|
|
44
|
+
colors: colors,
|
|
45
|
+
views: config["views"],
|
|
46
|
+
commands: config["commands"],
|
|
41
47
|
prefixes: config["prefixes"],
|
|
42
48
|
bindings: config["bindings"],
|
|
43
|
-
max_history: config["max_history"]
|
|
44
|
-
top_history: config["top_history"]
|
|
49
|
+
max_history: config["max_history"],
|
|
50
|
+
top_history: config["top_history"],
|
|
45
51
|
filter_dirs: config["filter_dirs"] )
|
|
46
52
|
Typr.on_resize { app.show }
|
|
47
53
|
app.import_shell_history
|
data/config.yaml
CHANGED
|
@@ -181,7 +181,7 @@ commands:
|
|
|
181
181
|
run_terminal: "+%name %str"
|
|
182
182
|
|
|
183
183
|
printable:
|
|
184
|
-
edit: "+
|
|
184
|
+
edit: "+nano %name"
|
|
185
185
|
view: "=cat %name"
|
|
186
186
|
count: "|wc -l %name | cut -wf1"
|
|
187
187
|
search: "=grep -n %str %name"
|
|
@@ -249,7 +249,7 @@ commands:
|
|
|
249
249
|
|
|
250
250
|
markdown:
|
|
251
251
|
view: "=glow %name"
|
|
252
|
-
edit: "+
|
|
252
|
+
edit: "+nano %name"
|
|
253
253
|
|
|
254
254
|
json:
|
|
255
255
|
view: "=cat %name | jq ."
|
|
@@ -291,6 +291,9 @@ commands:
|
|
|
291
291
|
"font-otf":
|
|
292
292
|
view: "=fc-query %name | head -20"
|
|
293
293
|
|
|
294
|
+
"x-empty":
|
|
295
|
+
edit: "+nano %name"
|
|
296
|
+
view: "=cat %name"
|
|
294
297
|
|
|
295
298
|
# =============================================================================
|
|
296
299
|
# VIEWS
|
data/filecon.1
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.TH FILECON 1 "2026-10-
|
|
1
|
+
.TH FILECON 1 "2026-10-30" "filecon 0.7.3" "User Commands"
|
|
2
2
|
.SH NAME
|
|
3
3
|
filecon \- a file and command manager that lives between terminal and shell
|
|
4
4
|
.SH SYNOPSIS
|
|
@@ -93,23 +93,18 @@ first, then the remaining entries in most-recent order. The
|
|
|
93
93
|
setting in config.yaml (default 10) controls how many frequent entries lead
|
|
94
94
|
the list.
|
|
95
95
|
.SH CONFIGURATION
|
|
96
|
-
Configuration
|
|
96
|
+
Configuration loads in two layers: the bundled
|
|
97
97
|
.B config.yaml
|
|
98
|
-
in the installation directory,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
then the user file below.
|
|
98
|
+
in the installation directory is the base, and the user file below is
|
|
99
|
+
merged on top — nested mappings merge key by key, an explicit null
|
|
100
|
+
replaces an inherited value.
|
|
102
101
|
On first run a documented template is written to
|
|
103
102
|
.BR ~/.config/filecon/config.yaml :
|
|
104
103
|
the bundled defaults with every setting commented out except a live +
|
|
105
104
|
prefix with your detected terminal, overriding nothing else until edited.
|
|
106
|
-
|
|
107
|
-
value deletes an inherited key.
|
|
105
|
+
Delete the file to reseed the template on the next launch.
|
|
108
106
|
.SS Config File Locations
|
|
109
107
|
.TP
|
|
110
|
-
.B /etc/filecon/config.yaml
|
|
111
|
-
System-wide overrides (optional)
|
|
112
|
-
.TP
|
|
113
108
|
.B ~/.config/filecon/config.yaml
|
|
114
109
|
Main configuration (colors, commands, views)
|
|
115
110
|
.TP
|
data/lib/filecon/version.rb
CHANGED
data/lib/filecon.rb
CHANGED
|
@@ -14,31 +14,6 @@ require_relative "filecon/version"
|
|
|
14
14
|
|
|
15
15
|
module Filecon
|
|
16
16
|
|
|
17
|
-
# Layered configuration: bundled defaults < system (/etc) < user (~/.config).
|
|
18
|
-
# Merges +over+ into +base+: hashes recurse, scalars and arrays replace, an
|
|
19
|
-
# explicit null deletes an inherited key, absent keys fall through.
|
|
20
|
-
def self.layer base, over
|
|
21
|
-
over.each do |k, v|
|
|
22
|
-
if v.nil? and base.key?(k) then base.delete(k)
|
|
23
|
-
elsif v.is_a?(Hash) and base[k].is_a?(Hash) then layer(base[k], v)
|
|
24
|
-
else base[k] = v end
|
|
25
|
-
end
|
|
26
|
-
base
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Load and merge configuration layers in order; missing files are skipped.
|
|
30
|
-
# Every present layer must parse to a mapping; anything else raises naming
|
|
31
|
-
# the file, so a broken layer fails loud instead of failing deep in the
|
|
32
|
-
# merge or silently booting defaults.
|
|
33
|
-
def self.load_config *paths
|
|
34
|
-
paths.filter_map { |p|
|
|
35
|
-
next unless p and File.exist?(p)
|
|
36
|
-
cfg = YAML.safe_load(File.read(p), permitted_classes: [Symbol])
|
|
37
|
-
raise "#{p} must contain a YAML mapping, got #{cfg.class}" unless cfg.nil? or cfg.is_a?(Hash)
|
|
38
|
-
cfg
|
|
39
|
-
}.reduce({}) { |merged, cfg| layer(merged, cfg || {}) }
|
|
40
|
-
end
|
|
41
|
-
|
|
42
17
|
# Documented template: every setting commented out, docs kept — except one
|
|
43
18
|
# live + prefix with the detected terminal, so windowed commands work out
|
|
44
19
|
# of the box. Parses to just that override until edited. -e flags ride on
|
|
@@ -103,10 +78,16 @@ class Filecon::App < Typr::Browser
|
|
|
103
78
|
end
|
|
104
79
|
end
|
|
105
80
|
|
|
81
|
+
# Command-start characters for the line prompts: the configured +prefixes:
|
|
82
|
+
# keys, or the legacy +|+=!-+ default when none are configured.
|
|
83
|
+
|
|
84
|
+
def prefixes; @prefixes&.keys&.join || "|+=!" end
|
|
85
|
+
|
|
106
86
|
def execute
|
|
107
|
-
cmd = @user.
|
|
108
|
-
|
|
109
|
-
|
|
87
|
+
cmd = Typr.read_line(color_code(@user.colors[:default]) + "> " +
|
|
88
|
+
color_code(@user.colors[:answer]), left: @user.left, top: @user.top,
|
|
89
|
+
redraw: method(:show), history: @cmd_history.map { |_, cmd| cmd },
|
|
90
|
+
prefixes: prefixes, regex: :shell)
|
|
110
91
|
return unless cmd
|
|
111
92
|
dispatch cmd
|
|
112
93
|
end
|
|
@@ -187,8 +168,10 @@ class Filecon::App < Typr::Browser
|
|
|
187
168
|
cmd = build pair.last, id, pair.first
|
|
188
169
|
return unless cmd
|
|
189
170
|
if alt
|
|
190
|
-
edited = @user.
|
|
191
|
-
|
|
171
|
+
edited = Typr.read_line(color_code(@user.colors[:default]) + "> " +
|
|
172
|
+
color_code(@user.colors[:answer]), left: @user.left, top: @user.top,
|
|
173
|
+
initial: cmd, redraw: method(:show),
|
|
174
|
+
regex: @user.colors[:regex], prefixes: prefixes)
|
|
192
175
|
return unless edited
|
|
193
176
|
cmd = build(edited, id, pair.first)
|
|
194
177
|
return unless cmd
|
|
@@ -376,10 +359,14 @@ class Filecon::App < Typr::Browser
|
|
|
376
359
|
esc = cmd[0] == ?! ? /[\\"$#]/ : /[\\"$`]/
|
|
377
360
|
cmd += ?" + result.gsub(esc){ |m| "\\#{m}" } + ?"
|
|
378
361
|
when '%str'
|
|
379
|
-
|
|
380
|
-
query =
|
|
362
|
+
initial = cmd.empty? || cmd.end_with?( ' ' ) ? cmd : "#{cmd} "
|
|
363
|
+
query = Typr.read_line(reset + "> " + prefix +
|
|
364
|
+
color_code( @colors[:answer] ), left: @user.left, top: @user.top,
|
|
365
|
+
initial: initial, redraw: method(:show),
|
|
366
|
+
history: @cmd_history.map { |_, c| c },
|
|
367
|
+
prefixes: prefixes, regex: :shell)
|
|
381
368
|
return unless query
|
|
382
|
-
cmd
|
|
369
|
+
cmd = query
|
|
383
370
|
end
|
|
384
371
|
str = post
|
|
385
372
|
end
|
|
@@ -524,8 +511,10 @@ class Filecon::App < Typr::Browser
|
|
|
524
511
|
|
|
525
512
|
entry = ordered[n][1]
|
|
526
513
|
if is_cmd and picker.modifier == :alt
|
|
527
|
-
edited = @user.
|
|
528
|
-
|
|
514
|
+
edited = Typr.read_line(color_code(@user.colors[:default]) + "> " +
|
|
515
|
+
color_code(@user.colors[:answer]), left: @user.left, top: @user.top,
|
|
516
|
+
initial: entry, redraw: -> { picker.show },
|
|
517
|
+
regex: @user.colors[:regex], prefixes: prefixes)
|
|
529
518
|
return unless edited
|
|
530
519
|
entry = build(edited, nil)
|
|
531
520
|
return unless entry
|
|
@@ -644,8 +633,8 @@ class Filecon::App < Typr::Browser
|
|
|
644
633
|
" entries first, then the rest in most-recent order. The top_history\n" \
|
|
645
634
|
" setting in config.yaml (default 10) controls how many most-used entries\n" \
|
|
646
635
|
" lead the list. In command history, Alt+number edits the picked entry instead of running it.\n\n" \
|
|
647
|
-
"#{y}CONFIG:#{d}\n ~/.config/filecon/config.yaml\n
|
|
648
|
-
" (
|
|
636
|
+
"#{y}CONFIG:#{d}\n ~/.config/filecon/config.yaml\n" \
|
|
637
|
+
" (your settings override the bundled defaults)\n",
|
|
649
638
|
top: 2, right: -2, bottom: -3,
|
|
650
639
|
colors: { border: @colors[:border] },
|
|
651
640
|
border: :round )
|
|
@@ -680,10 +669,13 @@ class Filecon::App < Typr::Browser
|
|
|
680
669
|
$palette = @colors.filter_map { |k, v|
|
|
681
670
|
[k.to_sym, v] if %i[black red green yellow blue magenta cyan white].include?(k.to_s.to_sym) }.to_h
|
|
682
671
|
@rawsort[NAME] = false
|
|
672
|
+
@colors ||= {}
|
|
683
673
|
@cmd_history ||= []
|
|
684
674
|
@dir_history ||= []
|
|
685
675
|
@path ||= {}
|
|
686
|
-
@
|
|
676
|
+
@views ||= {}
|
|
677
|
+
@commands ||= {}
|
|
678
|
+
@top_history = args[:top_history]
|
|
687
679
|
@user.reset
|
|
688
680
|
end
|
|
689
681
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: filecon
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kilian Reitmayr
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-10-
|
|
10
|
+
date: 2026-10-30 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: typr
|