Skip to content

Commit

Permalink
fix: improve bearer ignore show
Browse files Browse the repository at this point in the history
  • Loading branch information
elsapet committed Aug 28, 2023
1 parent d001dca commit 2a54f54
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/commands/ignore.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ func newIgnoreShowCommand() *cobra.Command {
Example: `# Show the details of an ignored fingerprint from your bearer.ignore file
$ bearer ignore show <fingerprint>`,
RunE: func(cmd *cobra.Command, args []string) error {
if err := IgnoreShowFlags.Bind(cmd); err != nil {
return fmt.Errorf("flag bind error: %w", err)
}

if len(args) == 0 {
return cmd.Help()
}
Expand All @@ -81,6 +85,10 @@ $ bearer ignore show <fingerprint>`,
cmd.Printf("Issue loading ignored fingerprints from bearer.ignore file: %s", err)
return nil
}
if !fileExists {
cmd.Printf("bearer.ignore file not found. Perhaps you need to use --bearer-ignore-file to specify the path to bearer.ignore?\n")
return nil
}
fingerprintId := args[0]
selectedIgnoredFingerprint, ok := ignoredFingerprints[fingerprintId]
if !ok {
Expand Down Expand Up @@ -139,7 +147,7 @@ $ bearer ignore add <fingerprint> --author Mish --comment "Possible false positi
}

if !fileExists {
cmd.Printf("\nCreating bearer.ignore file...")
cmd.Printf("\nCreating bearer.ignore file...\n")
}

if mergeErr := ignore.MergeIgnoredFingerprints(fingerprintsToIgnore, ignoredFingerprints, options.IgnoreAddOptions.Force); mergeErr != nil {
Expand Down

0 comments on commit 2a54f54

Please sign in to comment.