refactor: remove address flag and set default value in command configuration
This commit is contained in:
1
.vscode/launch.json
vendored
1
.vscode/launch.json
vendored
@@ -11,7 +11,6 @@
|
||||
"mode": "auto",
|
||||
"program": "${workspaceFolder}/main.go",
|
||||
"args": [
|
||||
"--address", ":80",
|
||||
"--memory", "1G",
|
||||
"--disk", "10G",
|
||||
"--disk-path", "tmp/disk",
|
||||
|
||||
@@ -29,7 +29,6 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
address string
|
||||
memory string
|
||||
memorymultiplier int
|
||||
disk string
|
||||
@@ -47,7 +46,7 @@ var rootCmd = &cobra.Command{
|
||||
significantly improving download times and reducing the load on the internet connection.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
sc := steamcache.New(
|
||||
address,
|
||||
":80",
|
||||
memory,
|
||||
memorymultiplier,
|
||||
disk,
|
||||
@@ -68,7 +67,6 @@ func Execute() {
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.Flags().StringVarP(&address, "address", "a", ":80", "The address to listen on")
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user