Skip to content

Commit baca737

Browse files
committed
Clarify that crictl config without args refers to set
It's not clear to the end user that not specifying `--list`, `--set` or `--get` will result in a configuration set. We now clarify that in the docs as well as logs of the option. Signed-off-by: Sascha Grunert <[email protected]>
1 parent 47503b3 commit baca737

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

cmd/crictl/config.go

+18-6
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,34 @@ import (
2222
"strconv"
2323
"strings"
2424

25+
"github.com/sirupsen/logrus"
2526
"github.com/urfave/cli/v2"
2627

2728
"sigs.k8s.io/cri-tools/pkg/common"
2829
)
2930

3031
var configCommand = &cli.Command{
3132
Name: "config",
32-
Usage: "Get and set crictl client configuration options",
33+
Usage: "Get, set and list crictl configuration options",
3334
ArgsUsage: `[<crictl options>]
3435
35-
EXAMPLE:
36+
EXAMPLES:
37+
# Set the key "debug" to "true"
3638
crictl config --set debug=true
3739
40+
# Set the key "debug" to "true"
41+
crictl config debug true
42+
43+
# Get the value of "debug"
44+
crictl config --get debug
45+
46+
# Show the full configuration
47+
crictl config --list
48+
3849
CRICTL OPTIONS:
39-
runtime-endpoint: Container runtime endpoint
40-
image-endpoint: Image endpoint
41-
timeout: Timeout of connecting to server (default: 2s)
50+
runtime-endpoint: Container Runtime Interface (CRI) runtime endpoint (default: "")
51+
image-endpoint: Container Runtime Interface (CRI) image endpoint (default: "")
52+
timeout: Timeout of connecting to server (default: 2)
4253
debug: Enable debug output (default: false)
4354
pull-image-on-create: Enable pulling image on create requests (default: false)
4455
disable-pull-on-run: Disable pulling image on run requests (default: false)`,
@@ -126,8 +137,9 @@ CRICTL OPTIONS:
126137
return cli.ShowSubcommandHelp(c)
127138
}
128139
value := c.Args().Get(1)
140+
logrus.Infof("No --get, --set or --list provided, setting key %q to value %q", key, value)
129141
if err := setValue(key, value, config); err != nil {
130-
return err
142+
return fmt.Errorf("set %q to %q: %w", key, value, err)
131143
}
132144
return common.WriteConfig(config, configFile)
133145
},

0 commit comments

Comments
 (0)