beniya 0.3.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e937b12eb5f1aa3425c8dd832cb7bd11396dfd86b6e232de58fe771c3da47a2
4
- data.tar.gz: 1c41f33e6419d9458c778e8d7937472ad29e4f6d49ffcca12f1e78fac07f16ca
3
+ metadata.gz: 33133a54577671b4c46cb252c7cfc37361b6ec3023ce172b719d8013cbb376a8
4
+ data.tar.gz: 474519fcc81a04375103ef96a8c356f7ba00057e42c13b4779ec3dc78c462662
5
5
  SHA512:
6
- metadata.gz: 272779c673aa653ffeada51b3f46ff4da876d2107310fd79460d1f3a50eae6690dd60d3c21fb9f9ff21ab6914e5baab7ac96c54cb273c68c0b4859d95cb66077
7
- data.tar.gz: 4bf52e383efe9457ec8e0b46b90a5b0742eddd48a222197d83de6e374942cefb92df4c802cd40bb3b047c6e4180311e87a326fd1eabfb453f9b5bac3938d8dd6
6
+ metadata.gz: a4150553b51268cc0e8e9c73d4c5fc47907859f3c3669a1dbe7981a37ae23a5ad1463bedcbc3f71a11ec3414589055bde7ea6cd85ff4e17127f91bf017f9fe6b
7
+ data.tar.gz: 6b69ee230c39f508a6eb70d210dfc7b8401e4014bd86b2ba083dd32458d6ff514c292d5c679966da74229640999b9f3d57096ca6bbdaf7e6739289166d595151
data/CHANGELOG.md ADDED
@@ -0,0 +1,124 @@
1
+ # Changelog
2
+
3
+ All notable changes to beniya will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.5.0] - 2025-01-20
11
+
12
+ ### Added
13
+ - **🔖 Bookmark System**: Complete bookmark functionality with persistent storage
14
+ - **Interactive Bookmark Menu**: Floating dialog with Add/List/Remove operations (`b` key)
15
+ - **Quick Navigation**: Number keys (1-9) for instant bookmark jumping
16
+ - **Persistent Storage**: Automatic save/load to `~/.config/beniya/bookmarks.json`
17
+ - **Comprehensive Test Suite**: Full TDD implementation with 15+ test cases
18
+ - **Multi-language Support**: English and Japanese bookmark interface
19
+ - **Safety Features**: Duplicate checking, path validation, error handling
20
+
21
+ ### Changed
22
+ - **Updated Help Messages**: Latest keybindings including bookmark operations
23
+ - **Enhanced KeybindHandler**: Integrated bookmark menu and navigation
24
+ - **Improved DirectoryListing**: Added `navigate_to_path` method for bookmark jumps
25
+ - **UI Layout Optimization**: Removed 3rd header row for cleaner interface
26
+ - **Documentation Updates**: Comprehensive README updates with bookmark usage
27
+
28
+ ### Technical Details
29
+ - New `Bookmark` class with full CRUD operations
30
+ - Maximum 9 bookmarks with automatic sorting
31
+ - Floating window system for bookmark management
32
+ - Integration with existing terminal UI components
33
+ - **Detailed changelog**: [CHANGELOG_v0.5.0.md](./CHANGELOG_v0.5.0.md)
34
+
35
+ ## [0.4.0] - 2025-01-13
36
+
37
+ ### Added
38
+ - **Floating Dialog System**: Modern floating confirmation dialogs for delete operations
39
+ - **Enhanced Delete Operations**: Comprehensive error handling with file system verification
40
+ - **English-Only Interface**: Complete localization to English, removing multi-language complexity
41
+ - **Character Width Calculation**: Proper Japanese character width handling for UI rendering
42
+ - **Debug Support**: `BENIYA_DEBUG=1` environment variable for detailed logging
43
+ - **Real-time Result Display**: Success/failure counts in floating dialogs
44
+ - **Post-deletion Verification**: File system checks to ensure actual deletion
45
+ - **HSL Color Model Support**: Intuitive color configuration with HSL values
46
+
47
+ ### Changed
48
+ - **All UI messages converted to English** from Japanese
49
+ - **Delete confirmation workflow** now uses floating dialogs instead of command-line prompts
50
+ - **Error messages standardized** to English across all components
51
+ - **Documentation updated** to reflect English-only interface
52
+ - **Code style unified** with single quotes throughout
53
+
54
+ ### Removed
55
+ - **Multi-language support** configuration and related code
56
+ - **Language setting environment variables** (`BENIYA_LANG`)
57
+ - **Language configuration files** support
58
+ - **Japanese UI messages** and localization infrastructure
59
+
60
+ ### Technical
61
+ - **+290 lines** of new functionality in core keybind handler
62
+ - **New test files** for floating dialog system and delete operations
63
+ - **Enhanced error handling** patterns throughout codebase
64
+ - **Improved file system safety** checks and validation
65
+
66
+ For detailed information, see [CHANGELOG_v0.4.0.md](./CHANGELOG_v0.4.0.md)
67
+
68
+ ## [0.3.0] - 2024-XX-XX
69
+
70
+ ### Added
71
+ - Enhanced file operations and management features
72
+ - Improved user interface and navigation
73
+ - Additional configuration options
74
+
75
+ ### Changed
76
+ - Performance improvements
77
+ - Bug fixes and stability enhancements
78
+
79
+ ## [0.2.0] - 2024-XX-XX
80
+
81
+ ### Added
82
+ - New features and functionality improvements
83
+ - Enhanced file management capabilities
84
+
85
+ ### Changed
86
+ - User interface improvements
87
+ - Performance optimizations
88
+
89
+ ## [0.1.0] - 2024-XX-XX
90
+
91
+ ### Added
92
+ - Initial release of beniya
93
+ - Basic file manager functionality
94
+ - Vim-like key bindings
95
+ - File preview capabilities
96
+ - Multi-platform support
97
+
98
+ ---
99
+
100
+ ## Release Links
101
+
102
+ - [v0.4.0 Detailed Release Notes](./CHANGELOG_v0.4.0.md) - Comprehensive changelog with technical details
103
+ - [GitHub Releases](https://github.com/masisz/beniya/releases) - Download releases and view release history
104
+ - [Installation Guide](./README.md#installation) - How to install beniya
105
+ - [Usage Documentation](./README.md#usage) - Complete usage guide
106
+
107
+ ## Version Numbering
108
+
109
+ beniya follows [Semantic Versioning](https://semver.org/):
110
+
111
+ - **MAJOR** version for incompatible API changes
112
+ - **MINOR** version for backwards-compatible functionality additions
113
+ - **PATCH** version for backwards-compatible bug fixes
114
+
115
+ ## Contributing
116
+
117
+ When contributing to beniya:
118
+
119
+ 1. Update the **[Unreleased]** section with your changes
120
+ 2. Follow the existing changelog format
121
+ 3. Link to detailed release notes for major versions
122
+ 4. Include migration notes for breaking changes
123
+
124
+ For more information, see [Contributing Guidelines](./README.md#contributing).
@@ -0,0 +1,146 @@
1
+ # beniya v0.4.0 Release Notes
2
+
3
+ ## 🎉 Major Features & Improvements
4
+
5
+ ### 🪟 Floating Dialog System
6
+ - **New floating confirmation dialogs** for delete operations
7
+ - **Visual feedback** with red borders and warning colors for dangerous operations
8
+ - **Intuitive keyboard controls**: Y/N confirmation, ESC to cancel
9
+ - **Auto-centering** and responsive dialog sizing
10
+ - **Modern UI experience** replacing command-line prompts
11
+
12
+ ### 🗑️ Enhanced Delete Operations
13
+ - **Comprehensive error handling** with detailed error messages
14
+ - **File system verification** to ensure actual deletion before reporting success
15
+ - **Real-time result display** showing success/failure counts in floating dialogs
16
+ - **Post-deletion verification** with 10ms filesystem sync delay
17
+ - **Debug support** with `BENIYA_DEBUG=1` environment variable
18
+ - **Atomic operations** with proper rollback on partial failures
19
+
20
+ ### 🌐 English-Only Interface
21
+ - **Complete localization cleanup** - removed multi-language support
22
+ - **All UI messages converted to English**:
23
+ - `削除確認` → `Delete Confirmation`
24
+ - `移動/コピー` → `Move/Copy`
25
+ - `ファイルが見つかりません` → `File not found`
26
+ - `削除に失敗しました` → `Deletion failed`
27
+ - **Cleaner codebase** without language configuration complexity
28
+ - **Consistent English terminology** throughout the application
29
+
30
+ ### 🎨 UI/UX Improvements
31
+ - **Japanese character width calculation** for proper text rendering
32
+ - **HSL color model support** for intuitive color configuration
33
+ - **Multi-byte character handling** improvements
34
+ - **Better visual hierarchy** with color-coded operation results
35
+ - **Screen-aware positioning** for floating dialogs
36
+
37
+ ## 🔧 Technical Improvements
38
+
39
+ ### Code Quality
40
+ - **Unified code style** with single quotes throughout
41
+ - **Enhanced error handling** patterns
42
+ - **Improved file system safety** checks
43
+ - **Better separation of concerns** between UI and business logic
44
+
45
+ ### Testing & Debugging
46
+ - **New test files**:
47
+ - `test/test_floating_dialog.rb` - Floating dialog system tests
48
+ - `test/debug_delete_timing.rb` - Delete operation timing and verification tests
49
+ - **Debug logging system** with detailed operation tracking
50
+ - **Environment-based debug controls**
51
+
52
+ ### Architecture
53
+ - **Modular floating window system** (`draw_floating_window`, `clear_floating_window_area`)
54
+ - **Character width calculation utilities** (`display_width`, `pad_string_to_width`)
55
+ - **Screen positioning utilities** (`get_screen_center`)
56
+ - **Enhanced deletion workflow** with proper state management
57
+
58
+ ## 📚 Documentation Updates
59
+
60
+ ### README Improvements
61
+ - **Removed multi-language configuration** sections
62
+ - **Added detailed delete operation documentation**:
63
+ - Floating dialog workflow
64
+ - Safety features
65
+ - Error handling
66
+ - Debug support
67
+ - **Updated feature descriptions** to reflect English-only interface
68
+ - **Enhanced safety features documentation**
69
+
70
+ ### Both English and Japanese READMEs Updated
71
+ - **Consistent documentation** across languages
72
+ - **New operation workflow** diagrams
73
+ - **Comprehensive feature descriptions**
74
+ - **Updated installation and usage instructions**
75
+
76
+ ## 🛠️ Breaking Changes
77
+
78
+ ### Removed Features
79
+ - ❌ **Multi-language support** configuration removed
80
+ - ❌ **Language setting environment variables** (`BENIYA_LANG`)
81
+ - ❌ **Language configuration files** support
82
+ - ❌ **Japanese UI messages** (now English-only)
83
+
84
+ ### Configuration Changes
85
+ - 🔄 **Simplified configuration** - no more language settings required
86
+ - 🔄 **Removed language priority system**
87
+ - 🔄 **Streamlined color configuration** (HSL support added)
88
+
89
+ ## 📊 Statistics
90
+
91
+ ### Code Changes
92
+ - **+290 lines** in `lib/beniya/keybind_handler.rb` (586 → 876 lines)
93
+ - **Multiple files updated** across the codebase
94
+ - **New test files** added for quality assurance
95
+ - **Documentation updates** in both languages
96
+
97
+ ### Files Modified
98
+ - `lib/beniya/keybind_handler.rb` - Core functionality expansion
99
+ - `lib/beniya/terminal_ui.rb` - UI message updates
100
+ - `lib/beniya/file_opener.rb` - Error message localization
101
+ - `README.md` & `README_EN.md` - Documentation updates
102
+ - `test/` - New test files added
103
+
104
+ ## 🚀 Migration Guide
105
+
106
+ ### For Users
107
+ 1. **No action required** - existing installations will work seamlessly
108
+ 2. **Language settings** in config files will be ignored (no errors)
109
+ 3. **Environment variables** like `BENIYA_LANG` will have no effect
110
+ 4. **All UI will be in English** regardless of system locale
111
+
112
+ ### For Developers
113
+ 1. **Remove language-related configuration** from your setup
114
+ 2. **Update any scripts** that relied on Japanese output parsing
115
+ 3. **Use new debug environment variable**: `BENIYA_DEBUG=1`
116
+ 4. **Test with new floating dialog system**
117
+
118
+ ## 🎯 What's Next
119
+
120
+ This release establishes beniya as a modern, English-focused file manager with:
121
+ - ✅ **Consistent user experience** across all environments
122
+ - ✅ **Modern UI patterns** with floating dialogs
123
+ - ✅ **Enhanced safety** for file operations
124
+ - ✅ **Better debugging capabilities**
125
+ - ✅ **Improved maintainability** without multi-language complexity
126
+
127
+ ---
128
+
129
+ **Release Date**: 2025-01-13
130
+ **Version**: 0.4.0
131
+ **Previous Version**: 0.3.0
132
+ **Compatibility**: Ruby 2.7.0+
133
+
134
+ ## 📥 Installation
135
+
136
+ ```bash
137
+ gem install beniya --version 0.4.0
138
+ ```
139
+
140
+ ## 🐛 Bug Reports
141
+
142
+ Please report issues at: https://github.com/masisz/beniya/issues
143
+
144
+ ---
145
+
146
+ *This release represents a significant step forward in beniya's evolution, focusing on modern UI patterns, safety, and maintainability while streamlining the user experience.*
@@ -0,0 +1,26 @@
1
+ # beniya v0.5.0 - Release Notes
2
+
3
+ ## Added
4
+ - **Bookmark System**: Complete bookmark functionality for quick directory navigation
5
+ - **Interactive Bookmark Menu**: Floating dialog accessed via `b` key with Add/List/Remove operations
6
+ - **Quick Navigation**: Number keys (1-9) for instant bookmark jumping
7
+ - **Persistent Storage**: Automatic save/load bookmarks to `~/.config/beniya/bookmarks.json`
8
+ - **Bookmark Management**: Add current directory with custom names, list all bookmarks, remove by selection
9
+ - **Safety Features**: Duplicate name/path checking, directory existence validation, maximum 9 bookmarks limit
10
+ - **Multi-language Support**: English and Japanese bookmark interface messages
11
+ - **Comprehensive Test Suite**: Full TDD implementation with 15+ test cases covering all bookmark operations
12
+ - **Error Handling**: Graceful handling of non-existent paths, permission errors, and invalid inputs
13
+
14
+ ## Changed
15
+ - **Help Messages Updated**: Latest keybinding information including bookmark operations in footer
16
+ - **KeybindHandler Enhanced**: Integrated bookmark menu and direct navigation functionality
17
+ - **DirectoryListing Improved**: Added `navigate_to_path` method for bookmark-based navigation
18
+ - **UI Layout Optimized**: Removed 3rd header row displaying bookmark shortcuts for cleaner interface
19
+ - **Documentation Updated**: Comprehensive README updates with bookmark usage examples and workflows
20
+
21
+ ## Technical Implementation
22
+ - New `Bookmark` class with full CRUD operations and JSON persistence
23
+ - Floating window system for bookmark management dialogs
24
+ - Integration with existing terminal UI components and color system
25
+ - Automatic bookmark sorting by name for consistent display
26
+ - File system verification and path expansion for reliability
data/README.md CHANGED
@@ -19,7 +19,6 @@ beniyaは、Yaziにインスパイアされたターミナル上で動作する
19
19
  - **高度な検索機能**: fzfとrgaを使った強力な検索
20
20
  - **マルチプラットフォーム**: macOS、Linux、Windowsで動作
21
21
  - **外部エディタ連携**: お気に入りのエディタでファイルを開く
22
- - **多言語対応**: 日本語・英語インターフェース
23
22
  - **ヘルスチェック**: システム依存関係の確認機能
24
23
 
25
24
  ## インストール
@@ -105,6 +104,13 @@ beniya --help # ヘルプメッセージを表示
105
104
  | `f` | fzfによるファイル名検索(プレビュー付き) |
106
105
  | `F` | rgaによるファイル内容検索 |
107
106
 
107
+ #### ブックマーク機能
108
+
109
+ | キー | 機能 |
110
+ | --------- | ---------------------------- |
111
+ | `b` | ブックマークメニューを表示 |
112
+ | `1`-`9` | 対応する番号のブックマークに移動 |
113
+
108
114
  #### システム操作
109
115
 
110
116
  | キー | 機能 |
@@ -130,6 +136,16 @@ beniya起動時のディレクトリが**ベースディレクトリ**として
130
136
  | **コピー** | `p` | 選択したアイテムをベースディレクトリにコピー |
131
137
  | **削除** | `x` | 選択したアイテムを削除 |
132
138
 
139
+ #### 削除操作の詳細
140
+
141
+ - **フローティングダイアログ確認**: モダンなフローティングウィンドウで明確な選択肢を表示
142
+ - **視覚的フィードバック**: 赤い枠線と警告色で注意を引く
143
+ - **安全な操作**: 削除前のダブルチェック
144
+ - **包括的エラーハンドリング**: 削除失敗時の詳細なエラーメッセージ
145
+ - **リアルタイム結果表示**: フローティングダイアログで成功/失敗数を表示
146
+ - **ファイルシステム検証**: 成功報告前に実際の削除を確認
147
+ - **デバッグサポート**: BENIYA_DEBUG=1でオプションのデバッグログ出力
148
+
133
149
  #### 操作の流れ
134
150
 
135
151
  ```
@@ -138,16 +154,18 @@ beniya起動時のディレクトリが**ベースディレクトリ**として
138
154
  - m → ベースディレクトリに移動
139
155
  - p → ベースディレクトリにコピー
140
156
  - x → 削除
141
- 3. y/n確認ダイアログで実行/キャンセル
142
- 4. 結果表示 → 処理結果を確認
157
+ 3. フローティングダイアログY/Nで確認、ESCでキャンセル
158
+ 4. 結果表示 → フローティングウィンドウで操作結果を確認
143
159
  ```
144
160
 
145
161
  #### 安全機能
146
162
 
147
- - **確認ダイアログ**: 移動・コピー・削除前に必ず確認
163
+ - **フローティング確認ダイアログ**: 確認用のモダンなフローティングウィンドウインターフェース
164
+ - **視覚警告システム**: 危険な操作時の赤い枠線と警告色
148
165
  - **重複チェック**: 同名ファイルがある場合は自動でスキップ
149
166
  - **エラーハンドリング**: 権限不足などのエラーに適切に対応
150
- - **操作ログ**: 処理結果を詳細に表示
167
+ - **操作ログ**: フローティングダイアログで処理結果を詳細表示
168
+ - **削除後検証**: ファイルシステムから実際に削除されたことを確認
151
169
 
152
170
  ### フィルター機能の詳細
153
171
 
@@ -186,6 +204,27 @@ beniya起動時のディレクトリが**ベースディレクトリ**として
186
204
  - PDF、Word文書、画像内テキストなども検索対象
187
205
  - 検索結果をfzfで絞り込み、該当行にジャンプしてファイルを開く
188
206
 
207
+ ### ブックマーク機能の詳細
208
+
209
+ #### ブックマーク操作 (`b`)
210
+
211
+ - **ブックマーク追加**: `[A]` - 現在のディレクトリをブックマークに追加
212
+ - **ブックマーク一覧**: `[L]` - 登録済みブックマークの一覧表示
213
+ - **ブックマーク削除**: `[R]` - ブックマークを削除
214
+ - **番号ジャンプ**: `1-9` - 対応する番号のブックマークに直接移動
215
+
216
+ #### 高速ナビゲーション (`1`-`9`)
217
+
218
+ - ブックマークメニューを経由せず、数字キーでブックマークに直接ジャンプ
219
+ - 最大9個のブックマークをサポート
220
+ - ブックマーク情報は画面上部に表示
221
+
222
+ #### ブックマークの永続化
223
+
224
+ - ブックマーク情報は `~/.config/beniya/bookmarks.json` に自動保存
225
+ - beniya再起動後もブックマーク情報が保持される
226
+ - JSONファイルを直接編集することも可能
227
+
189
228
  ### 必要な外部ツール
190
229
 
191
230
  検索機能を使用するには、以下のツールが必要です:
@@ -204,39 +243,6 @@ apt install fzf
204
243
 
205
244
  ## 設定
206
245
 
207
- ### 言語設定
208
-
209
- beniyaは多言語対応しています。言語は以下の方法で設定できます:
210
-
211
- #### 環境変数(推奨)
212
-
213
- ```bash
214
- # 日本語
215
- export BENIYA_LANG=ja
216
-
217
- # 英語(デフォルト)
218
- export BENIYA_LANG=en
219
- ```
220
-
221
- #### 設定ファイル
222
-
223
- ```bash
224
- # 設定ディレクトリを作成
225
- mkdir -p ~/.config/beniya
226
-
227
- # 設定例をコピー
228
- cp config_example.rb ~/.config/beniya/config.rb
229
-
230
- # 設定ファイルを編集
231
- # 日本語の場合は LANGUAGE = 'ja'、英語の場合は LANGUAGE = 'en' を設定
232
- ```
233
-
234
- ### 優先順位
235
-
236
- 1. 設定ファイル(`~/.config/beniya/config.rb`)
237
- 2. `BENIYA_LANG`環境変数
238
- 3. デフォルト(英語)
239
-
240
246
  ### 色設定(カスタマイズ)
241
247
 
242
248
  beniyaではファイルタイプや UI 要素の色をカスタマイズできます。HSLカラーモデルによる直感的な色指定をサポートしています。
data/README_EN.md CHANGED
@@ -19,7 +19,7 @@ beniya is a terminal-based file manager inspired by Yazi. It's implemented in Ru
19
19
  - **Advanced Search**: Powerful search using fzf and rga
20
20
  - **Multi-platform**: Runs on macOS, Linux, and Windows
21
21
  - **External Editor Integration**: Open files with your favorite editor
22
- - **Multi-language Support**: English and Japanese interface
22
+ - **English Interface**: Clean English interface
23
23
  - **Health Check**: System dependency verification
24
24
 
25
25
  ## Installation
@@ -130,6 +130,16 @@ The directory where beniya starts becomes the **base directory**, which serves a
130
130
  | **Copy** | `p` | Copy selected items to base directory |
131
131
  | **Delete** | `x` | Delete selected items |
132
132
 
133
+ #### Delete Operation Details
134
+
135
+ - **Floating Dialog Confirmation**: Modern floating window with clear options
136
+ - **Visual Feedback**: Red border and warning colors for attention
137
+ - **Safe Operation**: Double confirmation before deletion
138
+ - **Comprehensive Error Handling**: Detailed error messages for failed deletions
139
+ - **Real-time Result Display**: Shows success/failure count in floating dialog
140
+ - **File System Verification**: Confirms actual deletion before reporting success
141
+ - **Debug Support**: Optional debug logging with BENIYA_DEBUG=1
142
+
133
143
  #### Operation Workflow
134
144
 
135
145
  ```
@@ -138,16 +148,18 @@ The directory where beniya starts becomes the **base directory**, which serves a
138
148
  - m → Move to base directory
139
149
  - p → Copy to base directory
140
150
  - x → Delete
141
- 3. y/n → Confirm or cancel in confirmation dialog
142
- 4. Result Display → Review operation results
151
+ 3. Floating Dialog → Confirm with Y/N, ESC to cancel
152
+ 4. Result Display → Review operation results in floating window
143
153
  ```
144
154
 
145
155
  #### Safety Features
146
156
 
147
- - **Confirmation Dialog**: Always confirm before move/copy/delete operations
157
+ - **Floating Confirmation Dialog**: Modern floating window interface for confirmations
158
+ - **Visual Warning System**: Red borders and colors for dangerous operations
148
159
  - **Duplicate Check**: Automatically skip files with same names
149
160
  - **Error Handling**: Proper handling of permission errors and other issues
150
- - **Operation Log**: Detailed display of operation results
161
+ - **Operation Log**: Detailed display of operation results in floating dialogs
162
+ - **Post-deletion Verification**: Confirms files are actually deleted from filesystem
151
163
 
152
164
  ### Filter Feature
153
165
 
@@ -204,39 +216,6 @@ apt install fzf
204
216
 
205
217
  ## Configuration
206
218
 
207
- ### Language Settings
208
-
209
- beniya supports multiple languages. You can configure the language in several ways:
210
-
211
- #### Environment Variable (Recommended)
212
-
213
- ```bash
214
- # Japanese
215
- export BENIYA_LANG=ja
216
-
217
- # English (default)
218
- export BENIYA_LANG=en
219
- ```
220
-
221
- #### Configuration File
222
-
223
- ```bash
224
- # Create config directory
225
- mkdir -p ~/.config/beniya
226
-
227
- # Copy example config
228
- cp config_example.rb ~/.config/beniya/config.rb
229
-
230
- # Edit the config file
231
- # Set LANGUAGE = 'ja' for Japanese or LANGUAGE = 'en' for English
232
- ```
233
-
234
- ### Priority Order
235
-
236
- 1. Configuration file (`~/.config/beniya/config.rb`)
237
- 2. `BENIYA_LANG` environment variable
238
- 3. Default (English)
239
-
240
219
  ### Color Configuration (Customization)
241
220
 
242
221
  beniya allows you to customize colors for file types and UI elements. It supports intuitive color specification using the HSL color model.
@@ -0,0 +1,115 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'fileutils'
5
+
6
+ module Beniya
7
+ class Bookmark
8
+ MAX_BOOKMARKS = 9
9
+
10
+ def initialize(config_file = nil)
11
+ @config_file = config_file || default_config_file
12
+ @bookmarks = []
13
+ ensure_config_directory
14
+ load
15
+ end
16
+
17
+ def add(path, name)
18
+ return false if @bookmarks.length >= MAX_BOOKMARKS
19
+ return false if exists_by_name?(name)
20
+ return false if exists_by_path?(path)
21
+ return false unless Dir.exist?(path)
22
+
23
+ @bookmarks << { path: File.expand_path(path), name: name }
24
+ save
25
+ true
26
+ end
27
+
28
+ def remove(name)
29
+ initial_length = @bookmarks.length
30
+ @bookmarks.reject! { |bookmark| bookmark[:name] == name }
31
+
32
+ if @bookmarks.length < initial_length
33
+ save
34
+ true
35
+ else
36
+ false
37
+ end
38
+ end
39
+
40
+ def get_path(name)
41
+ bookmark = @bookmarks.find { |b| b[:name] == name }
42
+ bookmark&.[](:path)
43
+ end
44
+
45
+ def find_by_number(number)
46
+ return nil unless number.is_a?(Integer)
47
+ return nil if number < 1 || number > @bookmarks.length
48
+
49
+ sorted_bookmarks[number - 1]
50
+ end
51
+
52
+ def list
53
+ sorted_bookmarks
54
+ end
55
+
56
+ def save
57
+ begin
58
+ File.write(@config_file, JSON.pretty_generate(@bookmarks))
59
+ true
60
+ rescue StandardError => e
61
+ warn "Failed to save bookmarks: #{e.message}"
62
+ false
63
+ end
64
+ end
65
+
66
+ def load
67
+ return true unless File.exist?(@config_file)
68
+
69
+ begin
70
+ content = File.read(@config_file)
71
+ @bookmarks = JSON.parse(content, symbolize_names: true)
72
+ @bookmarks = [] unless @bookmarks.is_a?(Array)
73
+
74
+ # 無効なブックマークを除去
75
+ @bookmarks = @bookmarks.select do |bookmark|
76
+ bookmark.is_a?(Hash) &&
77
+ bookmark.key?(:path) &&
78
+ bookmark.key?(:name) &&
79
+ bookmark[:path].is_a?(String) &&
80
+ bookmark[:name].is_a?(String)
81
+ end
82
+
83
+ true
84
+ rescue JSON::ParserError, StandardError => e
85
+ warn "Failed to load bookmarks: #{e.message}"
86
+ @bookmarks = []
87
+ true
88
+ end
89
+ end
90
+
91
+ private
92
+
93
+ def default_config_file
94
+ File.expand_path('~/.config/beniya/bookmarks.json')
95
+ end
96
+
97
+ def ensure_config_directory
98
+ config_dir = File.dirname(@config_file)
99
+ FileUtils.mkdir_p(config_dir) unless Dir.exist?(config_dir)
100
+ end
101
+
102
+ def exists_by_name?(name)
103
+ @bookmarks.any? { |bookmark| bookmark[:name] == name }
104
+ end
105
+
106
+ def exists_by_path?(path)
107
+ expanded_path = File.expand_path(path)
108
+ @bookmarks.any? { |bookmark| bookmark[:path] == expanded_path }
109
+ end
110
+
111
+ def sorted_bookmarks
112
+ @bookmarks.sort_by { |bookmark| bookmark[:name] }
113
+ end
114
+ end
115
+ end
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/Space:open g/G:top/bottom r:refresh q:quit',
47
- 'help.short' => 'j/k:move h:back l:enter o:open q:quit',
46
+ 'help.full' => 'j/k:move h:back l:enter o:open g/G:top/bottom r:refresh s:filter f: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 s:filter b:bookmark 1-9:goto q:quit',
48
48
 
49
49
  # Health check messages
50
50
  'health.title' => 'beniya Health Check',
@@ -111,8 +111,8 @@ module Beniya
111
111
  'ui.operation_prompt' => '操作: ',
112
112
 
113
113
  # Help text
114
- 'help.full' => 'j/k:移動 h:戻る l:入る o/Space:開く g/G:先頭/末尾 r:更新 q:終了',
115
- 'help.short' => 'j/k:移動 h:戻る l:入る o:開く q:終了',
114
+ 'help.full' => 'j/k:移動 h:戻る l:入る o:開く g/G:先頭/末尾 r:更新 s:絞込 f:検索 F:内容 a/A:作成 m/p/x:操作 b:ブックマーク 1-9:移動 q:終了',
115
+ 'help.short' => 'j/k:移動 h:戻る l:入る o:開く s:絞込 b:ブックマーク 1-9:移動 q:終了',
116
116
 
117
117
  # Health check messages
118
118
  'health.title' => 'beniya ヘルスチェック',
@@ -67,6 +67,20 @@ module Beniya
67
67
  end
68
68
  end
69
69
 
70
+ def navigate_to_path(path)
71
+ return false if path.nil? || path.empty?
72
+
73
+ expanded_path = File.expand_path(path)
74
+
75
+ if File.directory?(expanded_path) && File.readable?(expanded_path)
76
+ @current_path = expanded_path
77
+ refresh
78
+ true
79
+ else
80
+ false
81
+ end
82
+ end
83
+
70
84
  private
71
85
 
72
86
  def determine_file_type(path)