summaryrefslogtreecommitdiff
path: root/pkg/server/echo.go
diff options
context:
space:
mode:
authorMikhail Osipov <mike.osipov@gmail.com>2020-09-10 00:18:05 +0300
committerMikhail Osipov <mike.osipov@gmail.com>2020-09-10 00:18:05 +0300
commit92fdd0e34e1fddf3cc85c3e0691d4fd1196bc382 (patch)
tree91ad84809c7d46e06196bd931cbeda34b648e869 /pkg/server/echo.go
parentcc5f5c9dbd8076a3a119c2b0e214e4d9c4f9bb1d (diff)
expandable variable syntax
Diffstat (limited to 'pkg/server/echo.go')
-rw-r--r--pkg/server/echo.go14
1 files changed, 13 insertions, 1 deletions
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() {