summaryrefslogtreecommitdiff
path: root/cmds/exit.go
blob: a295ff4036f59ae8f7959ad0955d667702600169 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
}