fix flag access (#1506)

This commit is contained in:
Zachary Rice authored and GitHub committed 2024-09-14 04:01:27 -05:00
1 parent 44ad62e0b1
commit 9463ffaa5e
6 files changed
+35 -33

No files matched your search

+5 -6
View File
@@ -25,18 +25,17 @@ var protectCmd = &cobra.Command{
}
func runProtect(cmd *cobra.Command, args []string) {
initConfig()
var err error
source, err := cmd.Flags().GetString("source")
if err != nil {
log.Fatal().Err(err).Msg("could not get source")
}
initConfig(source)
// setup config (aka, the thing that defines rules)
cfg := Config(cmd)
exitCode, _ := cmd.Flags().GetInt("exit-code")
staged, _ := cmd.Flags().GetBool("staged")
source, err := cmd.Flags().GetString("source")
if err != nil {
log.Fatal().Err(err).Msg("")
}
start := time.Now()
detector := Detector(cmd, cfg, source)