summaryrefslogtreecommitdiff
path: root/pkg/server/echo.go
blob: ee0537b774cf44140415cd7d285c2876e8e26bb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package server

import (
	"strings"
)

func echo(r *request, args ...string) {
	expand := false

	if len(args) > 0 && 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() {
	newCmd("echo", echo, "[args]")
}