UNPKG

window-size

Version:

Reliable way to get the height and width of terminal/console, since it's not calculated or updated the same way on all platforms, environments and node.js versions.

31 lines (27 loc) 456 B
#!/usr/bin/env node var size = require('./'); var helpText = [ 'Usage', ' $ window-size', '', 'Example', ' $ window-size', ' height: 40 ', ' width : 145', '' ].join('\n'); function showSize() { console.log('height: ' + size.height); console.log('width : ' + size.width); } switch (process.argv[2]) { case 'help': case '--help': case '-h': console.log(helpText); break; default: { showSize(); break; } }