-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
45 lines (35 loc) · 806 Bytes
/
main.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
45
package main
import (
"flag"
"fmt"
"os"
"strings"
"github.com/timchurchard/opendime-utils/cmd"
)
const cliName = "opendime-utils"
func main() {
if len(os.Args) < 2 {
usageRoot()
}
// Save the command and reset the flags
command := os.Args[1]
flag.CommandLine = flag.NewFlagSet(cliName, flag.ExitOnError)
os.Args = append([]string{cliName}, os.Args[2:]...)
switch command {
case "sigtoaddr":
os.Exit(cmd.SigtoaddrMain(os.Stdout))
case "keyconv":
var key string
fmt.Printf("Private Key WIF or hex: ")
fmt.Scanln(&key)
key = strings.TrimSpace(key)
os.Exit(cmd.KeyconvMain(os.Stdout, key))
case "crypt":
os.Exit(cmd.CryptMain(os.Stdout))
}
usageRoot()
}
func usageRoot() {
fmt.Printf("usage: opendime-utils command(sigtoaddr|keyconv|crypt) options\n")
os.Exit(1)
}