mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 04:34:46 +01:00
fix flag access (#1506)
This commit is contained in:
1 parent
44ad62e0b1
commit
9463ffaa5e
6 files changed
+35
-33
No files matched your search
+11
-5
@@ -25,12 +25,22 @@ var gitCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
func runGit(cmd *cobra.Command, args []string) {
|
||||
initConfig()
|
||||
var (
|
||||
findings []report.Finding
|
||||
err error
|
||||
)
|
||||
|
||||
// grab source
|
||||
source := "."
|
||||
if len(args) == 1 {
|
||||
source = args[0]
|
||||
if source == "" {
|
||||
source = "."
|
||||
}
|
||||
}
|
||||
|
||||
initConfig(source)
|
||||
|
||||
// setup config (aka, the thing that defines rules)
|
||||
cfg := Config(cmd)
|
||||
|
||||
@@ -38,10 +48,6 @@ func runGit(cmd *cobra.Command, args []string) {
|
||||
start := time.Now()
|
||||
|
||||
// grab source
|
||||
source, err := cmd.Flags().GetString("source")
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("could not get source")
|
||||
}
|
||||
detector := Detector(cmd, cfg, source)
|
||||
|
||||
// set exit code
|
||||
|
||||
Reference in new issue
Block a user