beniya 0.5.1 → 0.6.0
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 +27 -0
- data/CHANGELOG_v0.6.0.md +182 -0
- data/README.md +55 -3
- data/README_EN.md +83 -3
- data/lib/beniya/config.rb +6 -4
- data/lib/beniya/health_checker.rb +22 -0
- data/lib/beniya/keybind_handler.rb +179 -0
- data/lib/beniya/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e920583f6645634b10889369089e81e114db44a01be5b0baa177dc8279ca1bc
|
4
|
+
data.tar.gz: 7c3ec6afa823e45700e26fa02c50076cbdc268d136d11403599a6befc858aebf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd20c3f4392c8d65aec9bc2e3261701d5f091e6baa73012e779f7417e0d2ea1bc8fe10ea4cac99117b70f82a70b68de0638ec05b390e97436c67691ac11bef90
|
7
|
+
data.tar.gz: b28475770533a0d8989eab47f72bf63a83e15546fa4e11a43027e45885c07b491498c0bd83296fe9e67a4568c3c1774f96b8b6ff9bd98d1ea6f2b9d185d4ea30
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.6.0] - 2025-01-XX
|
11
|
+
|
12
|
+
### Added
|
13
|
+
- **🚀 zoxide Integration**: Complete zoxide directory history navigation functionality
|
14
|
+
- **z Key Navigation**: Press `z` key to display zoxide movement history and navigate to frequently used directories
|
15
|
+
- **Smart History Display**: Frequency-based directory sorting with up to 20 history entries
|
16
|
+
- **Interactive Selection UI**: Modern floating window for intuitive history selection
|
17
|
+
- **Fast Number Key Selection**: Direct directory selection using number keys 1-20
|
18
|
+
- **Health Check Enhancement**: zoxide installation status and version checking with `beniya -c`
|
19
|
+
- **Multi-platform Installation Support**: Automated installation instructions for macOS and Linux
|
20
|
+
- **Graceful Fallback**: Proper handling when zoxide is not installed or history is empty
|
21
|
+
|
22
|
+
### Changed
|
23
|
+
- **Footer Help Updates**: Added `z:zoxide` to key binding display in both English and Japanese
|
24
|
+
- **External Tools Documentation**: Updated README with zoxide installation and usage instructions
|
25
|
+
- **Health Check System**: Extended to include zoxide as optional dependency with platform-specific guidance
|
26
|
+
- **Error Messaging**: Improved user guidance for zoxide-related issues
|
27
|
+
|
28
|
+
### Technical Details
|
29
|
+
- New zoxide integration methods in `KeybindHandler` class
|
30
|
+
- Extended `HealthChecker` with zoxide version checking
|
31
|
+
- Comprehensive test suite for zoxide functionality
|
32
|
+
- Safe path escaping using Ruby's Shellwords module
|
33
|
+
- **Detailed changelog**: [CHANGELOG_v0.6.0.md](./CHANGELOG_v0.6.0.md)
|
34
|
+
|
10
35
|
## [0.5.0] - 2025-09-20
|
11
36
|
|
12
37
|
### Added
|
@@ -99,6 +124,8 @@ For detailed information, see [CHANGELOG_v0.4.0.md](./CHANGELOG_v0.4.0.md)
|
|
99
124
|
|
100
125
|
## Release Links
|
101
126
|
|
127
|
+
- [v0.6.0 Detailed Release Notes](./CHANGELOG_v0.6.0.md) - zoxide Integration and Enhanced Health Checking
|
128
|
+
- [v0.5.0 Detailed Release Notes](./CHANGELOG_v0.5.0.md) - Bookmark System Implementation
|
102
129
|
- [v0.4.0 Detailed Release Notes](./CHANGELOG_v0.4.0.md) - Comprehensive changelog with technical details
|
103
130
|
- [GitHub Releases](https://github.com/masisz/beniya/releases) - Download releases and view release history
|
104
131
|
- [Installation Guide](./README.md#installation) - How to install beniya
|
data/CHANGELOG_v0.6.0.md
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
# CHANGELOG - beniya v0.6.0
|
2
|
+
|
3
|
+
**Release Date**: 2025-09-28
|
4
|
+
|
5
|
+
## 🚀 New Features
|
6
|
+
|
7
|
+
### zoxide Integration
|
8
|
+
|
9
|
+
- **zoxide History Navigation with z Key**: Press `z` key to display zoxide movement history and quickly navigate to previously visited directories
|
10
|
+
- **Smart History Display**: Frequently used directories appear at the top of the list
|
11
|
+
- **Interactive Selection UI**: Floating window displays up to 20 history entries
|
12
|
+
- **Fast Selection with Number Keys**: Select directories directly using number keys 1-20
|
13
|
+
- **Abbreviated Path Display**: Home directory displayed as `~` with nicely formatted long paths
|
14
|
+
- **Graceful Handling**: Proper handling when zoxide is not installed or history is empty
|
15
|
+
|
16
|
+
### Health Check Enhancement
|
17
|
+
|
18
|
+
- **zoxide Check Addition**: Check zoxide installation status and version with `beniya -c`
|
19
|
+
- **Installation Instructions**: Detailed platform-specific (macOS/Linux) installation instructions
|
20
|
+
|
21
|
+
## 🎨 UI/UX Improvements
|
22
|
+
|
23
|
+
### User Interface
|
24
|
+
|
25
|
+
- **Footer Help Updates**:
|
26
|
+
- English version: Added `z:zoxide` to key binding list
|
27
|
+
- Japanese version: Added `z:zoxide` to key binding list
|
28
|
+
- **zoxide History Selection Dialog**: Intuitive floating window for history selection
|
29
|
+
- **Improved Error Messages**: Clear guidance when zoxide is not installed
|
30
|
+
|
31
|
+
## 📖 Documentation Updates
|
32
|
+
|
33
|
+
### README Updates
|
34
|
+
|
35
|
+
**Japanese Version (README.md)**:
|
36
|
+
|
37
|
+
- New zoxide integration features section
|
38
|
+
- Added `z:zoxide` to key bindings list
|
39
|
+
- Detailed explanation of zoxide overview and installation methods
|
40
|
+
- Added zoxide to required external tools list
|
41
|
+
- Clarified purpose of each tool
|
42
|
+
|
43
|
+
**English Version (README_EN.md)**:
|
44
|
+
|
45
|
+
- New zoxide Integration Features section
|
46
|
+
- Added `z:zoxide integration` to Key Bindings
|
47
|
+
- Detailed zoxide explanation and installation instructions
|
48
|
+
- Expanded Required External Tools section
|
49
|
+
- Clarified Tool Usage
|
50
|
+
|
51
|
+
### Added Documentation Content
|
52
|
+
|
53
|
+
- **Detailed explanation of zoxide history navigation features**
|
54
|
+
- **Usage examples and workflows**
|
55
|
+
- **Overview of zoxide**
|
56
|
+
- **Platform-specific installation methods**
|
57
|
+
- **Requirements and limitations**
|
58
|
+
|
59
|
+
## 🔧 Technical Improvements
|
60
|
+
|
61
|
+
### Architecture
|
62
|
+
|
63
|
+
- **KeybindHandler Class Extension**: Added zoxide-related methods
|
64
|
+
- `zoxide_available?`: Check zoxide availability
|
65
|
+
- `get_zoxide_history`: Get and parse zoxide history
|
66
|
+
- `show_zoxide_menu`: Display history in floating window
|
67
|
+
- `select_from_zoxide_history`: Interactive history selection
|
68
|
+
- `navigate_to_zoxide_directory`: Navigate to selected directory
|
69
|
+
|
70
|
+
### HealthChecker Class Extension
|
71
|
+
|
72
|
+
- **check_zoxide Method**: Version checking and status verification for zoxide
|
73
|
+
- **install_instruction_for Method Extension**: Added installation instructions for zoxide
|
74
|
+
|
75
|
+
### Configuration System
|
76
|
+
|
77
|
+
- **Multi-language Message Support**:
|
78
|
+
- `health.zoxide`: Support for both English and Japanese
|
79
|
+
- Updated footer help messages
|
80
|
+
|
81
|
+
## 🧪 Testing
|
82
|
+
|
83
|
+
### New Tests Added
|
84
|
+
|
85
|
+
- **zoxide Integration Tests** (`test/test_zoxide_integration.rb`):
|
86
|
+
- zoxide availability tests
|
87
|
+
- History retrieval functionality tests
|
88
|
+
- UI display tests
|
89
|
+
- Directory navigation tests
|
90
|
+
- Error handling tests
|
91
|
+
|
92
|
+
- **Health Check Test Extensions**:
|
93
|
+
- `test_check_zoxide`: zoxide check functionality tests
|
94
|
+
- `test_install_instruction_for_zoxide`: Installation instruction tests
|
95
|
+
|
96
|
+
## 📦 Dependencies
|
97
|
+
|
98
|
+
### New Dependencies
|
99
|
+
|
100
|
+
- **zoxide**: Directory history functionality (optional)
|
101
|
+
- macOS: `brew install zoxide`
|
102
|
+
- Ubuntu/Debian: `apt install zoxide`
|
103
|
+
- Others: [Official Documentation](https://github.com/ajeetdsouza/zoxide#installation)
|
104
|
+
|
105
|
+
### Dependency Updates
|
106
|
+
|
107
|
+
- **Shellwords Module**: Used for path escaping (Ruby standard library)
|
108
|
+
|
109
|
+
## 🔄 Compatibility
|
110
|
+
|
111
|
+
### Backward Compatibility
|
112
|
+
|
113
|
+
- **No Impact on Existing Features**: No changes to existing key bindings or functionality
|
114
|
+
- **Configuration File Compatibility**: Existing configuration files can be used as-is
|
115
|
+
- **Optional Feature**: All existing features work normally even without zoxide
|
116
|
+
|
117
|
+
### Platform Support
|
118
|
+
|
119
|
+
- **macOS**: Full support (installation via Homebrew recommended)
|
120
|
+
- **Linux**: Full support (via package managers)
|
121
|
+
- **Windows**: Basic compatibility (zoxide installation methods need separate verification)
|
122
|
+
|
123
|
+
## ⚡ Performance
|
124
|
+
|
125
|
+
### Optimizations
|
126
|
+
|
127
|
+
- **Efficient History Retrieval**: Optimal use of zoxide query commands
|
128
|
+
- **Memory Usage**: History display limited to maximum 20 entries
|
129
|
+
- **Responsiveness**: Fast floating window rendering
|
130
|
+
|
131
|
+
## 🐛 Bug Fixes
|
132
|
+
|
133
|
+
### Fixed Issues
|
134
|
+
|
135
|
+
- **zoxide Output Format Support**: Correctly retrieve scored output with `zoxide query --list --score`
|
136
|
+
- **Empty History Handling**: Proper message display when no history exists
|
137
|
+
- **Path Escaping**: Safe handling of paths with special characters
|
138
|
+
|
139
|
+
## 🔮 Future Plans
|
140
|
+
|
141
|
+
### Planned for Next Version
|
142
|
+
|
143
|
+
- **zoxide Integration Update History Recording**: Automatically record directory movements within beniya to zoxide
|
144
|
+
- **Customizable History Display Count**: Adjust display count via configuration file
|
145
|
+
- **History Filtering**: Filter history by specific patterns
|
146
|
+
|
147
|
+
## 📝 Usage Examples
|
148
|
+
|
149
|
+
### Basic Usage
|
150
|
+
|
151
|
+
```bash
|
152
|
+
# Launch beniya
|
153
|
+
beniya
|
154
|
+
|
155
|
+
# Press z key to display zoxide history
|
156
|
+
# Enter displayed number (1-20) to navigate to directory
|
157
|
+
# Press ESC to cancel
|
158
|
+
```
|
159
|
+
|
160
|
+
### Health Check
|
161
|
+
|
162
|
+
```bash
|
163
|
+
# Check all dependencies including zoxide
|
164
|
+
beniya -c
|
165
|
+
|
166
|
+
# Example output:
|
167
|
+
# ✓ zoxide (directory history) zoxide 0.9.8
|
168
|
+
```
|
169
|
+
|
170
|
+
## 🙏 Acknowledgments
|
171
|
+
|
172
|
+
Main contributions in this version:
|
173
|
+
|
174
|
+
- **zoxide**: [ajeetdsouza/zoxide](https://github.com/ajeetdsouza/zoxide) - Excellent directory navigation tool
|
175
|
+
- **Ruby Standard Library**: Utilization of Shellwords module
|
176
|
+
|
177
|
+
---
|
178
|
+
|
179
|
+
**Note**: This version is the initial implementation of zoxide integration features. We welcome feedback and improvement suggestions.
|
180
|
+
|
181
|
+
**GitHub Issues**: [https://github.com/masisz/beniya/issues](https://github.com/masisz/beniya/issues)
|
182
|
+
|
data/README.md
CHANGED
@@ -111,6 +111,12 @@ beniya --help # ヘルプメッセージを表示
|
|
111
111
|
| `b` | ブックマークメニューを表示 |
|
112
112
|
| `1`-`9` | 対応する番号のブックマークに移動 |
|
113
113
|
|
114
|
+
#### zoxide連携機能
|
115
|
+
|
116
|
+
| キー | 機能 |
|
117
|
+
| ---- | ---------------------------------- |
|
118
|
+
| `z` | zoxide履歴からディレクトリを選択移動 |
|
119
|
+
|
114
120
|
#### システム操作
|
115
121
|
|
116
122
|
| キー | 機能 |
|
@@ -225,22 +231,68 @@ beniya起動時のディレクトリが**ベースディレクトリ**として
|
|
225
231
|
- beniya再起動後もブックマーク情報が保持される
|
226
232
|
- JSONファイルを直接編集することも可能
|
227
233
|
|
234
|
+
### zoxide連携機能の詳細
|
235
|
+
|
236
|
+
#### zoxide履歴移動 (`z`)
|
237
|
+
|
238
|
+
- **スマート履歴**: zoxideが記録したディレクトリ移動履歴を表示
|
239
|
+
- **フリークエンシー順**: よく使用するディレクトリほど上位に表示
|
240
|
+
- **インタラクティブ選択**: フローティングウィンドウで履歴を選択
|
241
|
+
- **高速ナビゲーション**: 数字キーで直接ディレクトリを選択
|
242
|
+
- **パス省略表示**: ホームディレクトリを`~`で表示し見やすく
|
243
|
+
|
244
|
+
#### 使用例
|
245
|
+
|
246
|
+
```
|
247
|
+
1. z → zoxide履歴メニューを表示
|
248
|
+
2. 1-20 → 表示された番号でディレクトリを選択
|
249
|
+
3. ESC → キャンセルして元の画面に戻る
|
250
|
+
```
|
251
|
+
|
252
|
+
#### zoxideについて
|
253
|
+
|
254
|
+
[zoxide](https://github.com/ajeetdsouza/zoxide)は、ディレクトリ移動履歴を学習するスマートなcdコマンドです。
|
255
|
+
|
256
|
+
```bash
|
257
|
+
# zoxideのインストール
|
258
|
+
# macOS (Homebrew)
|
259
|
+
brew install zoxide
|
260
|
+
|
261
|
+
# Ubuntu/Debian
|
262
|
+
apt install zoxide
|
263
|
+
|
264
|
+
# その他のインストール方法は公式ドキュメントを参照
|
265
|
+
# https://github.com/ajeetdsouza/zoxide#installation
|
266
|
+
```
|
267
|
+
|
268
|
+
#### 動作要件
|
269
|
+
|
270
|
+
- zoxideがシステムにインストールされている必要があります
|
271
|
+
- zoxideが無効な場合は適切なメッセージが表示されます
|
272
|
+
- 履歴が空の場合も適切にハンドリングされます
|
273
|
+
|
228
274
|
### 必要な外部ツール
|
229
275
|
|
230
|
-
|
276
|
+
検索機能・履歴機能を使用するには、以下のツールが必要です:
|
231
277
|
|
232
278
|
```bash
|
233
279
|
# macOS (Homebrew)
|
234
|
-
brew install fzf rga
|
280
|
+
brew install fzf rga zoxide
|
235
281
|
|
236
282
|
# Ubuntu/Debian
|
237
|
-
apt install fzf
|
283
|
+
apt install fzf zoxide
|
238
284
|
# rgaは別途インストールが必要: https://github.com/phiresky/ripgrep-all
|
239
285
|
|
240
286
|
# その他のLinuxディストリビューション
|
241
287
|
# パッケージマネージャーまたは手動インストールが必要
|
242
288
|
```
|
243
289
|
|
290
|
+
#### 各ツールの用途
|
291
|
+
|
292
|
+
- **fzf**: ファイル名検索機能(`s`キー)
|
293
|
+
- **rga**: ファイル内容検索機能(`F`キー)
|
294
|
+
- **zoxide**: ディレクトリ履歴移動機能(`z`キー)
|
295
|
+
|
244
296
|
## 設定
|
245
297
|
|
246
298
|
### 色設定(カスタマイズ)
|
data/README_EN.md
CHANGED
@@ -105,6 +105,19 @@ beniya --help # Show help message
|
|
105
105
|
| `f` | File name search with fzf (with preview) |
|
106
106
|
| `F` | File content search with rga |
|
107
107
|
|
108
|
+
#### Bookmark Functions
|
109
|
+
|
110
|
+
| Key | Function |
|
111
|
+
| ------- | ------------------------------- |
|
112
|
+
| `b` | Show bookmark menu |
|
113
|
+
| `1`-`9` | Go to corresponding bookmark |
|
114
|
+
|
115
|
+
#### zoxide Integration
|
116
|
+
|
117
|
+
| Key | Function |
|
118
|
+
| --- | ---------------------------------- |
|
119
|
+
| `z` | Select directory from zoxide history |
|
120
|
+
|
108
121
|
#### System Operations
|
109
122
|
|
110
123
|
| Key | Function |
|
@@ -198,22 +211,89 @@ The directory where beniya starts becomes the **base directory**, which serves a
|
|
198
211
|
- Searches PDFs, Word documents, text in images, and more
|
199
212
|
- Filter results with fzf and jump to specific lines
|
200
213
|
|
214
|
+
### Bookmark Features
|
215
|
+
|
216
|
+
#### Bookmark Operations (`b`)
|
217
|
+
|
218
|
+
- **Add Bookmark**: `[A]` - Add current directory to bookmarks
|
219
|
+
- **List Bookmarks**: `[L]` - Display registered bookmarks
|
220
|
+
- **Remove Bookmark**: `[R]` - Remove a bookmark
|
221
|
+
- **Number Jump**: `1-9` - Jump directly to corresponding bookmark
|
222
|
+
|
223
|
+
#### Quick Navigation (`1`-`9`)
|
224
|
+
|
225
|
+
- Jump directly to bookmarks without going through the bookmark menu
|
226
|
+
- Supports up to 9 bookmarks
|
227
|
+
- Bookmark information is displayed at the top of the screen
|
228
|
+
|
229
|
+
#### Bookmark Persistence
|
230
|
+
|
231
|
+
- Bookmark information is automatically saved to `~/.config/beniya/bookmarks.json`
|
232
|
+
- Bookmark information is preserved after beniya restarts
|
233
|
+
- JSON file can be edited directly
|
234
|
+
|
235
|
+
### zoxide Integration Features
|
236
|
+
|
237
|
+
#### zoxide History Navigation (`z`)
|
238
|
+
|
239
|
+
- **Smart History**: Display directory navigation history recorded by zoxide
|
240
|
+
- **Frequency Order**: More frequently used directories appear higher in the list
|
241
|
+
- **Interactive Selection**: Select from history using floating window
|
242
|
+
- **Quick Navigation**: Select directories directly with number keys
|
243
|
+
- **Abbreviated Path Display**: Home directory shown as `~` for readability
|
244
|
+
|
245
|
+
#### Usage Example
|
246
|
+
|
247
|
+
```
|
248
|
+
1. z → Display zoxide history menu
|
249
|
+
2. 1-20 → Select directory by displayed number
|
250
|
+
3. ESC → Cancel and return to original screen
|
251
|
+
```
|
252
|
+
|
253
|
+
#### About zoxide
|
254
|
+
|
255
|
+
[zoxide](https://github.com/ajeetdsouza/zoxide) is a smart cd command that learns your directory navigation habits.
|
256
|
+
|
257
|
+
```bash
|
258
|
+
# Installing zoxide
|
259
|
+
# macOS (Homebrew)
|
260
|
+
brew install zoxide
|
261
|
+
|
262
|
+
# Ubuntu/Debian
|
263
|
+
apt install zoxide
|
264
|
+
|
265
|
+
# For other installation methods, see official documentation
|
266
|
+
# https://github.com/ajeetdsouza/zoxide#installation
|
267
|
+
```
|
268
|
+
|
269
|
+
#### Requirements
|
270
|
+
|
271
|
+
- zoxide must be installed on the system
|
272
|
+
- Appropriate message is displayed when zoxide is not available
|
273
|
+
- Empty history is handled gracefully
|
274
|
+
|
201
275
|
### Required External Tools
|
202
276
|
|
203
|
-
The following tools are required for search functionality:
|
277
|
+
The following tools are required for search and history functionality:
|
204
278
|
|
205
279
|
```bash
|
206
280
|
# macOS (Homebrew)
|
207
|
-
brew install fzf rga
|
281
|
+
brew install fzf rga zoxide
|
208
282
|
|
209
283
|
# Ubuntu/Debian
|
210
|
-
apt install fzf
|
284
|
+
apt install fzf zoxide
|
211
285
|
# rga requires separate installation: https://github.com/phiresky/ripgrep-all
|
212
286
|
|
213
287
|
# Other Linux distributions
|
214
288
|
# Installation via package manager or manual installation required
|
215
289
|
```
|
216
290
|
|
291
|
+
#### Tool Usage
|
292
|
+
|
293
|
+
- **fzf**: File name search functionality (`f` key)
|
294
|
+
- **rga**: File content search functionality (`F` key)
|
295
|
+
- **zoxide**: Directory history navigation functionality (`z` key)
|
296
|
+
|
217
297
|
## Configuration
|
218
298
|
|
219
299
|
### Color Configuration (Customization)
|
data/lib/beniya/config.rb
CHANGED
@@ -43,8 +43,8 @@ module Beniya
|
|
43
43
|
'ui.operation_prompt' => 'Operation: ',
|
44
44
|
|
45
45
|
# Help text
|
46
|
-
'help.full' => 'j/k:move h:back l:enter o:open g/G:top/bottom r:refresh f:filter s:search F:content a/A:create m/p/x:ops b:bookmark 1-9:goto q:quit',
|
47
|
-
'help.short' => 'j/k:move h:back l:enter o:open f:filter s:search b:bookmark 1-9:goto q:quit',
|
46
|
+
'help.full' => 'j/k:move h:back l:enter o:open g/G:top/bottom r:refresh f:filter s:search F:content a/A:create m/p/x:ops b:bookmark z:zoxide 1-9:goto q:quit',
|
47
|
+
'help.short' => 'j/k:move h:back l:enter o:open f:filter s:search b:bookmark z:zoxide 1-9:goto q:quit',
|
48
48
|
|
49
49
|
# Health check messages
|
50
50
|
'health.title' => 'beniya Health Check',
|
@@ -52,6 +52,7 @@ module Beniya
|
|
52
52
|
'health.required_gems' => 'Required gems',
|
53
53
|
'health.fzf' => 'fzf (file search)',
|
54
54
|
'health.rga' => 'rga (content search)',
|
55
|
+
'health.zoxide' => 'zoxide (directory history)',
|
55
56
|
'health.file_opener' => 'System file opener',
|
56
57
|
'health.summary' => 'Summary:',
|
57
58
|
'health.ok' => 'OK',
|
@@ -111,8 +112,8 @@ module Beniya
|
|
111
112
|
'ui.operation_prompt' => '操作: ',
|
112
113
|
|
113
114
|
# Help text
|
114
|
-
'help.full' => 'j/k:移動 h:戻る l:入る o:開く g/G:先頭/末尾 r:更新 f:絞込 s:検索 F:内容 a/A:作成 m/p/x:操作 b:ブックマーク 1-9:移動 q:終了',
|
115
|
-
'help.short' => 'j/k:移動 h:戻る l:入る o:開く f:絞込 s:検索 b:ブックマーク 1-9:移動 q:終了',
|
115
|
+
'help.full' => 'j/k:移動 h:戻る l:入る o:開く g/G:先頭/末尾 r:更新 f:絞込 s:検索 F:内容 a/A:作成 m/p/x:操作 b:ブックマーク z:zoxide 1-9:移動 q:終了',
|
116
|
+
'help.short' => 'j/k:移動 h:戻る l:入る o:開く f:絞込 s:検索 b:ブックマーク z:zoxide 1-9:移動 q:終了',
|
116
117
|
|
117
118
|
# Health check messages
|
118
119
|
'health.title' => 'beniya ヘルスチェック',
|
@@ -120,6 +121,7 @@ module Beniya
|
|
120
121
|
'health.required_gems' => '必須 gem',
|
121
122
|
'health.fzf' => 'fzf (ファイル検索)',
|
122
123
|
'health.rga' => 'rga (内容検索)',
|
124
|
+
'health.zoxide' => 'zoxide (ディレクトリ履歴)',
|
123
125
|
'health.file_opener' => 'システムファイルオープナー',
|
124
126
|
'health.summary' => 'サマリー:',
|
125
127
|
'health.ok' => 'OK',
|
@@ -20,6 +20,7 @@ module Beniya
|
|
20
20
|
{ name: ConfigLoader.message('health.required_gems'), method: :check_required_gems },
|
21
21
|
{ name: ConfigLoader.message('health.fzf'), method: :check_fzf },
|
22
22
|
{ name: ConfigLoader.message('health.rga'), method: :check_rga },
|
23
|
+
{ name: ConfigLoader.message('health.zoxide'), method: :check_zoxide },
|
23
24
|
{ name: ConfigLoader.message('health.file_opener'), method: :check_file_opener }
|
24
25
|
]
|
25
26
|
|
@@ -118,6 +119,23 @@ module Beniya
|
|
118
119
|
end
|
119
120
|
end
|
120
121
|
|
122
|
+
def check_zoxide
|
123
|
+
if system("which zoxide > /dev/null 2>&1")
|
124
|
+
version = `zoxide --version 2>/dev/null`.strip
|
125
|
+
{
|
126
|
+
status: :ok,
|
127
|
+
message: version,
|
128
|
+
details: nil
|
129
|
+
}
|
130
|
+
else
|
131
|
+
{
|
132
|
+
status: :warning,
|
133
|
+
message: "zoxide #{ConfigLoader.message('health.tool_not_found')}",
|
134
|
+
details: install_instruction_for('zoxide')
|
135
|
+
}
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
121
139
|
def check_file_opener
|
122
140
|
case RUBY_PLATFORM
|
123
141
|
when /darwin/
|
@@ -160,6 +178,8 @@ module Beniya
|
|
160
178
|
"#{ConfigLoader.message('health.install_brew')} fzf"
|
161
179
|
when 'rga'
|
162
180
|
"#{ConfigLoader.message('health.install_brew')} rga"
|
181
|
+
when 'zoxide'
|
182
|
+
"#{ConfigLoader.message('health.install_brew')} zoxide"
|
163
183
|
end
|
164
184
|
when /linux/
|
165
185
|
case tool
|
@@ -167,6 +187,8 @@ module Beniya
|
|
167
187
|
"#{ConfigLoader.message('health.install_apt')} fzf (Ubuntu/Debian) or check your package manager"
|
168
188
|
when 'rga'
|
169
189
|
ConfigLoader.message('health.rga_releases')
|
190
|
+
when 'zoxide'
|
191
|
+
"#{ConfigLoader.message('health.install_apt')} zoxide (Ubuntu/Debian) or check your package manager"
|
170
192
|
end
|
171
193
|
else
|
172
194
|
ConfigLoader.message('health.install_guide')
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'shellwords'
|
3
4
|
require_relative 'bookmark'
|
5
|
+
require_relative 'file_opener'
|
4
6
|
|
5
7
|
module Beniya
|
6
8
|
class KeybindHandler
|
@@ -105,6 +107,8 @@ module Beniya
|
|
105
107
|
delete_selected_files
|
106
108
|
when 'b' # b - bookmark operations
|
107
109
|
show_bookmark_menu
|
110
|
+
when 'z' # z - zoxide history navigation
|
111
|
+
show_zoxide_menu
|
108
112
|
when '1', '2', '3', '4', '5', '6', '7', '8', '9' # number keys - go to bookmark
|
109
113
|
goto_bookmark(key.to_i)
|
110
114
|
else
|
@@ -1045,5 +1049,180 @@ module Beniya
|
|
1045
1049
|
return false
|
1046
1050
|
end
|
1047
1051
|
end
|
1052
|
+
|
1053
|
+
# zoxide 機能
|
1054
|
+
def show_zoxide_menu
|
1055
|
+
history = get_zoxide_history
|
1056
|
+
|
1057
|
+
if history.empty?
|
1058
|
+
show_no_zoxide_history_message
|
1059
|
+
return false
|
1060
|
+
end
|
1061
|
+
|
1062
|
+
# zoxide履歴選択UI
|
1063
|
+
selected_path = select_from_zoxide_history(history)
|
1064
|
+
|
1065
|
+
if selected_path
|
1066
|
+
navigate_to_zoxide_directory(selected_path)
|
1067
|
+
else
|
1068
|
+
false
|
1069
|
+
end
|
1070
|
+
end
|
1071
|
+
|
1072
|
+
private
|
1073
|
+
|
1074
|
+
def zoxide_available?
|
1075
|
+
system('which zoxide > /dev/null 2>&1')
|
1076
|
+
end
|
1077
|
+
|
1078
|
+
def get_zoxide_history
|
1079
|
+
return [] unless zoxide_available?
|
1080
|
+
|
1081
|
+
begin
|
1082
|
+
# zoxide query --list --score で履歴を取得(スコア順)
|
1083
|
+
output = `zoxide query --list --score 2>/dev/null`.strip
|
1084
|
+
return [] if output.empty?
|
1085
|
+
|
1086
|
+
# 各行をパスとスコアに分けて配列に変換
|
1087
|
+
lines = output.split("\n")
|
1088
|
+
history = lines.map do |line|
|
1089
|
+
# zoxide の出力は "スコア パス" の形式
|
1090
|
+
if line.match(/^\s*(\d+(?:\.\d+)?)\s+(.+)$/)
|
1091
|
+
score = $1.to_f
|
1092
|
+
path = $2.strip
|
1093
|
+
{ path: path, score: score }
|
1094
|
+
else
|
1095
|
+
# スコアがない場合はパスのみ(後方互換性)
|
1096
|
+
{ path: line.strip, score: 0.0 }
|
1097
|
+
end
|
1098
|
+
end
|
1099
|
+
|
1100
|
+
# 有効なディレクトリのみフィルタリング
|
1101
|
+
history.select { |entry| Dir.exist?(entry[:path]) }
|
1102
|
+
rescue StandardError
|
1103
|
+
[]
|
1104
|
+
end
|
1105
|
+
end
|
1106
|
+
|
1107
|
+
def show_no_zoxide_history_message
|
1108
|
+
title = 'Zoxide'
|
1109
|
+
content_lines = [
|
1110
|
+
'',
|
1111
|
+
'No zoxide history found.',
|
1112
|
+
'',
|
1113
|
+
'Zoxide learns from your directory navigation.',
|
1114
|
+
'Use zoxide more to build up history.',
|
1115
|
+
'',
|
1116
|
+
'Press any key to continue...'
|
1117
|
+
]
|
1118
|
+
|
1119
|
+
dialog_width = 45
|
1120
|
+
dialog_height = 4 + content_lines.length
|
1121
|
+
x, y = get_screen_center(dialog_width, dialog_height)
|
1122
|
+
|
1123
|
+
draw_floating_window(x, y, dialog_width, dialog_height, title, content_lines, {
|
1124
|
+
border_color: "\e[33m", # 黄色
|
1125
|
+
title_color: "\e[1;33m", # 太字黄色
|
1126
|
+
content_color: "\e[37m" # 白色
|
1127
|
+
})
|
1128
|
+
|
1129
|
+
STDIN.getch
|
1130
|
+
clear_floating_window_area(x, y, dialog_width, dialog_height)
|
1131
|
+
@terminal_ui&.refresh_display
|
1132
|
+
end
|
1133
|
+
|
1134
|
+
def select_from_zoxide_history(history)
|
1135
|
+
title = 'Zoxide History'
|
1136
|
+
|
1137
|
+
# 履歴を表示用に整形(最大20件)
|
1138
|
+
display_history = history.first(20)
|
1139
|
+
content_lines = ['']
|
1140
|
+
|
1141
|
+
display_history.each_with_index do |entry, index|
|
1142
|
+
# パスの表示を短縮(ホームディレクトリを ~ に置換)
|
1143
|
+
display_path = entry[:path].gsub(ENV['HOME'], '~')
|
1144
|
+
line = " #{index + 1}. #{display_path}"
|
1145
|
+
# 長すぎる場合は切り詰め
|
1146
|
+
line = line[0...60] + '...' if line.length > 63
|
1147
|
+
content_lines << line
|
1148
|
+
end
|
1149
|
+
|
1150
|
+
content_lines << ''
|
1151
|
+
content_lines << 'Enter number (1-' + display_history.length.to_s + ') or ESC to cancel'
|
1152
|
+
|
1153
|
+
dialog_width = 70
|
1154
|
+
dialog_height = [4 + content_lines.length, 25].min
|
1155
|
+
x, y = get_screen_center(dialog_width, dialog_height)
|
1156
|
+
|
1157
|
+
draw_floating_window(x, y, dialog_width, dialog_height, title, content_lines, {
|
1158
|
+
border_color: "\e[36m", # シアン色
|
1159
|
+
title_color: "\e[1;36m", # 太字シアン色
|
1160
|
+
content_color: "\e[37m" # 白色
|
1161
|
+
})
|
1162
|
+
|
1163
|
+
# 数字入力モード
|
1164
|
+
input_buffer = ''
|
1165
|
+
|
1166
|
+
loop do
|
1167
|
+
char = STDIN.getch
|
1168
|
+
|
1169
|
+
case char
|
1170
|
+
when "\e", "\x03" # ESC, Ctrl+C
|
1171
|
+
clear_floating_window_area(x, y, dialog_width, dialog_height)
|
1172
|
+
@terminal_ui&.refresh_display
|
1173
|
+
return nil
|
1174
|
+
when "\r", "\n" # Enter
|
1175
|
+
if !input_buffer.empty?
|
1176
|
+
number = input_buffer.to_i
|
1177
|
+
if number > 0 && number <= display_history.length
|
1178
|
+
selected_entry = display_history[number - 1]
|
1179
|
+
clear_floating_window_area(x, y, dialog_width, dialog_height)
|
1180
|
+
@terminal_ui&.refresh_display
|
1181
|
+
return selected_entry[:path]
|
1182
|
+
end
|
1183
|
+
end
|
1184
|
+
# 無効な入力の場合は再度入力を求める
|
1185
|
+
input_buffer = ''
|
1186
|
+
when "\u007f", "\b" # Backspace
|
1187
|
+
input_buffer = input_buffer[0...-1] unless input_buffer.empty?
|
1188
|
+
when /[0-9]/
|
1189
|
+
input_buffer += char
|
1190
|
+
# 最大2桁まで
|
1191
|
+
input_buffer = input_buffer[-2..-1] if input_buffer.length > 2
|
1192
|
+
|
1193
|
+
# 入力された数字が範囲内の場合は即座に選択
|
1194
|
+
number = input_buffer.to_i
|
1195
|
+
if number > 0 && number <= display_history.length &&
|
1196
|
+
(number >= 10 || input_buffer.length == 1)
|
1197
|
+
selected_entry = display_history[number - 1]
|
1198
|
+
clear_floating_window_area(x, y, dialog_width, dialog_height)
|
1199
|
+
@terminal_ui&.refresh_display
|
1200
|
+
return selected_entry[:path]
|
1201
|
+
end
|
1202
|
+
end
|
1203
|
+
end
|
1204
|
+
end
|
1205
|
+
|
1206
|
+
def navigate_to_zoxide_directory(target_path)
|
1207
|
+
return false unless Dir.exist?(target_path)
|
1208
|
+
|
1209
|
+
# DirectoryListingのnavigate_to_pathメソッドを使用してディレクトリに移動
|
1210
|
+
result = @directory_listing.navigate_to_path(target_path)
|
1211
|
+
if result
|
1212
|
+
@current_index = 0
|
1213
|
+
clear_filter_mode
|
1214
|
+
|
1215
|
+
# zoxide に移動を記録
|
1216
|
+
begin
|
1217
|
+
system("zoxide add #{Shellwords.escape(target_path)} > /dev/null 2>&1")
|
1218
|
+
rescue StandardError
|
1219
|
+
# zoxide add が失敗しても移動は成功として扱う
|
1220
|
+
end
|
1221
|
+
|
1222
|
+
true
|
1223
|
+
else
|
1224
|
+
false
|
1225
|
+
end
|
1226
|
+
end
|
1048
1227
|
end
|
1049
1228
|
end
|
data/lib/beniya/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beniya
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- masisz
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-09-
|
10
|
+
date: 2025-09-28 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: io-console
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- CHANGELOG.md
|
120
120
|
- CHANGELOG_v0.4.0.md
|
121
121
|
- CHANGELOG_v0.5.0.md
|
122
|
+
- CHANGELOG_v0.6.0.md
|
122
123
|
- README.md
|
123
124
|
- README_EN.md
|
124
125
|
- Rakefile
|