mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-20 21:14:45 +00:00
.
This commit is contained in:
parent
9fff29ba6c
commit
00c3b50fca
7278 changed files with 0 additions and 1778943 deletions
29
node_modules/optimist/example/line_count_wrap.js
generated
vendored
29
node_modules/optimist/example/line_count_wrap.js
generated
vendored
|
@ -1,29 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
var argv = require('optimist')
|
||||
.usage('Count the lines in a file.\nUsage: $0')
|
||||
.wrap(80)
|
||||
.demand('f')
|
||||
.alias('f', [ 'file', 'filename' ])
|
||||
.describe('f',
|
||||
"Load a file. It's pretty important."
|
||||
+ " Required even. So you'd better specify it."
|
||||
)
|
||||
.alias('b', 'base')
|
||||
.describe('b', 'Numeric base to display the number of lines in')
|
||||
.default('b', 10)
|
||||
.describe('x', 'Super-secret optional parameter which is secret')
|
||||
.default('x', '')
|
||||
.argv
|
||||
;
|
||||
|
||||
var fs = require('fs');
|
||||
var s = fs.createReadStream(argv.file);
|
||||
|
||||
var lines = 0;
|
||||
s.on('data', function (buf) {
|
||||
lines += buf.toString().match(/\n/g).length;
|
||||
});
|
||||
|
||||
s.on('end', function () {
|
||||
console.log(lines.toString(argv.base));
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue