sergeant 1.0.0 → 1.0.2
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 +11 -0
- data/README.md +33 -0
- data/bin/sgt +15 -5
- data/lib/sergeant/modals/file_operations.rb +27 -6
- data/lib/sergeant/version.rb +1 -1
- data/lib/sergeant.rb +29 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f8e44aa17efd4cddd56d88d910edc0082e94488cd3d25cf6def3b832a579c3d
|
|
4
|
+
data.tar.gz: c66899a4748192ded5481c0497a81ebb81edad956a932d6253beab34ab834a67
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1590f36daa589471edc9f65f150b24b9764ef192b77d46cc51ffc1884e01dafa2fd9a4832a5fef635dfef8bca12f3d16f49b305a295a4fd8e6159e50529d9127
|
|
7
|
+
data.tar.gz: 8ee3a3f6eacd45f3a91c42b7a96e94ccc0961c12cbd3b363ee8a92553efe4db4db73be8499d5304d54702b82333c50fa29b27ad0f87a6f2e141a0a9ca4dad3f2
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ All notable changes to Sergeant will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.1] - 2024-12-24
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Major performance improvement**: Fixed severe input lag with large directories
|
|
12
|
+
- Directory contents now only refresh when necessary (directory changes, file operations)
|
|
13
|
+
- Previously refreshed on every keystroke, causing thousands of unnecessary file system calls
|
|
14
|
+
- Navigation (arrow keys, marking) is now instant regardless of directory size
|
|
15
|
+
- **Better error handling**: Added error messages to help diagnose installation issues
|
|
16
|
+
- Shows load path and helpful reinstall instructions if gem fails to load
|
|
17
|
+
- Displays full error details instead of silently failing
|
|
18
|
+
|
|
8
19
|
## [1.0.0] - 2024-12-23
|
|
9
20
|
|
|
10
21
|
### Added
|
data/README.md
CHANGED
|
@@ -90,6 +90,39 @@ gem install ./sergeant-1.0.0.gem
|
|
|
90
90
|
|
|
91
91
|
That's it! The `sgt` command will automatically be added to your PATH.
|
|
92
92
|
|
|
93
|
+
### Troubleshooting Installation
|
|
94
|
+
|
|
95
|
+
**If sgt doesn't display anything (shows blank screen):**
|
|
96
|
+
|
|
97
|
+
This can happen on Arch Linux or other systems using Ruby version managers (mise, rbenv, asdf).
|
|
98
|
+
|
|
99
|
+
**Recommended fix - Add an alias (simplest):**
|
|
100
|
+
```bash
|
|
101
|
+
# Add to your ~/.bashrc or ~/.zshrc:
|
|
102
|
+
echo 'alias sgt='"'"'ruby "$(which sgt)"'"'"'' >> ~/.bashrc
|
|
103
|
+
|
|
104
|
+
# Reload your shell:
|
|
105
|
+
source ~/.bashrc # or: source ~/.zshrc
|
|
106
|
+
|
|
107
|
+
# Now sgt works!
|
|
108
|
+
sgt
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Alternative - Quick test:**
|
|
112
|
+
```bash
|
|
113
|
+
# Run with explicit ruby (temporary fix)
|
|
114
|
+
ruby $(which sgt)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Alternative - Automated fix script:**
|
|
118
|
+
```bash
|
|
119
|
+
# Creates a wrapper script (requires cloning repo)
|
|
120
|
+
cd Sergeant
|
|
121
|
+
bash arch_fix.sh
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**For detailed troubleshooting**, see [INSTALL_TROUBLESHOOTING.md](./INSTALL_TROUBLESHOOTING.md)
|
|
125
|
+
|
|
93
126
|
### Development Installation
|
|
94
127
|
|
|
95
128
|
If you want to work on the gem:
|
data/bin/sgt
CHANGED
|
@@ -4,10 +4,20 @@
|
|
|
4
4
|
# Sergeant (sgt) - Interactive TUI directory navigator
|
|
5
5
|
# Version: 1.0.0
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
begin
|
|
8
|
+
require 'sergeant'
|
|
9
|
+
rescue LoadError => e
|
|
10
|
+
warn "Error loading sergeant: #{e.message}"
|
|
11
|
+
warn "Load path: #{$LOAD_PATH.join(', ')}"
|
|
12
|
+
warn "\nTry reinstalling: gem uninstall sergeant && gem install sergeant"
|
|
13
|
+
exit 1
|
|
14
|
+
end
|
|
11
15
|
|
|
12
16
|
# Run the navigator
|
|
13
|
-
|
|
17
|
+
begin
|
|
18
|
+
SergeantApp.new.run
|
|
19
|
+
rescue StandardError => e
|
|
20
|
+
warn "\nSergeant error: #{e.message}"
|
|
21
|
+
warn e.backtrace.join("\n")
|
|
22
|
+
exit 1
|
|
23
|
+
end
|
|
@@ -49,11 +49,13 @@ module Sergeant
|
|
|
49
49
|
|
|
50
50
|
# Restore curses screen
|
|
51
51
|
init_screen
|
|
52
|
-
|
|
52
|
+
if has_colors?
|
|
53
|
+
start_color
|
|
54
|
+
apply_color_theme
|
|
55
|
+
end
|
|
53
56
|
curs_set(0)
|
|
54
57
|
noecho
|
|
55
58
|
stdscr.keypad(true)
|
|
56
|
-
apply_color_theme
|
|
57
59
|
end
|
|
58
60
|
|
|
59
61
|
def preview_file
|
|
@@ -102,11 +104,13 @@ module Sergeant
|
|
|
102
104
|
|
|
103
105
|
# Restore curses screen
|
|
104
106
|
init_screen
|
|
105
|
-
|
|
107
|
+
if has_colors?
|
|
108
|
+
start_color
|
|
109
|
+
apply_color_theme
|
|
110
|
+
end
|
|
106
111
|
curs_set(0)
|
|
107
112
|
noecho
|
|
108
113
|
stdscr.keypad(true)
|
|
109
|
-
apply_color_theme
|
|
110
114
|
end
|
|
111
115
|
|
|
112
116
|
def paste_with_modal
|
|
@@ -163,6 +167,9 @@ module Sergeant
|
|
|
163
167
|
else
|
|
164
168
|
show_info_modal("Successfully pasted #{success_count} item(s)")
|
|
165
169
|
end
|
|
170
|
+
|
|
171
|
+
# Force refresh to show new files
|
|
172
|
+
force_refresh
|
|
166
173
|
end
|
|
167
174
|
|
|
168
175
|
def get_unique_filename(path)
|
|
@@ -208,6 +215,9 @@ module Sergeant
|
|
|
208
215
|
else
|
|
209
216
|
show_info_modal("Successfully deleted #{success_count} item(s)")
|
|
210
217
|
end
|
|
218
|
+
|
|
219
|
+
# Force refresh to show changes
|
|
220
|
+
force_refresh
|
|
211
221
|
end
|
|
212
222
|
|
|
213
223
|
def rename_with_modal(item)
|
|
@@ -358,6 +368,9 @@ module Sergeant
|
|
|
358
368
|
@copied_items.delete(old_path)
|
|
359
369
|
@copied_items << new_path
|
|
360
370
|
end
|
|
371
|
+
|
|
372
|
+
# Force refresh to show renamed item
|
|
373
|
+
force_refresh
|
|
361
374
|
rescue StandardError => e
|
|
362
375
|
show_error_modal("Error: #{e.message}")
|
|
363
376
|
end
|
|
@@ -496,6 +509,9 @@ module Sergeant
|
|
|
496
509
|
FileUtils.mkdir_p(new_path)
|
|
497
510
|
show_info_modal('Directory created successfully!')
|
|
498
511
|
end
|
|
512
|
+
|
|
513
|
+
# Force refresh to show new item
|
|
514
|
+
force_refresh
|
|
499
515
|
rescue StandardError => e
|
|
500
516
|
show_error_modal("Error: #{e.message}")
|
|
501
517
|
end
|
|
@@ -624,11 +640,16 @@ module Sergeant
|
|
|
624
640
|
|
|
625
641
|
# Restore curses
|
|
626
642
|
init_screen
|
|
627
|
-
|
|
643
|
+
if has_colors?
|
|
644
|
+
start_color
|
|
645
|
+
apply_color_theme
|
|
646
|
+
end
|
|
628
647
|
curs_set(0)
|
|
629
648
|
noecho
|
|
630
649
|
stdscr.keypad(true)
|
|
631
|
-
|
|
650
|
+
|
|
651
|
+
# Force refresh to show any changes from the command
|
|
652
|
+
force_refresh
|
|
632
653
|
end
|
|
633
654
|
end
|
|
634
655
|
end
|
data/lib/sergeant/version.rb
CHANGED
data/lib/sergeant.rb
CHANGED
|
@@ -31,20 +31,27 @@ class SergeantApp
|
|
|
31
31
|
@marked_items = []
|
|
32
32
|
@copied_items = []
|
|
33
33
|
@cut_mode = false
|
|
34
|
+
@last_refreshed_dir = nil
|
|
35
|
+
@items = []
|
|
34
36
|
end
|
|
35
37
|
|
|
36
38
|
def run
|
|
37
39
|
init_screen
|
|
38
|
-
|
|
40
|
+
|
|
41
|
+
# Only initialize colors if terminal supports them
|
|
42
|
+
if has_colors?
|
|
43
|
+
start_color
|
|
44
|
+
apply_color_theme
|
|
45
|
+
end
|
|
46
|
+
|
|
39
47
|
curs_set(0)
|
|
40
48
|
noecho
|
|
41
49
|
stdscr.keypad(true)
|
|
42
50
|
|
|
43
|
-
apply_color_theme
|
|
44
|
-
|
|
45
51
|
begin
|
|
46
52
|
loop do
|
|
47
|
-
|
|
53
|
+
# Only refresh items when directory changes, not on every keystroke
|
|
54
|
+
refresh_items_if_needed
|
|
48
55
|
draw_screen
|
|
49
56
|
|
|
50
57
|
key = getch
|
|
@@ -165,11 +172,13 @@ class SergeantApp
|
|
|
165
172
|
end
|
|
166
173
|
|
|
167
174
|
init_screen
|
|
168
|
-
|
|
175
|
+
if has_colors?
|
|
176
|
+
start_color
|
|
177
|
+
apply_color_theme
|
|
178
|
+
end
|
|
169
179
|
curs_set(0)
|
|
170
180
|
noecho
|
|
171
181
|
stdscr.keypad(true)
|
|
172
|
-
apply_color_theme
|
|
173
182
|
|
|
174
183
|
return unless selected && !selected.empty?
|
|
175
184
|
|
|
@@ -182,6 +191,20 @@ class SergeantApp
|
|
|
182
191
|
@scroll_offset = 0
|
|
183
192
|
end
|
|
184
193
|
|
|
194
|
+
def refresh_items_if_needed
|
|
195
|
+
# Only refresh if directory has changed, or if showing ownership toggle changed
|
|
196
|
+
# This prevents expensive file system operations on every keystroke
|
|
197
|
+
if @current_dir != @last_refreshed_dir
|
|
198
|
+
refresh_items
|
|
199
|
+
@last_refreshed_dir = @current_dir
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def force_refresh
|
|
204
|
+
# Force a refresh even if directory hasn't changed (e.g., after file operations)
|
|
205
|
+
@last_refreshed_dir = nil
|
|
206
|
+
end
|
|
207
|
+
|
|
185
208
|
def refresh_items
|
|
186
209
|
entries = Dir.entries(@current_dir).reject { |e| e == '.' }
|
|
187
210
|
|