searcherside/internal/cli/hex_string.go
Peter Kurfer 9ea9a8f658
Some checks failed
Go build / build (push) Failing after 1m58s
feat: continue basic setup
- setup ent scheme
- add command to create users
- document API
- add helpers to create migrations
- add command to run migrations
- add basic compose file
2024-06-19 21:19:37 +02:00

28 lines
384 B
Go

package cli
import (
"encoding/hex"
"github.com/alecthomas/kong"
)
type HexString []byte
func (h *HexString) Raw() []byte {
return *h
}
func (h *HexString) Decode(ctx *kong.DecodeContext) error {
token, err := ctx.Scan.PopValue("hex")
if err != nil {
return err
}
data, err := hex.DecodeString(token.String())
if err != nil {
return err
}
*h = data
return nil
}