forked from FactomProject/walletapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
misc.go
44 lines (38 loc) · 855 Bytes
/
misc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2015 Factom Foundation
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"os"
"strconv"
)
type Exit struct {
ICommand
}
func (Exit) Execute(state IState, args []string) error {
if len(args) < 2 {
os.Exit(0)
}
if len(args) != 2 {
return fmt.Errorf("Too many parameters")
}
n, err := strconv.ParseInt(args[1], 10, 32)
if err != nil {
return err
}
os.Exit(int(n))
return nil
}
func (Exit) Name() string {
return "Exit"
}
func (Exit) ShortHelp() string {
return "Exit <error code> -- Exits Factom Wallet with the given error code"
}
func (Exit) LongHelp() string {
return `
Exit <error code> Exits Factom Wallet with the given error code.
<error code> is an int, and is OS specific
`
}