feat: add format setting for completion

This commit is contained in:
Antoine Aflalo
2024-08-27 08:51:35 -04:00
parent eec6fe91dd
commit 01e5c78369
6 changed files with 65 additions and 13 deletions

View File

@@ -1,8 +1,31 @@
package constant
type ConversionFormat string
import "github.com/thediveo/enumflag/v2"
type ConversionFormat enumflag.Flag
const (
ImageFormatWebP ConversionFormat = "webp"
ImageFormatUnknown ConversionFormat = ""
WebP ConversionFormat = iota
)
var CommandValue = map[ConversionFormat][]string{
WebP: {"webp"},
}
var HelpText = enumflag.Help[ConversionFormat]{
WebP: "WebP Image Format",
}
var DefaultConversion = WebP
func (c ConversionFormat) String() string {
return CommandValue[c][0]
}
func ListAll() []string {
var formats []string
for _, names := range CommandValue {
formats = append(formats, names[0])
}
return formats
}