Preview generator: cleanup

This commit is contained in:
He4eT 2021-08-27 15:53:36 +05:00
commit 50875cecad
3 changed files with 17 additions and 13 deletions

View file

@ -46,6 +46,7 @@ const legends = {
'SPC': 'Space',
'BSPC': 'Back\nSpace',
'TAB': 'Tab',
'CAPS': 'Caps\nLock',
'LCTRL': 'Ctrl',
'RCTRL': 'Ctrl',
@ -59,6 +60,8 @@ const legends = {
'RCTL_T(ESC': 'Ctrl\nEsc',
'OSM(MOD_LCTL': 'OSM\nCtrl',
'OSM(MOD_LALT': 'OSM\nAlt',
'OSM(MOD_LGUI': 'OSM\nOS',
'OSM(MOD_RGUI': 'OSM\nOS',
'HOME': 'Home',
'INS': 'Insert',
@ -68,6 +71,7 @@ const legends = {
'PGUP': 'PgUp',
'PAUS': 'Pause',
'PSCR': 'PrScr',
'SYSREQ': 'SysRq',
'APP': 'Menu',
'LEFT': 'Left',
@ -76,8 +80,8 @@ const legends = {
'UP': 'Up',
'MUTE': 'Mute',
'VOLD': 'Vol +',
'VOLU': 'Vol ',
'VOLD': 'Vol ',
'VOLU': 'Vol +',
'ACL0': 'Slow',
'ACL1': 'Usual',

View file

@ -5,26 +5,26 @@
const fs = require('fs')
const {buildRow} = require('./rows')
const {cleanKeys, printLegends} = require('./legends')
const keymapFilePath = process.argv[2]
const fileContent = fs.readFileSync(keymapFilePath, 'utf8')
const {buildRow} = require('./parts/rows')
const {cleanKeys, printLegends} = require('./parts/keys')
const keymapToKLERawData = fileContent =>
fileContent
.split('\n')
.map(row => row.split(','))
.filter(key => key.length > 1)
.filter(keys => keys.length > 1)
.map(cleanKeys)
.map(printLegends)
.map(buildRow)
.map(JSON.stringify)
// .slice(0, 8)
// .slice(8, 16)
// .slice(16)
.join(',\n')
const result = keymapToKLERawData(fileContent)
// .slice(0, 8)
// .slice(8, 16)
// .slice(16)
const keymapFilePath = process.argv[2]
const fileContent = fs.readFileSync(keymapFilePath, 'utf8')
const rawData = keymapToKLERawData(fileContent)
console.log(result.join(',\n'))
console.log(rawData)