MEDIUM: vars: also support format strings in CLI's "set var" command
Most often "set var" on the CLI is used to set a string, and using only
expressions is not always convenient, particularly when trying to
concatenate variables sur as host names and paths.
Now the "set var" command supports an optional keyword before the value
to indicate its type. "expr" takes an expression just like before this
patch, and "fmt" a format string, making it work like the "set-var-fmt"
actions.
The VTC was updated to include a test on the format string.
diff --git a/reg-tests/sample_fetches/vars.vtc b/reg-tests/sample_fetches/vars.vtc
index 82d7718..5dc7b44 100644
--- a/reg-tests/sample_fetches/vars.vtc
+++ b/reg-tests/sample_fetches/vars.vtc
@@ -71,7 +71,7 @@
}
haproxy h1 -cli {
- send "experimental-mode on; set var proc.str str(updated)"
+ send "experimental-mode on; set var proc.str str(updating); set var proc.str fmt %[var(proc.str),regsub(ing,ed)]"
expect ~ .*
}