this function is in the main project now

This commit is contained in:
Vincent Batts 2018-10-22 19:01:35 +01:00
parent 1ea1a5749e
commit 94c9d40eee
1 changed files with 2 additions and 22 deletions

View File

@ -1,7 +1,6 @@
package main
import (
"encoding/hex"
"encoding/json"
"flag"
"fmt"
@ -10,7 +9,7 @@ import (
"os/exec"
"strings"
esum "github.com/emojisum/emojisum/emoji"
"github.com/emojisum/emojisum/emoji"
)
var (
@ -58,7 +57,7 @@ func main() {
if strings.Contains(it.Digest, ":") {
chunks := strings.SplitN(it.Digest, ":", 2)
h = chunks[0]
d, err = emojiFromHexString(chunks[1])
d, err = emoji.FromHexString(chunks[1])
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
@ -80,25 +79,6 @@ func main() {
cmd.Run()
}
func emojiFromHexString(s string) (string, error) {
d, err := hex.DecodeString(s)
if err != nil {
return "", err
}
var ret string
for _, b := range d {
for _, e := range esum.Map(b) {
// use the first colon notation word and continue
if esum.IsCodepoint(e) {
ret = ret + esum.CodepointToUnicode(e)
break
}
}
}
return ret, nil
}
type ImageThing struct {
Repo string
ID string