Style fix

js-version
Anton Medvedev 5 years ago
parent d283c6ec52
commit 7501e5a81b

30
fx.js

@ -1,11 +1,11 @@
'use strict'
const blessed = require('@medv/blessed')
const stringWidth = require('string-width')
const reopenTTY = require('reopen-tty')
const reduce = require('./reduce')
const print = require('./print')
const find = require('./find')
const config = require('./config')
const reopenTTY = require('reopen-tty');
module.exports = function start(filename, source) {
// Current rendered object on a screen.
@ -25,23 +25,23 @@ module.exports = function start(filename, source) {
let findGen = null
let currentPath = null
let ttyReadStream;
let ttyWriteStream;
reopenTTY.stdin(function(err, readStream) {
let ttyReadStream
let ttyWriteStream
reopenTTY.stdin(function (err, readStream) {
if (err) {
throw err;
throw err
} else {
ttyReadStream = readStream;
}
});
reopenTTY.stdout(function(err, writeStream) {
ttyReadStream = readStream
}
})
reopenTTY.stdout(function (err, writeStream) {
if (err) {
throw err;
throw err
} else {
ttyWriteStream = writeStream;
}
});
ttyWriteStream = writeStream
}
})
const program = blessed.program({
input: ttyReadStream,
@ -573,7 +573,7 @@ module.exports = function start(filename, source) {
function* bfs(json) {
const queue = [[json, '']]
while(queue.length > 0) {
while (queue.length > 0) {
const [v, path] = queue.shift()
if (!v) {

@ -44,22 +44,11 @@ function main(input) {
let filename = 'fx'
if (input === '') {
if (args.length === 0) {
if (args.length === 0 || (args.length === 1 && (args[0] === '-h' || args[0] === '--help'))) {
stderr.write(usage)
process.exit(2)
}
if(args[0].startsWith('-')) {
if(args[0].endsWith('h')) {
stderr.write(usage)
process.exit(2)
}
}
if(args[0].startsWith('--')) {
if(args[0].endsWith('help')) {
stderr.write(usage)
process.exit(2)
}
}
input = fs.readFileSync(args[0])
filename = path.basename(args[0])
args = args.slice(1)

Loading…
Cancel
Save