summaryrefslogtreecommitdiff
path: root/cmds/exit.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/exit.go')
-rw-r--r--cmds/exit.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/cmds/exit.go b/cmds/exit.go
new file mode 100644
index 0000000..a295ff4
--- /dev/null
+++ b/cmds/exit.go
@@ -0,0 +1,20 @@
+package cmds
+
+import (
+ "errors"
+ "os"
+ "strconv"
+)
+
+func exit(args []string) error {
+ status := 0
+ if len(args) > 1 {
+ var err error
+ status, err = strconv.Atoi(args[1])
+ if err != nil {
+ return errors.New("usage: exit (status)")
+ }
+ }
+ os.Exit(status)
+ return nil
+}