overdue
This commit is contained in:
31
main.go
Executable file
31
main.go
Executable file
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"flag"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := by_command(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func by_command() error {
|
||||
cmd := flag.String("cmd", "", "cmd as encode, decode, ts, batch, torname, fromrname, part...")
|
||||
pprof := flag.Bool("pprof", false, "enable pprof on :6060")
|
||||
flag.Parse()
|
||||
if *pprof {
|
||||
go func() { http.ListenAndServe(":6060", nil) }()
|
||||
}
|
||||
err := errors.New("unknown command " + *cmd)
|
||||
switch *cmd {
|
||||
case "encode":
|
||||
err = Enc()
|
||||
case "decode":
|
||||
err = Dec()
|
||||
}
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user