Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
tweaked outputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Jul 30, 2023
1 parent a2178d9 commit e04743f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 4 additions & 0 deletions cmd/approve.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,19 @@ var approveCmd = &cobra.Command{
}
defer db.Close()
w := os.Stdout
logr.Info("> CHECK database records")
if err := database.Approve(db, w, confg, approve.Verbose); err != nil {
logr.Error(err)
}
logr.Info("> FIX database sections and platforms")
if err := database.Fix(db, w); err != nil {
logr.Error(err)
}
logr.Info("> FIX database groups")
if err := groups.Fix(db, w); err != nil {
logr.Error(err)
}
logr.Info("> FIX database people")
if err := people.Fix(db, w); err != nil {
logr.Error(err)
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/images/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@ func checkWebP(src string) (string, bool, error) {
return "", false, nil
case err != nil:
return "", false, fmt.Errorf("to webp mimetype detect: %w", err)
case m.Extension() == "":
return "", false, fmt.Errorf("no extension for webp mimetype: %w", ErrFormat)
case !valid(v, m.Extension()):
return "", false, fmt.Errorf("to webp mimetype %q != %s: %w",
m.Extension(), strings.Join(v, " "), ErrFormat)
Expand Down
10 changes: 1 addition & 9 deletions pkg/people/people.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/Defacto2/df2/pkg/database"
"github.com/Defacto2/df2/pkg/directories"
"github.com/Defacto2/df2/pkg/groups"
"github.com/Defacto2/df2/pkg/logger"
"github.com/Defacto2/df2/pkg/people/internal/person"
"github.com/Defacto2/df2/pkg/people/internal/role"
"github.com/Defacto2/df2/pkg/str"
Expand Down Expand Up @@ -273,14 +272,7 @@ func Fix(db *sql.DB, w io.Writer) error {
}
}
}
switch {
case c == 1:
logger.PrintCR(w, "1 fix applied")
case c > 0:
logger.PrintfCR(w, "%d fixes applied", c)
default:
logger.PrintCR(w, "no people fixes needed")
}
str.Total(w, c, "people fixes")
str.TimeTaken(w, time.Since(start).Seconds())
return nil
}
Expand Down

0 comments on commit e04743f

Please sign in to comment.