filecon 0.3.0 → 0.4.1
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 +158 -0
- data/README.md +3 -10
- data/config.yaml +9 -9
- data/lib/filecon/version.rb +1 -1
- data/lib/filecon.rb +74 -41
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f07add892511a6e097e0179f4cef51dc07b63472130a1e346c92384472dfb3d
|
|
4
|
+
data.tar.gz: 6fa89d833523b2adc8b86fa0f2bee7f5ce0b9077d86d0cf66d181931f60f8081
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 43c10e4395a6e444ddd831ce98034864706b6be2e380b0d62ed58be4a6ff6d57b49397b12771fe6dad9d785c04df4638c7d0b77c4a104a7971da9fabdb8c8879
|
|
7
|
+
data.tar.gz: abfcb1c4db8a0ab38f3108469c048c7ca2566d18dd30dfb4212d8edbf03e171da52a0750dc36cc4df2c77233a475897c81f6bce954157f254864bd7c63f05491
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [v0.4.1] — 2026-09-11
|
|
4
|
+
|
|
5
|
+
## [v0.4.0] — 2026-09-05
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Shell TAB completion in the command editor — alt+hint opens the edit line with live completions from the shell's completion system, shown in a pickable grid above the input
|
|
9
|
+
- Clickable bottom bar and head — clicking a binding label on the status line runs that action, and clicking the filter/sort/views columns of the head opens the corresponding popup
|
|
10
|
+
- Two-pane help — `h` shows the clickable keybinding grid (the line's `list`) beside the help text; Filecon composes the HELP panel itself, mirrors wheel/arrow navigation to both panels, and clicking a binding row returns its trigger key
|
|
11
|
+
- Clicking outside a popup dismisses it — a click on empty space cancels the command, history, or filter/sort/views picker just like Escape, and the two-pane help closes on a click outside both panes
|
|
12
|
+
- Colored help titles — the FILECON, HINTS, COMMANDS, CONFIG headings and the KEYBINDINGS grid header are yellow; the redundant HELP text header is removed
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- The mouse wheel scrolls the command, history, and filter/sort/views popups — previously the live filter reapplied itself after each wheel tick and snapped the list back to the top
|
|
16
|
+
- The colored `[f]ilter`/`[s]ort`/`[v]iews` bindings on the bottom bar now react to clicks — the trigger-key extraction no longer trips on their ANSI color codes
|
|
17
|
+
- The filter/sort/views columns on the head open their popups when clicked in a real terminal — the head row now matches the 1-based mouse coordinates
|
|
18
|
+
- Clicking the bottom bar binds to the row above it — the clickable row check now uses 1-based mouse coordinates, so bindings activate where they are rendered
|
|
19
|
+
- Clicking a keybinding row in the two-pane help no longer crashes — the clicked row now maps to the line's binding labels (`@user.bindings`) instead of an undefined App `@bindings`, so the trigger key is returned and dispatched
|
|
20
|
+
- `cd` owns the path column flag — array `cd` sets `@show_path` (single dirs clear it), so `reset_view` preserves the path listing after `execute`/`recurse` instead of dropping it; `recurse` just builds the recursive directory array and delegates the loading to `cd`
|
|
21
|
+
- Array `cd` fills the path column after the full load — previously only the first directory's rows got values (the rest stayed blank on `reset_view`), and custom Hash views dropped the column entirely; the trailing `change_view` now runs once on complete data, and computed views keep PATH too
|
|
22
|
+
- Clickable header path — left-clicking the username goes home and each directory segment navigates there, while right-click opens the command list for that path without leaving the current directory
|
|
23
|
+
- Alt+click opens the command list — Alt+left-click on a row or header path behaves like right-click, for touchscreens where right-click is hard to send (Termux)
|
|
24
|
+
- Failed `cd` keeps history and the path flag — directory history, selection clearing, and `@show_path` only commit after a successful navigation, and array loads skip unreadable entries up front
|
|
25
|
+
- A binding picked in help now runs — `fly` re-dispatches a String return from `send` (as it already did for mouse clicks), so pressing `h` and clicking e.g. `[R]ecurse` executes that action instead of just closing the help page
|
|
26
|
+
- The help text panel sits flush with the terminal edge — the text panel's `right: -2` border now draws on the last column, matching the browser edge; the previous inset was caused by an off-by-one in the `draw_border` guard
|
|
27
|
+
|
|
28
|
+
## [v0.3.0] — 2026-08-15
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
- New `%cmd` substitution — lists the PATH, picks an executable, and inserts its path; the listing is left and the original directory restored afterwards
|
|
32
|
+
- Alt + hint digit in the command and cmd-history popups puts the picked command into a `read_line` for editing before it runs (dir-history entries are not edited); the command popup resolves its `%name`/`%dir`/`%file`/`%str` substitutions before the resulting command is offered for editing
|
|
33
|
+
- Alt + number in the main view opens the command list for the hinted file (replacing the `o` action)
|
|
34
|
+
- Right-click in the main view opens the command list for the clicked file — mirroring Alt+number, with left-click still running the default action
|
|
35
|
+
- Return with marked files (`m`) opens their command list — replacing the `o` action's multi-select behaviour, now reachable through the default confirm key
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
- `%dir` picking relies on typr's `pick :directory` to confirm the current directory with Return — the `@pick_dir` state is gone, and `%dir`/`%file`/`%cmd` share one substitution branch
|
|
39
|
+
- Renamed the view-switching method to `change_view` (was `switch_to`), matching the clearer typr naming — keybinding, popup, and specs updated
|
|
40
|
+
- Removed the `o` key action — the command list for a file is now opened with Alt+number
|
|
41
|
+
- Shell-generated custom view columns are passed through `coerce_type`, so numeric output (e.g. `wc` counts) sorts and displays numerically
|
|
42
|
+
- Custom view shell output is stripped before display, so trailing newlines no longer yield a trailing `|` in multi-line columns
|
|
43
|
+
- Dropped the now-redundant `hints: "1234567890"` overrides from the command and history popups — digits-only hints are the typr default
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
- `%dir` substitution pickers confirm the current directory with Return again — the Return-marked-files action only applies outside substitution mode
|
|
47
|
+
- The file list is redrawn immediately while a `|` command's output is shown — the command picker popup no longer stays on screen behind the statusline, and the statusline keeps showing the command after it returns
|
|
48
|
+
- Per-MIME-type row colors stay correct after deleting a file — `delete_row` now reindexes the `@colors[:fields]` keys together with `@map`, so rows below the deletion no longer show the previous row's color until `[r]eset`
|
|
49
|
+
- PTY driver no longer garbles or hangs — the screen decoder holds partial multi-byte UTF-8 across read chunks (box-drawing glyphs render intact), clamps the cursor to the terminal grid and caps the raw log so the rendered screen stays bounded, key resends ignore a dead pty instead of raising, and `quit` escalates `ESC` → `TERM` → `KILL` so it always reaps the app
|
|
50
|
+
- Spec cleanup — `picker_double`, `test_id`, `with_path`, and `with_cmd_target` helpers removed the grid-picker and id-lookup boilerplate, and duplicated `#change_view`, `#history`, `%cmd`, and colored `%dir`/`%file` examples were merged into looping specs
|
|
51
|
+
|
|
52
|
+
## [v0.2.1] — 2026-08-03
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
- Mouse support in `fly` — click a row to open it in its default app, wheel up/down scrolls the listing (requires typr `~> 1.3` mouse reporting, enabled by `Typr.init`)
|
|
56
|
+
- PTY integration driver — `spec/integration/pty_driver.rb` is an expect-style smoke suite that spawns the real `bin/filecon` on a pseudo-terminal, drives it with keystrokes, and asserts on the rendered screen; run as part of `rake test` (or manually via `ruby spec/integration/pty_driver.rb`, with `--interactive` for a live probe and `--keep` to retain temp fixtures)
|
|
57
|
+
|
|
58
|
+
## [v0.2.0] — 2026-08-02
|
|
59
|
+
|
|
60
|
+
### Added
|
|
61
|
+
- `executable` command category — `commands:` entries under `executable:` (`run`, `run_terminal`) are added to the `open_file` picker ahead of `default` whenever the selected file(s) have the executable bit set, regardless of MIME type; multi-select adds them only when every selection is executable
|
|
62
|
+
- `execute` command (`x`, `e[x]ecute`) — lists every executable from all `$PATH` directories in the main view, with a `path` column showing each binary's containing directory
|
|
63
|
+
- `open_current` (`` ` ``) — opens the directory under the cursor in its default app
|
|
64
|
+
- Full-path filenames: `cd` stores absolute paths in `@data`; `@procs[NAME]` displays basenames via `File.basename`; `build` uses `@data[id][NAME]` directly (no `@directory` prefix)
|
|
65
|
+
- `@directory` accepts an Array (for multi-path listings like `execute`); `draw` joins Array entries with `": "` for the status display
|
|
66
|
+
- `frequency_limit` config var (default 10) — only the top N most-used entries get frequency coloring in history popups, listed frequency-first then most-recent
|
|
67
|
+
- `filter_dirs` config flag (default true) — active filters also hide directories that don't match
|
|
68
|
+
- Shell history importer — `import_shell_history` reads `~/.bash_history`/`~/.zsh_history` once at startup, validates commands against `$PATH` and built-ins, resolves aliases from `.zshrc`/`.bashrc`, and merges new entries into `cmd_history`; a `shell_sync` flag in the state dir prevents re-import
|
|
69
|
+
- `open_file` status line now shows the picked command name first in `colors.commands` colors — `> name:display : output` (name in `colors.commands[0]`, the built command in `colors.commands[1]`; default `["green", "red"]`); the command picker popup uses the same configurable colors
|
|
70
|
+
- `build` prompts for `%dir`/`%file`/`%str` prepend the colored command `name:` prefix, so the partial command stays identifiable while being filled in
|
|
71
|
+
- `term_hold` config — hold flag appended to `@term` at init (e.g. `foot --hold`)
|
|
72
|
+
|
|
73
|
+
### Changed
|
|
74
|
+
- Config location moved to `~/.config/filecon/config.yaml` — on first run the bundled `config.yaml` is copied there; state/history remain under `~/.local/share/filecon/`; string-keyed `colors:` settings (as loaded from YAML) are now honored
|
|
75
|
+
- `binaries` → `execute` (`x`), reset restored to `[r]eset`, recurse brought back as `[R]ecurse`
|
|
76
|
+
- `recurse` restored to `cd`-based appends (absolute paths), adding a `path` column (`Typr::PATH`) before the filename via a shared `add_path_column` helper
|
|
77
|
+
- `%str` substitution uses the shared `Typr.read_line` editor (renamed from `Typr.edit`): arrow/ctrl-arrow word jumps, in-place editing, Escape aborts the whole command
|
|
78
|
+
- Adapted to typr API renames: `Typr.read` → `read_key`, `Typr.edit` → `read_line`, frontend `show` → `draw` / widget render `draw` → `show`
|
|
79
|
+
- History storage: `@history`/`@frequency` ivars and the separate frequency files replaced with flat `@cmd_history`/`@dir_history` arrays of `[count, entry]` pairs managed by a `record` helper; file format is `count,entry` per line
|
|
80
|
+
- `run` executes unprefixed commands (e.g. from imported shell history) in a terminal window instead of doing nothing; the shell-history import skips `cd`/`pushd` entries (their directory targets still land in `dir_history`)
|
|
81
|
+
- Config command templates restructured (explicit `%str` args, image view alias)
|
|
82
|
+
- `[H]idden_files` binding moved after `[~]:home`; backtick dispatches through `Stack#send` as `open_current`
|
|
83
|
+
- Runtime dependency on typr raised to `~> 1.2` (requires the `read_key`/`read_line` API)
|
|
84
|
+
|
|
85
|
+
### Removed
|
|
86
|
+
- `Filecon::PATH` constant — paths consolidated into a `@path` hash (`:config`, `:state`, `:dir_history`, `:cmd_history`)
|
|
87
|
+
- Separate `cmd_frequency`/`dir_frequency` files (merged into the `[count, entry]` history pairs)
|
|
88
|
+
|
|
89
|
+
### Fixed
|
|
90
|
+
- `Grid#sort` used `ids` (which returns `@map` when set), so rows appended by subsequent `$PATH` dirs were invisible — now uses the full row range
|
|
91
|
+
- `cd` Array branch: missing `Dir.chdir(d)` and stale `@directory` before each append `super`, causing procs to resolve relative to the wrong directory
|
|
92
|
+
- `history`: `each_with_index.each_with_object` misrouted the memo block parameter (`fields[[i,0]] = ...` raised `NoMethodError`)
|
|
93
|
+
- `import_shell_history`: `shell_sync` was never written because the `added` flag checked `@cmd_history` after `record` already inserted; every occurrence now increments frequency, and the resolved command text (not the alias name) is stored
|
|
94
|
+
- `open_file` executable-category check skips when no row is selected (`open_current` with a nil id) instead of crashing on `@data[nil]`
|
|
95
|
+
- `recurse` no longer leaks hidden directory contents past the basename-only check
|
|
96
|
+
- `open_file` command picker keeps a fixed height derived from its full command list, so live-filter redraws don't resize/jump the popup
|
|
97
|
+
- History and command-picker popups scroll with arrow keys again — PageUp/PageDown/Home/End and TAB hint cycling are no longer swallowed by the line editor
|
|
98
|
+
- `Stack#send` keymap dispatch only normalizes printable ASCII keys, preserving control characters for correct key matching
|
|
99
|
+
- History popups show frequency entries with a grey background and `:brown` dir foreground; `du`/`wc`/`whatis` outputs trimmed of the trailing filename
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## [v0.1.2] — 2026-07-28
|
|
104
|
+
|
|
105
|
+
### Added
|
|
106
|
+
- Help page with keybindings and description (`h` key)
|
|
107
|
+
- Terminal resize handler (`Typr.on_resize`)
|
|
108
|
+
- `new_file` and `new_dir` commands for directories
|
|
109
|
+
- `count` view (chars, words, lines) replaces `lines` view
|
|
110
|
+
- `open_file` accepts optional `types` parameter for filtered command resolution
|
|
111
|
+
- `build` handles nil `id` for directory-level commands (backtick)
|
|
112
|
+
|
|
113
|
+
### Changed
|
|
114
|
+
- Help page: simplified layout with proper positioning
|
|
115
|
+
- Backtick key opens commands for current directory instead of navigating to root
|
|
116
|
+
- `open_file`: pipe output displayed in status line instead of fork; `+` commands run directly (no terminal spawn)
|
|
117
|
+
- `run` uses instance vars `@cmd_history_path`, `@max_history` instead of module methods
|
|
118
|
+
- Setup code moved from `Filecon` module into `bin/filecon`
|
|
119
|
+
- `Filecon` module: removed `setup_config`, `deep_symbolize_keys`, `config`, `dir_history_path`, `cmd_history_path` — only `PATH` and `VERSION` remain
|
|
120
|
+
- Config uses string keys (no deep symbolization)
|
|
121
|
+
- Rakefile: cleaned to standard targets (build, clean, test, release)
|
|
122
|
+
- config.yaml: `copy` command uses pipe instead of terminal; `lines` view → `count`
|
|
123
|
+
- Man page: full rewrite — Typr references, YAML config, new keybinding docs
|
|
124
|
+
- README updated for YAML config, command prefixes, substitution variables
|
|
125
|
+
- Specs updated for new API (string keys, constructor args)
|
|
126
|
+
|
|
127
|
+
### Fixed
|
|
128
|
+
- Constant redefinition warnings in tests
|
|
129
|
+
- Removed bundler dependency (Gemfile, Gemfile.lock)
|
|
130
|
+
|
|
131
|
+
## [v0.1.1] — 2026-07-27
|
|
132
|
+
|
|
133
|
+
### Added
|
|
134
|
+
- Error logging to `/tmp/filecon.log` for debugging crashes
|
|
135
|
+
- Fallback to `$TERM` when terminal config is missing
|
|
136
|
+
|
|
137
|
+
### Changed
|
|
138
|
+
- Switched configuration format from TOML to YAML
|
|
139
|
+
- Simplified command execution: only `!` (Ruby eval) and shell commands (`|`, `+`, `=`)
|
|
140
|
+
- Config keys are now strings (no deep symbolization needed)
|
|
141
|
+
- Inlined setup code into `bin/filecon`, stripped `Filecon` module to `PATH` and `VERSION`
|
|
142
|
+
- Require strategy: `require_relative` for development, gem fallback for installed use
|
|
143
|
+
- Restructured as a proper Ruby gem with `bin/filecon` entry point
|
|
144
|
+
|
|
145
|
+
### Fixed
|
|
146
|
+
- Relative paths in `lib/filecon.rb`
|
|
147
|
+
- `config.yaml` `colors.default` structure
|
|
148
|
+
- Removed obsolete root-level script and config files
|
|
149
|
+
- Updated all links to Codeberg (`typr/filecon`, `typr/typr`)
|
|
150
|
+
|
|
151
|
+
## [v0.1.0] — 2026-07-20
|
|
152
|
+
|
|
153
|
+
### Added
|
|
154
|
+
- Initial release: terminal file manager with MIME-type detection
|
|
155
|
+
- Directory and command history
|
|
156
|
+
- Customizable views, keybindings, and colors
|
|
157
|
+
- Configurable command execution with `%name`, `%dir`, `%file`, `%str` substitutions
|
|
158
|
+
- Built on the Typr terminal UI toolkit
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Description
|
|
6
6
|
|
|
7
|
-
Filecon is a terminal-based file manager built on the [Typr](https://codeberg.org/typr/typr) terminal UI toolkit.
|
|
7
|
+
Filecon is a terminal-based file manager built on the [Typr](https://codeberg.org/typr/typr) terminal UI toolkit. Every file, command, and directory is reachable in a few keystrokes, and the most common operations take the fewest key presses.
|
|
8
8
|
|
|
9
9
|
Filecon is designed to be **intuitive**, **complete**, **powerful**, and the **fastest possible** file manager. The whole interface is built around that principle:
|
|
10
10
|
|
|
@@ -12,8 +12,6 @@ Filecon is designed to be **intuitive**, **complete**, **powerful**, and the **f
|
|
|
12
12
|
- **Live search in popups** — command and history popups open in `/` search mode; type to distill the list, then pick one of the few remaining results with a number.
|
|
13
13
|
- **Frequency-ordered history** — directory and command history are ranked by use count, so the most likely choice is always near the top.
|
|
14
14
|
|
|
15
|
-
Filecon's long-term goal is to become an **interactive shell**: a separate companion program will handle command building, and combined with Filecon the two will form a full interactive shell that competes with interactive CLI shells.
|
|
16
|
-
|
|
17
15
|
Filecon runs on Typr, whose self-contained terminal layer ships its own precompiled terminfo key table and MIME-type database in the gem — no ncurses or external tooling required — so Filecon works on any raw, ANSI-capable terminal (including Termux).
|
|
18
16
|
|
|
19
17
|
## Features
|
|
@@ -21,7 +19,7 @@ Filecon runs on Typr, whose self-contained terminal layer ships its own precompi
|
|
|
21
19
|
- **Directory browsing with MIME-type detection** — files are typed from a packaged MIME database and colored accordingly, with optional `file --mime-type` magic detection for unknowns
|
|
22
20
|
- **Fastest possible navigation** — hint numbers (1–9, 0) open rows directly; TAB pages hints beyond the first ten
|
|
23
21
|
- **Default `[/]:search` in popups** — command and history popups open in search mode: start typing to distill the list down to the matches, then press a number hint to pick from the few remaining results. The listing itself searches the same way
|
|
24
|
-
- **Mouse support** — click a row to open it with its default action, right-click to open its command list; the mouse wheel scrolls the listing (pointer-only mode is planned)
|
|
22
|
+
- **Mouse support** — click a row to open it with its default action, right-click to open its command list, click a binding on the bottom bar or a filter/sort/views column to run that action; the mouse wheel scrolls the listing (pointer-only mode is planned)
|
|
25
23
|
- **Command execution modes** — commands run in one of four ways, chosen by prefix: `|` status line, `=` text viewer, `+` new terminal window, `!` Ruby eval; per-MIME-type command sets with `%name`, `%dir`, `%file`, `%cmd`, `%str` substitution
|
|
26
24
|
- **Customizable column views** — view columns run shell commands with `%name` substitution (content preview, char/word/line counts, type info, disk usage, man-page descriptions)
|
|
27
25
|
- **Directory and command history with a frequency counter** — entries stored as `[count, entry]` pairs, most-used first then most-recent; `frequency_limit` controls how many frequent entries lead the list
|
|
@@ -78,7 +76,7 @@ filecon [directory]
|
|
|
78
76
|
|
|
79
77
|
### Mouse
|
|
80
78
|
|
|
81
|
-
Click a row to open it with its default action, right-click to open its command list; the mouse wheel scrolls the listing. Mouse reporting is enabled automatically when Filecon starts.
|
|
79
|
+
Click a row to open it with its default action, right-click (or Alt+click) to open its command list; click a binding label on the bottom bar or a filter/sort/views column on the head to run that action; the mouse wheel scrolls the listing. Clicking outside a popup dismisses it. `h` shows a two-pane help with the keybinding grid (from the line's `list`) beside the help text — clicking a binding row returns its trigger key, and clicking outside both panes closes it. Mouse reporting is enabled automatically when Filecon starts.
|
|
82
80
|
|
|
83
81
|
### Popups and search
|
|
84
82
|
|
|
@@ -106,11 +104,6 @@ State and history files live under `~/.local/share/filecon/`.
|
|
|
106
104
|
|
|
107
105
|
See `filecon(1)` for the full manual.
|
|
108
106
|
|
|
109
|
-
## Roadmap
|
|
110
|
-
|
|
111
|
-
- **Pointer-only mode** — full mouse-driven operation of the entire interface, building on the click/wheel mouse support already present
|
|
112
|
-
- **Interactive shell** — a separate command-building program that combines with Filecon into an interactive shell competing with interactive CLI shells
|
|
113
|
-
|
|
114
107
|
## Development
|
|
115
108
|
|
|
116
109
|
```bash
|
data/config.yaml
CHANGED
|
@@ -128,13 +128,15 @@ colors:
|
|
|
128
128
|
commands:
|
|
129
129
|
default:
|
|
130
130
|
# copy: "|rsync --progress %name %dir"
|
|
131
|
+
edit: "+micro %name"
|
|
132
|
+
view: "+moor %name"
|
|
131
133
|
info: "=file %name"
|
|
132
134
|
copy: "|cp -R %name %dir"
|
|
133
135
|
move: "|mv %name %dir"
|
|
134
136
|
rename: "|mv %name %str"
|
|
135
137
|
delete: "|rm -rf %name"
|
|
136
|
-
open_with: "|%
|
|
137
|
-
open_with_terminal: "+%
|
|
138
|
+
open_with: "|%cmd %name %str"
|
|
139
|
+
open_with_terminal: "+%cmd %name %str"
|
|
138
140
|
xdg_open: "|xdg-open %name"
|
|
139
141
|
|
|
140
142
|
executable:
|
|
@@ -152,10 +154,8 @@ commands:
|
|
|
152
154
|
disk_use: "|du -hs %name | cut -wf1"
|
|
153
155
|
play: "+mpv %name"
|
|
154
156
|
|
|
155
|
-
text:
|
|
156
|
-
|
|
157
|
-
edit: "+micro %name"
|
|
158
|
-
count: "|wc -l %name | cut -wf1"
|
|
157
|
+
# text:
|
|
158
|
+
# count: "|wc -l %name | cut -wf1"
|
|
159
159
|
|
|
160
160
|
troff:
|
|
161
161
|
manual: "+man %name"
|
|
@@ -210,9 +210,9 @@ commands:
|
|
|
210
210
|
"x-c++":
|
|
211
211
|
run: "+g++ %name && ./a.out"
|
|
212
212
|
|
|
213
|
-
markdown:
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
# markdown:
|
|
214
|
+
# view: "+glow %name"
|
|
215
|
+
# edit: "+micro %name"
|
|
216
216
|
|
|
217
217
|
json:
|
|
218
218
|
view: "=cat %name | jq ."
|
data/lib/filecon/version.rb
CHANGED
data/lib/filecon.rb
CHANGED
|
@@ -12,23 +12,31 @@ class Filecon::App < Typr::Browser
|
|
|
12
12
|
def cd dir, append=false
|
|
13
13
|
@selected[:rows] = [] unless append
|
|
14
14
|
if dir.is_a? Array
|
|
15
|
-
|
|
15
|
+
@show_path = true
|
|
16
|
+
dirs = dir.filter_map { |d| d = File.expand_path(d.to_s);
|
|
17
|
+
Dir.exist?(d) && File.readable?(d) && File.executable?(d) ? d : nil }
|
|
16
18
|
dirs.each_with_index { |d, i|
|
|
17
19
|
@directory = d if i.positive?
|
|
18
20
|
Dir.chdir(d) if i.positive?
|
|
19
21
|
super d, i.positive?
|
|
20
22
|
}
|
|
21
23
|
@directory = dirs
|
|
24
|
+
change_view @view if dirs.any?
|
|
22
25
|
nil
|
|
23
26
|
else
|
|
24
27
|
dir = @dir_history[dir+1][1] if dir.is_a? Integer
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
saved = @show_path
|
|
29
|
+
@show_path = false unless append
|
|
30
|
+
if ( super dir, append ) == false
|
|
31
|
+
@show_path = saved
|
|
32
|
+
else
|
|
33
|
+
record :dir, File.expand_path(dir) unless append || [?/, ENV["HOME"]].include?(dir)
|
|
34
|
+
end
|
|
27
35
|
nil
|
|
28
36
|
end
|
|
29
37
|
end
|
|
30
38
|
|
|
31
|
-
def execute; cd ENV["PATH"].split(":")
|
|
39
|
+
def execute; cd ENV["PATH"].split(":") end
|
|
32
40
|
|
|
33
41
|
def pick type='file', **kw
|
|
34
42
|
return super unless type == :cmd
|
|
@@ -62,6 +70,10 @@ class Filecon::App < Typr::Browser
|
|
|
62
70
|
@header.index(head.to_s) || (@header += [head.to_s]; @header.count-1) }
|
|
63
71
|
clear
|
|
64
72
|
self << data
|
|
73
|
+
if @show_path
|
|
74
|
+
@data.each { |row| row[PATH] = File.dirname(row[NAME]) } if @data.any?
|
|
75
|
+
@sequence.insert(@sequence.index(NAME) || 0, PATH) unless @sequence.include?(PATH)
|
|
76
|
+
end
|
|
65
77
|
@current = id
|
|
66
78
|
@view = id
|
|
67
79
|
end
|
|
@@ -100,7 +112,7 @@ class Filecon::App < Typr::Browser
|
|
|
100
112
|
cmd = build pair.last, id, pair.first
|
|
101
113
|
return unless cmd
|
|
102
114
|
if alt
|
|
103
|
-
edited = Typr.read_line "> ", left: left, top: @user.top, initial: cmd
|
|
115
|
+
edited = Typr.read_line "> ", left: left, top: @user.top, initial: cmd, completions: true, redraw: method(:show)
|
|
104
116
|
return unless edited
|
|
105
117
|
cmd = edited
|
|
106
118
|
end
|
|
@@ -128,7 +140,7 @@ class Filecon::App < Typr::Browser
|
|
|
128
140
|
name = row[NAME]
|
|
129
141
|
return delete_row id unless File.symlink?(name) || File.exist?(name)
|
|
130
142
|
updated = scan_file name
|
|
131
|
-
updated[
|
|
143
|
+
updated[TYPE, 2] = row[TYPE, 2]
|
|
132
144
|
@data[id] = updated
|
|
133
145
|
process id
|
|
134
146
|
end
|
|
@@ -223,7 +235,8 @@ class Filecon::App < Typr::Browser
|
|
|
223
235
|
|
|
224
236
|
entry = ordered[n][1]
|
|
225
237
|
if is_cmd and picker.modifier == :alt
|
|
226
|
-
edited = Typr.read_line "> ", left: left, top: @user.top, initial: entry
|
|
238
|
+
edited = Typr.read_line "> ", left: left, top: @user.top, initial: entry,
|
|
239
|
+
completions: true, redraw: -> { picker.show }
|
|
227
240
|
return unless edited
|
|
228
241
|
entry = edited
|
|
229
242
|
end
|
|
@@ -306,39 +319,29 @@ class Filecon::App < Typr::Browser
|
|
|
306
319
|
def recurse
|
|
307
320
|
return if @directory.is_a?(Array)
|
|
308
321
|
root = File.expand_path(@directory)
|
|
309
|
-
|
|
310
|
-
cd root
|
|
311
|
-
Dir.glob("**/*", File::FNM_DOTMATCH, base: root).sort.each { |p|
|
|
322
|
+
dirs = [root] + Dir.glob("**/*", File::FNM_DOTMATCH, base: root).sort.filter_map { |p|
|
|
312
323
|
next if !@show_hidden && p.split(?/).any? { |c| c.start_with?(?.) }
|
|
313
|
-
next unless File.directory?(File.join(root, p))
|
|
314
324
|
d = File.expand_path(p, root)
|
|
315
|
-
|
|
316
|
-
Dir.chdir d
|
|
317
|
-
cd d, true
|
|
325
|
+
d if File.directory?(d)
|
|
318
326
|
}
|
|
319
|
-
|
|
320
|
-
@directory = root
|
|
321
|
-
add_path_column
|
|
327
|
+
cd dirs
|
|
322
328
|
@current = 0
|
|
323
329
|
nil
|
|
324
330
|
end
|
|
325
331
|
|
|
326
|
-
|
|
327
|
-
Typr.const_set :PATH, @header.size unless Typr.const_defined?(:PATH)
|
|
328
|
-
@header << "path" unless @header.include?("path")
|
|
329
|
-
@data.each { |row| row[PATH] = File.dirname(row[NAME]) }
|
|
330
|
-
@sequence.insert(@sequence.index(NAME) || 0, PATH) unless @sequence.include?(PATH)
|
|
331
|
-
# @align[@header.size-1] = :right
|
|
332
|
-
end
|
|
332
|
+
|
|
333
333
|
|
|
334
334
|
def help
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
"
|
|
340
|
-
"
|
|
341
|
-
"
|
|
335
|
+
grid = @user.list
|
|
336
|
+
y = color_code :yellow
|
|
337
|
+
d = color_code @colors[:default]
|
|
338
|
+
text = Text.new( input: "\n#{y}FILECON#{d} - a terminal file manager\n\n" \
|
|
339
|
+
"#{y}HINTS:#{d}\n press a number (1-9,0) to open that file with its default action.\n" \
|
|
340
|
+
" Alt+number opens the command list for that file instead.\n" \
|
|
341
|
+
" Right-click a file to open its command list.\n" \
|
|
342
|
+
" Mark files with m, then Return opens their command list.\n" \
|
|
343
|
+
" TAB cycles pages of hints.\n\n" \
|
|
344
|
+
"#{y}COMMANDS:#{d}\n" \
|
|
342
345
|
" e[x]ecute browse all executables on your PATH\n" \
|
|
343
346
|
" [R]ecurse expand the current directory tree (subdirectories listed inline)\n" \
|
|
344
347
|
" [d]irectories jump to a recently visited directory\n" \
|
|
@@ -347,11 +350,32 @@ class Filecon::App < Typr::Browser
|
|
|
347
350
|
" entries first, then the rest in most-recent order. The frequency_limit\n" \
|
|
348
351
|
" setting in config.yaml (default 10) controls how many frequent entries\n" \
|
|
349
352
|
" lead the list.\n\n" \
|
|
350
|
-
"CONFIG
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
353
|
+
"#{y}CONFIG:#{d}\n ~/.config/filecon/config.yaml\n",
|
|
354
|
+
top: 2, right: -2, bottom: -3,
|
|
355
|
+
colors: { border:[:white,:grey10] },
|
|
356
|
+
border: :light )
|
|
357
|
+
text.left = -> { grid.right + 2 }
|
|
358
|
+
loop do
|
|
359
|
+
grid.show
|
|
360
|
+
text.show
|
|
361
|
+
key = Typr.read_key
|
|
362
|
+
case key
|
|
363
|
+
when @keymap[:exit], @keymap[:confirm]; return
|
|
364
|
+
when Typr::Mouse
|
|
365
|
+
if key.press? and key.left?
|
|
366
|
+
if row = grid.data_at( key.x, key.y )
|
|
367
|
+
return extract_key( @user.bindings[ row ] )
|
|
368
|
+
end
|
|
369
|
+
return if grid.send( key ) == :outside and text.send( key ) == :outside
|
|
370
|
+
else
|
|
371
|
+
grid.send key
|
|
372
|
+
text.send key
|
|
373
|
+
end
|
|
374
|
+
else
|
|
375
|
+
grid.send key
|
|
376
|
+
text.send key
|
|
377
|
+
end
|
|
378
|
+
end
|
|
355
379
|
end
|
|
356
380
|
|
|
357
381
|
def initialize args={}
|
|
@@ -378,6 +402,13 @@ class Filecon::App < Typr::Browser
|
|
|
378
402
|
|
|
379
403
|
def open_current; open_file nil, false, ["directory", "inode"] - [??] + ["default"] end
|
|
380
404
|
|
|
405
|
+
def open_path path
|
|
406
|
+
dir, @directory = @directory, path
|
|
407
|
+
open_file nil, false, ["directory", "inode"] - [??] + ["default"]
|
|
408
|
+
ensure
|
|
409
|
+
@directory = dir
|
|
410
|
+
end
|
|
411
|
+
|
|
381
412
|
def fly
|
|
382
413
|
loop do
|
|
383
414
|
show
|
|
@@ -387,17 +418,19 @@ class Filecon::App < Typr::Browser
|
|
|
387
418
|
case key
|
|
388
419
|
when KEY_ESCAPE; exit
|
|
389
420
|
when Typr::Mouse
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
421
|
+
alt = key.alt?
|
|
422
|
+
if key.press? and ( key.left? or key.right? ) and target = @head.path_at( key.x, key.y )
|
|
423
|
+
( key.right? or alt ) ? open_path( target ) : cd( target )
|
|
424
|
+
else
|
|
425
|
+
value = send( key )
|
|
426
|
+
open_file( value, !( key.right? or alt ) ) if value.is_a?( Integer )
|
|
395
427
|
end
|
|
396
428
|
@user.reset
|
|
397
429
|
else
|
|
398
430
|
alt = key.is_a?(String) && key[/\A\e(\d)\z/]
|
|
399
431
|
key = key[1] if alt
|
|
400
432
|
id = send( key )
|
|
433
|
+
id = send( id ) while id.is_a? String
|
|
401
434
|
open_file( id, !alt ) if id.is_a? Integer
|
|
402
435
|
@user.reset
|
|
403
436
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: filecon
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kilian Reitmayr
|
|
@@ -74,6 +74,7 @@ executables:
|
|
|
74
74
|
extensions: []
|
|
75
75
|
extra_rdoc_files: []
|
|
76
76
|
files:
|
|
77
|
+
- CHANGELOG.md
|
|
77
78
|
- LICENSE
|
|
78
79
|
- README.md
|
|
79
80
|
- bin/filecon
|