diff options
author | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-24 13:32:57 -0400 |
---|---|---|
committer | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-24 13:32:57 -0400 |
commit | 1a90e3410a9bdaf606a6124930a0913c07b44c87 (patch) | |
tree | 0c48ad326663b876ab44af37e5d2a0b8d95cca57 /cmds/exit.go | |
parent | f8d0e88585226138b7b17e5f74105dd4abe63559 (diff) |
Split builtin commands to separate modules
Diffstat (limited to 'cmds/exit.go')
-rw-r--r-- | cmds/exit.go | 20 |
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 +} |