summaryrefslogtreecommitdiffstats
path: root/keyboards/gboards/combos/_generator/main.go
diff options
context:
space:
mode:
authorlokher <lokher@gmail.com>2022-09-13 11:24:05 +0800
committerlokher <lokher@gmail.com>2022-09-13 11:24:05 +0800
commit9581289745736ce068a1040f44cec37a2ca8830d (patch)
tree24f644715a5fd6cc4d804d9604fb094307808b1b /keyboards/gboards/combos/_generator/main.go
parentfe13cedf8c09fa34d5cec4e4c624738095176625 (diff)
Remove non-Keychron keyboards
Diffstat (limited to 'keyboards/gboards/combos/_generator/main.go')
-rw-r--r--keyboards/gboards/combos/_generator/main.go60
1 files changed, 0 insertions, 60 deletions
diff --git a/keyboards/gboards/combos/_generator/main.go b/keyboards/gboards/combos/_generator/main.go
deleted file mode 100644
index 043c8b78c7..0000000000
--- a/keyboards/gboards/combos/_generator/main.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Package for taking a mapping of words to keys and outputing a
-// combo engine commpatible def
-
-package main
-
-import (
- "io/ioutil"
- "fmt"
- "encoding/json"
- "os"
- "sort"
- "strings"
- "hash/crc64"
- //"encoding/base64"
-)
-
-func main() {
- // Show Usage
- if len(os.Args) < 3 {
- fmt.Println("Usage: ./keymap-gen inputfile outfile")
- fmt.Println("Outputs dict in current dir")
- return
- }
-
- // Read the source
- data, err := ioutil.ReadFile(os.Args[1])
- if err != nil {
- panic(err)
- }
-
- // Unbundle Data
- var FullDict map[string]string
- var output []string
- json.Unmarshal(data, &FullDict)
-
- // Loop over entries and store
- for i,v := range FullDict {
- // This checks for colllisions, Generates hash
- hash := crc64.Checksum([]byte(v), crc64.MakeTable(crc64.ECMA))
- hashStr := fmt.Sprintf("txt_%x", hash)[:10]
-
- // Format keys into combo
- var keys string
- for _, k := range(v) {
- keys += fmt.Sprintf("KC_%v, ", string(k))
-
- }
- keys = keys[:len(keys)-2]
-
- // Append to output
- spacer := strings.Repeat(" ", 15-len(i))
- output = append(output, fmt.Sprintf("SUBS(%v, %v\"%v\", %v)\n", hashStr, spacer, i, keys))
- }
-
-
- sort.Slice(output, func (i,j int) bool {
- return strings.Count(output[i], " ") > strings.Count(output[j], " ")
- })
- ioutil.WriteFile(os.Args[2], []byte(strings.Join(output, "")), 0555)
-}