mirror of
https://github.com/S2-/gitlit
synced 2025-08-03 12:50:04 +02:00
initial commit
This commit is contained in:
1
app/node_modules/single-line-log/.npmignore
generated
vendored
Normal file
1
app/node_modules/single-line-log/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
21
app/node_modules/single-line-log/LICENSE
generated
vendored
Normal file
21
app/node_modules/single-line-log/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Tobias Baunbæk <freeall@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
56
app/node_modules/single-line-log/README.md
generated
vendored
Normal file
56
app/node_modules/single-line-log/README.md
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# single-line-log
|
||||
|
||||
Node.js module that keeps writing to the same line in the console (or a stream). Very useful when you write progress bars, or a status message during longer operations. Supports multilines.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
npm install single-line-log
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
``` js
|
||||
var log = require('single-line-log').stdout;
|
||||
// or pass any stream:
|
||||
// var log = require('single-line-log')(process.stdout);
|
||||
|
||||
var read = 0;
|
||||
var size = fs.statSync('super-large-file').size;
|
||||
|
||||
var rs = fs.createReadStream('super-large-file');
|
||||
rs.on('data', function(data) {
|
||||
read += data.length;
|
||||
var percentage = Math.floor(100*read/size);
|
||||
|
||||
// Keep writing to the same two lines in the console
|
||||
log('Writing to super large file\n[' + percentage + '%]', read, 'bytes read');
|
||||
});
|
||||
```
|
||||
|
||||
## .clear()
|
||||
|
||||
Clears the log (i.e., writes a newline).
|
||||
|
||||
``` js
|
||||
var log = require('single-line-log').stdout;
|
||||
|
||||
log('Line 1');
|
||||
log.clear();
|
||||
log('Line 2');
|
||||
```
|
||||
|
||||
|
||||
## .stdout
|
||||
|
||||
Outputs to `process.stdout`.
|
||||
|
||||
|
||||
## .stderr
|
||||
|
||||
Outputs to `process.stderr`.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
51
app/node_modules/single-line-log/index.js
generated
vendored
Normal file
51
app/node_modules/single-line-log/index.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
var MOVE_LEFT = new Buffer('1b5b3130303044', 'hex').toString();
|
||||
var MOVE_UP = new Buffer('1b5b3141', 'hex').toString();
|
||||
var CLEAR_LINE = new Buffer('1b5b304b', 'hex').toString();
|
||||
var stringWidth = require('string-width');
|
||||
|
||||
module.exports = function(stream) {
|
||||
var write = stream.write;
|
||||
var str;
|
||||
|
||||
stream.write = function(data) {
|
||||
if (str && data !== str) str = null;
|
||||
return write.apply(this, arguments);
|
||||
};
|
||||
|
||||
if (stream === process.stderr || stream === process.stdout) {
|
||||
process.on('exit', function() {
|
||||
if (str !== null) stream.write('');
|
||||
});
|
||||
}
|
||||
|
||||
var prevLineCount = 0;
|
||||
var log = function() {
|
||||
str = '';
|
||||
var nextStr = Array.prototype.join.call(arguments, ' ');
|
||||
|
||||
// Clear screen
|
||||
for (var i=0; i<prevLineCount; i++) {
|
||||
str += MOVE_LEFT + CLEAR_LINE + (i < prevLineCount-1 ? MOVE_UP : '');
|
||||
}
|
||||
|
||||
// Actual log output
|
||||
str += nextStr;
|
||||
stream.write(str);
|
||||
|
||||
// How many lines to remove on next clear screen
|
||||
var prevLines = nextStr.split('\n');
|
||||
prevLineCount = 0;
|
||||
for (var i=0; i < prevLines.length; i++) {
|
||||
prevLineCount += Math.ceil(stringWidth(prevLines[i]) / stream.columns) || 1;
|
||||
}
|
||||
};
|
||||
|
||||
log.clear = function() {
|
||||
stream.write('');
|
||||
};
|
||||
|
||||
return log;
|
||||
};
|
||||
|
||||
module.exports.stdout = module.exports(process.stdout);
|
||||
module.exports.stderr = module.exports(process.stderr);
|
62
app/node_modules/single-line-log/package.json
generated
vendored
Normal file
62
app/node_modules/single-line-log/package.json
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"_from": "single-line-log@^1.1.2",
|
||||
"_id": "single-line-log@1.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-wvg/Jzo+GhbtsJlWYdoO1e8DM2Q=",
|
||||
"_location": "/single-line-log",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "single-line-log@^1.1.2",
|
||||
"name": "single-line-log",
|
||||
"escapedName": "single-line-log",
|
||||
"rawSpec": "^1.1.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/nugget"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/single-line-log/-/single-line-log-1.1.2.tgz",
|
||||
"_shasum": "c2f83f273a3e1a16edb0995661da0ed5ef033364",
|
||||
"_spec": "single-line-log@^1.1.2",
|
||||
"_where": "E:\\projects\\p\\gitlit\\app\\node_modules\\nugget",
|
||||
"author": {
|
||||
"name": "Tobias Baunbæk",
|
||||
"email": "freeall@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/freeall/single-line-log/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"string-width": "^1.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Keep writing to the same line in the terminal. Very useful when you write progress bars, or a status message during longer operations",
|
||||
"homepage": "https://github.com/freeall/single-line-log#readme",
|
||||
"keywords": [
|
||||
"single",
|
||||
"line",
|
||||
"log",
|
||||
"output",
|
||||
"overwrite",
|
||||
"collapse",
|
||||
"stdout",
|
||||
"terminal",
|
||||
"tty",
|
||||
"cli",
|
||||
"shell"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "single-line-log",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/freeall/single-line-log.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"version": "1.1.2"
|
||||
}
|
21
app/node_modules/single-line-log/test.js
generated
vendored
Normal file
21
app/node_modules/single-line-log/test.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
var log = require('./index').stdout;
|
||||
|
||||
var i = 0;
|
||||
setInterval(function() {
|
||||
i++;
|
||||
|
||||
var s = 'line 1 - ' + Math.random();
|
||||
|
||||
if (i < 10) s += ' - ' + Math.random();
|
||||
|
||||
if (i < 40) s += '\nline 2 - ' + Math.random();
|
||||
if (i < 30) s += '\nline 3 - ' + Math.random();
|
||||
if (i < 20) s += '\nline 4 - ' + Math.random();
|
||||
|
||||
log(s);
|
||||
|
||||
if (i === 50) {
|
||||
log.clear();
|
||||
process.exit(0);
|
||||
}
|
||||
}, 200);
|
Reference in New Issue
Block a user