summaryrefslogtreecommitdiff
path: root/pkg/server/echo.go
blob: 2ac54b953d4e5514b791baee8254944d39be24bc (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
25
package server

import (
	"strings"
)

func echo(r *request) {
	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() {
	newCmd(echo, "echo")
}