A Go terminal user interface (TUI) application built with Bubble Tea that displays your fish shell command history with a clean, organized interface and powerful search capabilities.
- Fish History Display: Shows the last 5 commands from your fish shell history
- Smart Search: Automatic search mode when typing - no need to press
/first - Clipboard Integration: Copy selected commands to OS clipboard with visual feedback
- Real-time Search: Instant search results as you type
- Beautiful UI: Modern, colorful interface with elegant styling
- Status Messages: Visual feedback for copy operations with auto-hide
- Terminal User Interface: Built with Bubble Tea framework for interactive terminal applications
- Custom Logger Service: Implements a structured logging system with different log levels (DEBUG, INFO, WARN, ERROR)
- Debug Logging: Automatically logs to
debug.logfile for debugging purposes - Modular Architecture: Clean separation of concerns with service and UI layers
- Async Loading: Loads fish history in the background for better user experience
- Go 1.25.1 or later
- A terminal that supports TUI applications
- Fish shell (for history functionality)
- Clone the repository:
git clone https://github.com/abhinavrobinson/bublsrc.git
cd bublsrc- Install dependencies:
go mod tidyRun the application:
go run .The application will automatically load your fish shell history and display the last 5 commands with timestamps.
- Navigation:
↑/↓orCtrl+J/Kto navigate through commands - Search: Start typing to automatically enter search mode
- Copy:
Enterto copy the selected command to clipboard - Search Mode:
Escto exit search mode - Quit:
Ctrl+Cto quit the application
- Start the app - See your recent fish history commands
- Start typing - Automatically enters search mode with real-time filtering
- Navigate results - Use arrow keys to select commands
- Copy commands - Press Enter to copy with visual feedback
- Exit search - Press Esc to return to history view
bublsrc/
├── main.go # Entry point and main function
├── app.go # Main Bubble Tea model and application logic
├── fish_history.go # Fish history UI components
├── fish_history_service.go # Fish history business logic and data operations
├── search_service.go # Search functionality and filtering
├── logger_service.go # Custom logger service implementation
├── go.mod # Go module dependencies
├── go.sum # Dependency checksums
├── run.sh # Convenience script to run the application
└── debug.log # Debug log file (created at runtime)
main.go: Initializes the logger service, creates the app, and runs the Bubble Tea programapp.go: Contains the main Bubble Tea model with Init, Update, and View methods, handles key events and clipboard operationsfish_history.go: Handles fish history UI rendering and user interactions with beautiful stylingfish_history_service.go: Manages fish history parsing, storage, and business logicsearch_service.go: Handles search functionality, filtering, and result managementlogger_service.go: Custom logger service with different log levels and formatted output
The application follows a clean separation of concerns:
- UI Layer (
app.go,fish_history.go): Handles user interface and interactions - Service Layer (
fish_history_service.go,search_service.go,logger_service.go): Manages business logic and data operations - Data Layer: Fish history parsing and storage within the service layer
- Search Layer (
search_service.go): Handles search functionality, filtering, and result management
The custom logger service supports:
- Multiple log levels: DEBUG, INFO, WARN, ERROR
- Formatted logging with
Debugf,Infof,Warnf,Errorf - File output to
debug.log - Timestamp and file location information
- Service-based architecture for better modularity
To extend the application:
- UI Changes: Modify the
Modelstruct inapp.goor add new UI components infish_history.go - Business Logic: Add new methods to
fish_history_service.gofor data operations - New Services: Create new service files following the
*_service.gopattern - Logging: Use the logger service for debugging:
m.logger.Debug("Your debug message")
The application automatically:
- Parses fish history from
~/.local/share/fish/fish_history - Displays the last 5 commands with timestamps by default
- Shows recent commands when entering search mode
- Handles loading states and error conditions
- Formats commands with proper indexing and time display
- Provides real-time search filtering
- Enables clipboard integration for easy command copying
The application uses a custom logger service that writes to both the console and debug.log. You can adjust the log level by changing the level parameter in main.go:
logger := NewLoggerService(logFile, DEBUG) // Change to INFO, WARN, or ERROR- Automatic Search Mode: Just start typing to enter search mode
- Real-time Filtering: Instant results as you type
- Default History: Shows recent commands when no search query
- Case-insensitive: Searches work regardless of case
- One-click Copy: Press Enter to copy selected commands
- Visual Feedback: Status messages show copy success/failure
- Auto-hide Messages: Status messages disappear after 3 seconds
- Cross-platform: Works on macOS, Linux, and Windows
- Modern Design: Clean, colorful interface with elegant styling
- Responsive: Adapts to terminal size
- Status Indicators: Clear visual feedback for all operations
- Consistent Styling: Professional look and feel
- Bubble Tea - A powerful little TUI framework for Go
- Lip Gloss - Style definitions for beautiful terminal applications
- Atotto Clipboard - Cross-platform clipboard operations
This project is open source and available under the MIT License.