From 92fdd0e34e1fddf3cc85c3e0691d4fd1196bc382 Mon Sep 17 00:00:00 2001 From: Mikhail Osipov Date: Thu, 10 Sep 2020 00:18:05 +0300 Subject: expandable variable syntax --- pkg/server/echo.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'pkg/server/echo.go') diff --git a/pkg/server/echo.go b/pkg/server/echo.go index 0387a3e..2ac54b9 100644 --- a/pkg/server/echo.go +++ b/pkg/server/echo.go @@ -5,7 +5,19 @@ import ( ) func echo(r *request) { - r.Print(strings.Join(r.args, " ")) + expand := false + args := r.args + + if r.argc > 0 && r.args[0] == "-e" { + expand = true + args = args[1:] + } + + s := strings.Join(args, " ") + if expand { + s = r.c.s.env.Expand(s) + } + r.Print(s) } func init() { -- cgit v1.2.3-70-g09d2