diff options
author | Brian Cully <bjc@kublai.com> | 2015-07-10 20:18:20 +0000 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2015-07-10 20:18:20 +0000 |
commit | 17d71eaa18bfeb07fab78ac13b1c4fca8379a6d0 (patch) | |
tree | 8563961a34994e5862d4680dbd897d5955a3b70c /pid.go | |
parent | 16815048d2f7f770a454597a39838e63014132f2 (diff) | |
download | goctl-17d71eaa18bfeb07fab78ac13b1c4fca8379a6d0.tar.gz goctl-17d71eaa18bfeb07fab78ac13b1c4fca8379a6d0.zip |
Rename cmd modules.
Diffstat (limited to 'pid.go')
-rw-r--r-- | pid.go | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -0,0 +1,27 @@ +package goctl + +import ( + "os" + "strconv" +) + +var pid string + +type cmdPID struct{} + +func (cmd cmdPID) Name() string { + return "pid" +} + +func (cmd cmdPID) Help() string { + return "return the Unix process ID of this program" +} + +func (cmd cmdPID) Run(_ *Goctl, _ []string) string { + return pid +} + +func init() { + pid = strconv.Itoa(os.Getpid()) + builtinHandlers = append(builtinHandlers, cmdPID{}) +} |