Last active
July 30, 2017 10:51
-
-
Save fs-c/ba56b51945b163b65dd8f668f5c5c001 to your computer and use it in GitHub Desktop.
Input anything and the script will add enough spaces to make it appear centered on a FullHD steam client. The result is saved in the clipboard and output in the console. This is a proof of concept or whatever.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// On FullHD in steam client, a custom info box is 90 spaces wide. | |
// This code WORKS, but it's ugly and not well thought out. | |
// Look at this as a proof of concept if you will. | |
const SPACE = ' ' | |
const cp = require('copy-paste') | |
const rl = require('readline').createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}) | |
let settings = { | |
style: 'centered', | |
ignore: 0 | |
} | |
let out = '' | |
rl.on('line', input => { | |
if (input === 'exit') process.exit(1) | |
if (input.indexOf('settings') !== -1) { | |
if (input.indexOf('.style') !== -1) { | |
settings.style = input.slice(16) | |
} else { /* ... */ } | |
} else { | |
let s = '' | |
if (settings.style === 'centered') { | |
for (let i = settings.ignore; i++ <= (45 - (input.length / 2));) { | |
s += SPACE | |
} | |
} else if (settings.style === 'rightbound') { | |
for (let i = settings.ignore; i++ <= 90 - input.length;) { | |
s += SPACE | |
} | |
} else throw 'Invalid style.' | |
out = s + input | |
console.log(out) | |
cp.copy(out) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment