diff options
author | Brian Cully <bjc@kublai.com> | 2015-07-10 19:18:55 +0000 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2015-07-10 19:27:01 +0000 |
commit | 2fd292d5f480fd51cdbbff4821b6f09940a005a9 (patch) | |
tree | e3b4a2c4bb074133fe7a3625c01d256078f00968 /cmd_pid.go | |
parent | 9408742ed1a7eef568e2bf0d8e1aba390ae4d80b (diff) | |
download | goctl-2fd292d5f480fd51cdbbff4821b6f09940a005a9.tar.gz goctl-2fd292d5f480fd51cdbbff4821b6f09940a005a9.zip |
Change Handler type to interface.
Should allow for more flexibility in handlers. Also, move builtin handlers into their own modules
Diffstat (limited to 'cmd_pid.go')
-rw-r--r-- | cmd_pid.go | 23 |
1 files changed, 23 insertions, 0 deletions
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{}) +} |