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

View file

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