-
Notifications
You must be signed in to change notification settings - Fork 13
/
main.go
81 lines (71 loc) · 1.47 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
Copyright © 2021 Miga Labs
*/
package main
import (
"context"
"fmt"
"os"
"github.com/migalabs/armiarma/pkg/utils"
"github.com/sirupsen/logrus"
cli "github.com/urfave/cli/v2"
"github.com/migalabs/armiarma/cmd"
)
var (
Version = "v2.0.0\n"
// logging variables
log = logrus.WithField(
"module", "ARMIARMA",
)
)
func main() {
// read arguments from the command line
PrintVersion()
// Set the general log configurations for the entire tool
logrus.SetFormatter(utils.ParseLogFormatter("text"))
logrus.SetOutput(utils.ParseLogOutput("terminal"))
app := &cli.App{
Name: "armiarma",
Usage: "Distributed libp2p crawler that monitors, measures, and exposes the gathered information about libp2p network's overlays.",
UsageText: "armiarma [commands] [arguments...]",
Authors: []*cli.Author{
{
Name: "Miga Labs",
Email: "[email protected]",
},
},
EnableBashCompletion: true,
Commands: []*cli.Command{
cmd.Eth2CrawlerCommand,
// cmd.IpfsCrawlerCommand,
},
}
// generate the crawler
if err := app.RunContext(context.Background(), os.Args); err != nil {
log.Errorf("error: %v\n", err)
os.Exit(1)
}
}
func helpInArgs(args []string) bool {
help := false
for _, b := range args {
switch b {
case "--help":
help = true
break
case "-h":
help = true
break
case "h":
help = true
break
case "help":
help = true
break
}
}
return help
}
func PrintVersion() {
fmt.Println("Armiarma_" + Version)
}