66 lines
1.5 KiB
Go
66 lines
1.5 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
|
|
"zsvo/cmd"
|
|
"zsvo/pkg/i18n"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
const Version = "0.1.1"
|
|
|
|
var rootCmd = &cobra.Command{
|
|
Use: "zsvo",
|
|
Short: "A simple source-based package manager",
|
|
SilenceErrors: false,
|
|
SilenceUsage: true,
|
|
Long: `A minimal package manager for custom Linux distributions based on LFS
|
|
|
|
Available commands:
|
|
build Build a package from recipe
|
|
install Install package(s) from local files or auto-build by name
|
|
upgrade Upgrade package(s) from package files
|
|
remove Remove installed package(s)
|
|
list List installed packages
|
|
info Show package information
|
|
doctor Check system for potential issues
|
|
cache Manage build cache
|
|
search Search for packages in Debian repositories
|
|
lang Set or display interface language
|
|
help Show help for a command
|
|
`,
|
|
}
|
|
|
|
func init() {
|
|
// Register all commands
|
|
rootCmd.AddCommand(cmd.BuildCmd)
|
|
rootCmd.AddCommand(cmd.InstallCmd)
|
|
rootCmd.AddCommand(cmd.UpgradeCmd)
|
|
rootCmd.AddCommand(cmd.RemoveCmd)
|
|
rootCmd.AddCommand(cmd.ListCmd)
|
|
rootCmd.AddCommand(cmd.InfoCmd)
|
|
rootCmd.AddCommand(cmd.DoctorCmd)
|
|
rootCmd.AddCommand(cmd.CacheCmd)
|
|
rootCmd.AddCommand(cmd.SearchCmd)
|
|
rootCmd.AddCommand(cmd.LangCmd)
|
|
}
|
|
|
|
func main() {
|
|
// Print version
|
|
fmt.Printf("zsvo v%s\n", Version)
|
|
|
|
// Detect language from environment
|
|
i18n.DetectLanguage()
|
|
|
|
// Set up logging
|
|
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
|
|
|
if err := rootCmd.Execute(); err != nil {
|
|
log.Printf("Error: %v", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|