1
0
mirror of https://github.com/coalaura/ffwebp.git synced 2025-09-08 13:59:54 +00:00

fixes and cleanup

This commit is contained in:
Laura
2025-08-13 22:03:17 +02:00
parent b1c2432aa1
commit 6cf75f9745
3 changed files with 37 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
package main package main
import ( import (
"fmt"
"runtime" "runtime"
"sort" "sort"
"strings" "strings"
@@ -10,22 +11,53 @@ import (
"github.com/coalaura/ffwebp/internal/logx" "github.com/coalaura/ffwebp/internal/logx"
) )
func banner() { func codecList() []string {
codecs := codec.All() codecs := codec.All()
names := make([]string, len(codecs)) names := make([]string, len(codecs))
for i, c := range codecs { for i, c := range codecs {
names[i] = c.String() names[i] = c.String()
if !c.CanEncode() {
names[i] += "*"
}
} }
sort.Strings(names) sort.Strings(names)
if effects.HasEffects() { return names
names = append(names, "effects")
} }
build := strings.Join(names, ",") func tags() string {
var (
codec = "none"
feature = "none"
)
if effects.HasEffects() {
feature = "effects"
}
codecs := codecList()
if len(codecs) > 0 {
codec = strings.Join(codecs, " ")
}
return fmt.Sprintf("[codecs: %s] [features: %s]", codec, feature)
}
func banner() {
tags := codecList()
if effects.HasEffects() {
tags = append(tags, "effects")
}
if len(tags) == 0 {
tags = []string{"none"}
}
logx.Printf("ffwebp version %s\n", Version) logx.Printf("ffwebp version %s\n", Version)
logx.Printf( logx.Printf(
@@ -34,8 +66,5 @@ func banner() {
runtime.Version(), runtime.Version(),
runtime.GOARCH, runtime.GOARCH,
) )
logx.Printf( logx.Printf(" %s\n", strings.Join(tags, ","))
" configuration: -tags %s\n",
build,
)
} }

View File

@@ -96,7 +96,7 @@ func main() {
app := &cli.Command{ app := &cli.Command{
Name: "ffwebp", Name: "ffwebp",
Usage: "Convert any image format into any other image format", Usage: "Convert any image format into any other image format",
Version: Version, Version: fmt.Sprintf("%s %s", Version, tags()),
Flags: flags, Flags: flags,
Action: run, Action: run,
Writer: os.Stderr, Writer: os.Stderr,

View File

@@ -87,8 +87,6 @@ func Sniff(reader io.Reader, input, force string, ignoreExtension bool) (*Sniffe
return nil, nil, err return nil, nil, err
} }
fmt.Println(codec.String(), confidence)
if confidence <= 0 { if confidence <= 0 {
continue continue
} }