package cmd import ( "os" "s1d3sw1ped/SteamCache2/steamcache" "github.com/spf13/cobra" ) var ( memory string memorymultiplier int disk string diskmultiplier int diskpath string ) var rootCmd = &cobra.Command{ Use: "SteamCache2", Short: "SteamCache2 is a caching solution for Steam game updates and installations", Long: `SteamCache2 is a caching solution designed to optimize the delivery of Steam game updates and installations. It reduces bandwidth usage and speeds up the download process by caching game files locally. This tool is particularly useful for environments with multiple Steam users, such as gaming cafes or households with multiple gamers. By caching game files, SteamCache2 ensures that subsequent downloads of the same files are served from the local cache, significantly improving download times and reducing the load on the internet connection.`, Run: func(cmd *cobra.Command, args []string) { sc := steamcache.New( ":80", memory, memorymultiplier, disk, diskmultiplier, diskpath, ) sc.Run() }, } // Execute adds all child commands to the root command and sets flags appropriately. // This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { err := rootCmd.Execute() if err != nil { os.Exit(1) } } func init() { rootCmd.Flags().StringVarP(&memory, "memory", "m", "100MB", "The size of the memory cache") rootCmd.Flags().IntVarP(&memorymultiplier, "memory-multiplier", "M", 10, "The multiplier for the memory cache") rootCmd.Flags().StringVarP(&disk, "disk", "d", "10GB", "The size of the disk cache") rootCmd.Flags().IntVarP(&diskmultiplier, "disk-multiplier", "D", 10, "The multiplier for the disk cache") rootCmd.Flags().StringVarP(&diskpath, "disk-path", "p", "tmp/steamcache2-disk", "The path to the disk cache") }