Format JavaScript Standard Style as Stylish (i.e. snazzy) output
94
Build a command-line tool that counts non-empty lines from stdin and outputs the count. The tool should follow Unix philosophy: do one thing well, work with pipes, and have minimal dependencies.
The tool must:
- or --stdin flag)When piped text data:
echo -e "hello\nworld\n\n" | line-counterOutput: 2
When using explicit stdin flag:
line-counter - < data.txt
line-counter --stdin < data.txtWhen run in terminal without input:
line-counterOutput: Usage message explaining the tool
@generates
/**
* LineCounterStream - Transform stream that counts non-empty lines
* Extends stream.Transform from readable-stream
*/
class LineCounterStream extends Transform {
constructor(options);
_transform(chunk, encoding, callback);
_flush(callback);
}
module.exports = LineCounterStream;Provides Node.js streams compatibility across versions.
@satisfied-by
Parses command-line arguments (e.g., --stdin flag).
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-snazzydocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10