[master] e8f8afc51 cli: Teach param.reset -j to output param.show
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Tue Nov 21 06:03:10 UTC 2023
commit e8f8afc51f669c46b542cf8b9764b23afbb3ad7b
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Tue Nov 7 09:16:56 2023 +0100
cli: Teach param.reset -j to output param.show
diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index 1cfd789ba..d305a1006 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -713,7 +713,7 @@ mcf_wash_param(struct cli *cli, struct parspec *pp, enum mcf_which_e which,
static struct cli_proto cli_params[] = {
{ CLICMD_PARAM_SHOW, "", mcf_param_show, mcf_param_show_json },
{ CLICMD_PARAM_SET, "", mcf_param_set, mcf_param_set_json },
- { CLICMD_PARAM_RESET, "", mcf_param_reset },
+ { CLICMD_PARAM_RESET, "", mcf_param_reset, mcf_param_set_json },
{ NULL }
};
diff --git a/bin/varnishtest/tests/c00054.vtc b/bin/varnishtest/tests/c00054.vtc
index 63aef00a1..0ee1c2674 100644
--- a/bin/varnishtest/tests/c00054.vtc
+++ b/bin/varnishtest/tests/c00054.vtc
@@ -10,6 +10,7 @@ varnish v1 -cliok "param.show vsl_mask"
varnish v1 -cliexpect {"value": "none"} "param.set -j feature none"
varnish v1 -cliexpect {"value": "all"} "param.set -j vsl_mask all"
+varnish v1 -cliexpect {"value": "all(,-\w+)+"} "param.reset -j vsl_mask"
varnish v1 -clierr 106 "param.set vsl_mask FooBar"
varnish v1 -clierr 106 "param.set vsl_mask -FooBar"
diff --git a/include/tbl/cli_cmds.h b/include/tbl/cli_cmds.h
index b4b9c3194..3295b5844 100644
--- a/include/tbl/cli_cmds.h
+++ b/include/tbl/cli_cmds.h
@@ -172,9 +172,11 @@ CLI_CMD(VCL_LABEL,
CLI_CMD(PARAM_RESET,
"param.reset",
- "param.reset <param>",
+ "param.reset [-j] <param>",
"Reset parameter to default value.",
- "",
+ " The JSON output is the same as ``param.show -j <param>`` and"
+ " contains the updated value as it would be represented by a"
+ " subsequent execution of ``param.show``.\n\n",
1,1
)
More information about the varnish-commit
mailing list