From 2fd292d5f480fd51cdbbff4821b6f09940a005a9 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Fri, 10 Jul 2015 19:18:55 +0000 Subject: Change Handler type to interface. Should allow for more flexibility in handlers. Also, move builtin handlers into their own modules --- cmd_pid.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 cmd_pid.go (limited to 'cmd_pid.go') diff --git a/cmd_pid.go b/cmd_pid.go new file mode 100644 index 0000000..00f127f --- /dev/null +++ b/cmd_pid.go @@ -0,0 +1,23 @@ +package goctl + +import ( + "os" + "strconv" +) + +var pid string + +type cmdPID struct{} + +func (cmd cmdPID) Name() string { + return "pid" +} + +func (cmd cmdPID) Run(_ []string) string { + return pid +} + +func init() { + pid = strconv.Itoa(os.Getpid()) + builtinHandlers = append(builtinHandlers, cmdPID{}) +} -- cgit v1.2.3