summaryrefslogtreecommitdiff
path: root/pkg/server/echo.go
blob: 696b19d1a659c3e90d28f2de96486443218679dc (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() {
	handle("echo", echo, "[args]")
}