initial commit taken from gitlab.lrz.de

This commit is contained in:
privatereese
2018-08-24 18:09:42 +02:00
parent ae54ed4c48
commit fc05486403
28494 changed files with 2159823 additions and 0 deletions

16
node_modules/ansi/examples/beep/index.js generated vendored Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env node
/**
* Invokes the terminal "beep" sound once per second on every exact second.
*/
process.title = 'beep'
var cursor = require('../../')(process.stdout)
function beep () {
cursor.beep()
setTimeout(beep, 1000 - (new Date()).getMilliseconds())
}
setTimeout(beep, 1000 - (new Date()).getMilliseconds())

15
node_modules/ansi/examples/clear/index.js generated vendored Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env node
/**
* Like GNU ncurses "clear" command.
* https://github.com/mscdex/node-ncurses/blob/master/deps/ncurses/progs/clear.c
*/
process.title = 'clear'
function lf () { return '\n' }
require('../../')(process.stdout)
.write(Array.apply(null, Array(process.stdout.getWindowSize()[1])).map(lf).join(''))
.eraseData(2)
.goto(1, 1)

32
node_modules/ansi/examples/cursorPosition.js generated vendored Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env node
var tty = require('tty')
var cursor = require('../')(process.stdout)
// listen for the queryPosition report on stdin
process.stdin.resume()
raw(true)
process.stdin.once('data', function (b) {
var match = /\[(\d+)\;(\d+)R$/.exec(b.toString())
if (match) {
var xy = match.slice(1, 3).reverse().map(Number)
console.error(xy)
}
// cleanup and close stdin
raw(false)
process.stdin.pause()
})
// send the query position request code to stdout
cursor.queryPosition()
function raw (mode) {
if (process.stdin.setRawMode) {
process.stdin.setRawMode(mode)
} else {
tty.setRawMode(mode)
}
}

87
node_modules/ansi/examples/progress/index.js generated vendored Normal file
View File

@@ -0,0 +1,87 @@
#!/usr/bin/env node
var assert = require('assert')
, ansi = require('../../')
function Progress (stream, width) {
this.cursor = ansi(stream)
this.delta = this.cursor.newlines
this.width = width | 0 || 10
this.open = '['
this.close = ']'
this.complete = '█'
this.incomplete = '_'
// initial render
this.progress = 0
}
Object.defineProperty(Progress.prototype, 'progress', {
get: get
, set: set
, configurable: true
, enumerable: true
})
function get () {
return this._progress
}
function set (v) {
this._progress = Math.max(0, Math.min(v, 100))
var w = this.width - this.complete.length - this.incomplete.length
, n = w * (this._progress / 100) | 0
, i = w - n
, com = c(this.complete, n)
, inc = c(this.incomplete, i)
, delta = this.cursor.newlines - this.delta
assert.equal(com.length + inc.length, w)
if (delta > 0) {
this.cursor.up(delta)
this.delta = this.cursor.newlines
}
this.cursor
.horizontalAbsolute(0)
.eraseLine(2)
.fg.white()
.write(this.open)
.fg.grey()
.bold()
.write(com)
.resetBold()
.write(inc)
.fg.white()
.write(this.close)
.fg.reset()
.write('\n')
}
function c (char, length) {
return Array.apply(null, Array(length)).map(function () {
return char
}).join('')
}
// Usage
var width = parseInt(process.argv[2], 10) || process.stdout.getWindowSize()[0] / 2
, p = new Progress(process.stdout, width)
;(function tick () {
p.progress += Math.random() * 5
p.cursor
.eraseLine(2)
.write('Progress: ')
.bold().write(p.progress.toFixed(2))
.write('%')
.resetBold()
.write('\n')
if (p.progress < 100)
setTimeout(tick, 100)
})()