pkg/cmd/root.go   A
last analyzed

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 20
dl 0
loc 30
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A cmd.NewRootCommand 0 23 3
1
package cmd
2
3
import (
4
	"github.com/sirupsen/logrus"
5
	"github.com/spf13/cobra"
6
)
7
8
func NewRootCommand(logger *logrus.Logger) *cobra.Command {
9
	var verbose bool
10
11
	cmd := &cobra.Command{
12
		Use:   "dirstalk",
13
		Short: "Stalk the given url trying to enumerate files and folders",
14
		Long:  `dirstalk is a tool that attempts to enumerate files and folders starting from a given URL`,
15
		PersistentPreRun: func(cmd *cobra.Command, args []string) {
16
			if verbose {
17
				logger.SetLevel(logrus.DebugLevel)
18
			}
19
		},
20
	}
21
22
	cmd.PersistentFlags().BoolVarP(
23
		&verbose,
24
		flagRootVerbose,
25
		flagRootVerboseShort,
26
		false,
27
		"verbose mode",
28
	)
29
30
	return cmd
31
}
32