-
Notifications
You must be signed in to change notification settings - Fork 362
/
Copy pathreporting.go
38 lines (35 loc) · 1003 Bytes
/
reporting.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
package commands
import (
"github.com/activecm/rita-legacy/reporting"
"github.com/activecm/rita-legacy/resources"
"github.com/urfave/cli"
)
func init() {
command := cli.Command{
Name: "html-report",
Usage: "Create an html report for an analyzed database",
UsageText: "rita html-report [command-options] [database]\n\n" +
"If no database is specified, a report will be created for every database.",
Flags: []cli.Flag{
ConfigFlag,
netNamesFlag,
noBrowserFlag,
},
Action: func(c *cli.Context) error {
res := resources.InitResources(getConfigFilePath(c))
databaseName := c.Args().Get(0)
var databases []string
if databaseName != "" {
databases = append(databases, databaseName)
} else {
databases = res.MetaDB.GetAnalyzedDatabases()
}
err := reporting.PrintHTML(databases, c.Bool("network-names"), c.Bool("no-browser"), res)
if err != nil {
return cli.NewExitError(err.Error(), -1)
}
return nil
},
}
bootstrapCommands(command)
}