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",
|
"mode": "auto",
|
||||||
"program": "${workspaceFolder}/main.go",
|
"program": "${workspaceFolder}/main.go",
|
||||||
"args": [
|
"args": [
|
||||||
"--address", ":80",
|
|
||||||
"--memory", "1G",
|
"--memory", "1G",
|
||||||
"--disk", "10G",
|
"--disk", "10G",
|
||||||
"--disk-path", "tmp/disk",
|
"--disk-path", "tmp/disk",
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
address string
|
|
||||||
memory string
|
memory string
|
||||||
memorymultiplier int
|
memorymultiplier int
|
||||||
disk string
|
disk string
|
||||||
@@ -47,7 +46,7 @@ var rootCmd = &cobra.Command{
|
|||||||
significantly improving download times and reducing the load on the internet connection.`,
|
significantly improving download times and reducing the load on the internet connection.`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
sc := steamcache.New(
|
sc := steamcache.New(
|
||||||
address,
|
":80",
|
||||||
memory,
|
memory,
|
||||||
memorymultiplier,
|
memorymultiplier,
|
||||||
disk,
|
disk,
|
||||||
@@ -68,7 +67,6 @@ func Execute() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
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().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().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().StringVarP(&disk, "disk", "d", "10GB", "The size of the disk cache")
|
||||||
|
|||||||
Reference in New Issue
Block a user