@@ -25,6 +25,18 @@ var options = BitBucketScanOptions{
2525}
2626var maxArtifactSize string
2727
28+ var flagBindings = map [string ]string {
29+ "url" : "bitbucket.url" ,
30+ "token" : "bitbucket.token" ,
31+ "email" : "bitbucket.email" ,
32+ "cookie" : "bitbucket.cookie" ,
33+ "threads" : "common.threads" ,
34+ "truffle-hog-verification" : "common.trufflehog_verification" ,
35+ "max-artifact-size" : "common.max_artifact_size" ,
36+ "confidence" : "common.confidence_filter" ,
37+ "hit-timeout" : "common.hit_timeout" ,
38+ }
39+
2840func NewScanCmd () * cobra.Command {
2941 scanCmd := & cobra.Command {
3042 Use : "scan" ,
@@ -63,19 +75,9 @@ pipeleek bb scan --token ATATTxxxxxx --email auser@example.com --public --maxPip
6375}
6476
6577func Scan (cmd * cobra.Command , args []string ) {
66- if err := config .AutoBindFlags (cmd , map [string ]string {
67- "url" : "bitbucket.url" ,
68- "token" : "bitbucket.token" ,
69- "email" : "bitbucket.email" ,
70- "cookie" : "bitbucket.cookie" ,
71- "threads" : "common.threads" ,
72- "truffle-hog-verification" : "common.trufflehog_verification" ,
73- "max-artifact-size" : "common.max_artifact_size" ,
74- "confidence" : "common.confidence_filter" ,
75- "hit-timeout" : "common.hit_timeout" ,
76- }); err != nil {
77- log .Fatal ().Err (err ).Msg ("Failed to bind command flags to configuration keys" )
78- }
78+ config .NewCommandSetup (cmd ).
79+ WithFlagBindings (flagBindings ).
80+ MustBind ()
7981
8082 options .BitBucketURL = config .GetString ("bitbucket.url" )
8183 options .AccessToken = config .GetString ("bitbucket.token" )
0 commit comments