diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-01-04 03:50:16 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-01-04 03:50:16 +0300 |
commit | 18acac2a95ef7ca597993b35324a3db74d5f0ab4 (patch) | |
tree | 633db458e4565679da26cdf9ae82eec68de57525 /bin | |
parent | c64d8f2fecabb0b164cccb53b657f14bd894a24d (diff) |
cmd: interface less than 80 chars wide
Fix #496
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cmd.js | 70 |
1 files changed, 37 insertions, 33 deletions
@@ -502,46 +502,49 @@ function drawTorrent (torrent) { clivas.clear() - if (playerName) { - clivas.line('{green:Streaming to} {bold:' + playerName + '}') + clivas.line( + '{green:' + (seeding ? 'Seeding' : 'Downloading') + ': }' + + '{bold:' + torrent.name + '}' + ) + var seeding = torrent.done + if (seeding) { + clivas.line('{green:Info hash: }' + torrent.infoHash) linesRemaining -= 1 } - - if (server) { - clivas.line('{green:server running at} {bold:' + href + '}') + if (playerName) { + clivas.line( + '{green:Streaming to: }{bold:' + playerName + '} ' + + '{green:Server running at: }{bold:' + href + '}' + ) linesRemaining -= 1 } - - if (argv.out) { - clivas.line('{green:downloading to} {bold:' + argv.out + '}') + if (!playerName && server) { + clivas.line('{green:Server running at: }{bold:' + href + '}') linesRemaining -= 1 } - - var seeding = torrent.done - - if (!seeding) clivas.line('') - clivas.line( - '{green:' + (seeding ? 'seeding' : 'downloading') + ':} ' + - '{bold:' + torrent.name + '}' - ) - if (seeding) { - clivas.line('{green:info hash:} ' + torrent.infoHash) + if (argv.out) { + clivas.line('{green:Downloading to: }{bold:' + argv.out + '}') linesRemaining -= 1 } clivas.line( - '{green:speed: }{bold:' + prettyBytes(speed) + '/s} ' + - '{green:downloaded:} {bold:' + prettyBytes(torrent.downloaded) + '}' + + '{green:Speed: }{bold:' + prettyBytes(speed) + '/s} ' + + '{green:Downloaded:} {bold:' + prettyBytes(torrent.downloaded) + '}' + '/{bold:' + prettyBytes(torrent.length) + '} ' + - '{green:uploaded:} {bold:' + prettyBytes(torrent.uploaded) + '} ' + - '{green:peers:} {bold:' + unchoked.length + '/' + torrent.swarm.wires.length + '} ' + - '{green:hotswaps:} {bold:' + hotswaps + '}' + '{green:Uploaded:} {bold:' + prettyBytes(torrent.uploaded) + '}' ) clivas.line( - '{green:time remaining:} {bold:' + estimate + ' remaining} ' + - '{green:total time:} {bold:' + getRuntime() + 's} ' + - '{green:queued peers:} {bold:' + torrent.swarm.numQueued + '} ' + - '{green:blocked:} {bold:' + torrent.numBlockedPeers + '}' + '{green:Running time:} {bold:' + getRuntime() + 's} ' + + '{green:Time remaining:} {bold:' + estimate + '} ' + + '{green:Peers:} {bold:' + unchoked.length + '/' + torrent.swarm.wires.length + '}' ) + if (argv.verbose) { + clivas.line( + '{green:Queued peers:} {bold:' + torrent.swarm.numQueued + '} ' + + '{green:Blocked peers:} {bold:' + torrent.numBlockedPeers + '} ' + + '{green:Hotswaps:} {bold:' + hotswaps + '}' + ) + linesRemaining -= 1 + } clivas.line('{80:}') linesRemaining -= 5 @@ -557,14 +560,15 @@ function drawTorrent (torrent) { } progress = bits === piececount ? 'S' : Math.floor(100 * bits / piececount) + '%' } - var tags = [] - if (wire.peerChoking) tags.push('choked') - if (wire.requests.length > 0) tags.push(wire.requests.length + ' reqs') + var tags = [] + var reqStats = [] - var reqStats = argv.verbose - ? wire.requests.map(function (req) { return req.piece }) - : [] + if (argv.verbose) { + if (wire.requests.length > 0) tags.push(wire.requests.length + ' reqs') + if (wire.peerChoking) tags.push('choked') + reqStats = wire.requests.map(function (req) { return req.piece }) + } clivas.line( '{3:%s} {25+magenta:%s} {10:%s} {12+cyan:%s/s} {12+red:%s/s} {15+grey:%s}' + |