$ show joshuathompson/baton
Baton is a CLI tool for controlling Spotify playback with an integrated TUI for browsing and selecting music. The application uses Cobra for command structure, Viper for configuration, and the gocui library for the terminal interface. It interacts with the Spotify Web API to manage playback, search for content, and handle user library operations. The architecture separates API interactions (api package), command-line interface (cmd package), and TUI components (ui package). While functional, the codebase shows signs of aging due to outdated dependencies and tight coupling in some areas, particularly the API package's reliance on Viper for token management.
The LLM identified 3 files worth highlighting for reuse:
Provides generic functions for building HTTP requests and handling JSON responses for REST APIs. Decouples request building from execution, allowing easy integration with any JSON-based API. Demonstrates good separation of concerns by not handling authentication within the client, leaving it to the caller.
Implements a reusable framework for building terminal user interfaces with tabular data and hierarchical navigation. Defines a Table interface for data presentation and includes a run loop with keybindings for navigation, allowing developers to focus on implementing domain-specific table components. Demonstrates a clean separation between the UI framework and the data presentation logic.
Contains utility functions for string manipulation, including Unicode-aware string padding and truncation (LeftPaddedString), which is essential for fixed-width displays in terminal applications. Also includes helper functions for checking string membership and converting milliseconds to time format. Demonstrates attention to detail in handling international text correctly.