mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 05:04:22 +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
+10
-6
@@ -23,7 +23,15 @@ var directoryCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
func runDirectory(cmd *cobra.Command, args []string) {
|
||||
initConfig()
|
||||
// grab source
|
||||
source := "."
|
||||
if len(args) == 1 {
|
||||
source = args[0]
|
||||
if source == "" {
|
||||
source = "."
|
||||
}
|
||||
}
|
||||
initConfig(source)
|
||||
var (
|
||||
findings []report.Finding
|
||||
err error
|
||||
@@ -35,11 +43,7 @@ func runDirectory(cmd *cobra.Command, args []string) {
|
||||
// start timer
|
||||
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