Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 0 |
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 |