mirror of
https://github.com/Valkyrie00/bold-brew.git
synced 2026-03-14 22:35:53 +01:00
* feat: add Brewfile mode for curated package collections This commit introduces Brewfile mode, allowing users to launch bbrew with a curated list of packages using the -f flag. When a Brewfile is provided, the application displays only those packages, enabling themed collections like IDE choosers or developer tool sets. The implementation includes a Brewfile parser for brew and cask entries, automatic filtering of the package catalog, and a refactored API with the IsBrewfileMode() method for cleaner code. Critical bugs were fixed including a synchronization issue between the displayed table and the filtered packages array that caused incorrect package selection. This feature is designed for Project Bluefin integration, providing curated package experiences where users can browse predefined collections. Includes example Brewfiles and comprehensive documentation. * feat: add Install All functionality for Brewfile mode Add ctrl+a keybinding to install all packages from a Brewfile at once, available exclusively in Brewfile mode. * feat: add Remove All for Brewfile mode Add ctrl+r keybinding to batch remove all installed packages from Brewfile with real-time progress counter. Validates packages are installed before proceeding and skips non-installed packages. Available only in Brewfile mode
44 lines
1 KiB
Go
44 lines
1 KiB
Go
package main
|
|
|
|
import (
|
|
"bbrew/internal/services"
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
// Parse command line flags
|
|
brewfilePath := flag.String("f", "", "Path to Brewfile (show only packages from this Brewfile)")
|
|
flag.Parse()
|
|
|
|
// Validate Brewfile path if provided
|
|
if *brewfilePath != "" {
|
|
if _, err := os.Stat(*brewfilePath); os.IsNotExist(err) {
|
|
fmt.Fprintf(os.Stderr, "Error: Brewfile not found: %s\n", *brewfilePath)
|
|
os.Exit(1)
|
|
} else if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Error: Cannot access Brewfile: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
// Initialize app service
|
|
appService := services.NewAppService()
|
|
// Configure Brewfile mode if path was provided
|
|
if *brewfilePath != "" {
|
|
appService.SetBrewfilePath(*brewfilePath)
|
|
}
|
|
|
|
// Boot the application (load Homebrew data)
|
|
if err := appService.Boot(); err != nil {
|
|
log.Fatalf("Failed to initialize: %v", err)
|
|
}
|
|
|
|
// Build and run the TUI
|
|
appService.BuildApp()
|
|
if err := appService.GetApp().Run(); err != nil {
|
|
log.Fatalf("Application error: %v", err)
|
|
}
|
|
}
|