diff --git a/.vscode/launch.json b/.vscode/launch.json index 514d5f81..bfe5c199 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -122,6 +122,16 @@ "request": "attach", "port": 9229, "preDebugTask": "func: host start" - } + }, + { + "name": "Debug CLI(cache)", + "type": "go", + "request": "launch", + "mode": "debug", + "program": "${workspaceRoot}/src", + "args": [ + "cache", + ] + }, ] } diff --git a/src/cli/cache.go b/src/cli/cache.go index e8e88654..9d346135 100644 --- a/src/cli/cache.go +++ b/src/cli/cache.go @@ -32,6 +32,10 @@ You can do the following: }, Args: cobra.OnlyValidArgs, Run: func(cmd *cobra.Command, args []string) { + if len(args) == 0 { + _ = cmd.Help() + return + } env := &environment.ShellEnvironment{ Version: cliVersion, } diff --git a/src/cli/get.go b/src/cli/get.go index f7186a5c..a00a59e0 100644 --- a/src/cli/get.go +++ b/src/cli/get.go @@ -27,6 +27,10 @@ This command is used to get the value of the following variables: }, Args: cobra.OnlyValidArgs, Run: func(cmd *cobra.Command, args []string) { + if len(args) == 0 { + _ = cmd.Help() + return + } env := &environment.ShellEnvironment{ Version: cliVersion, }