Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
aggregated-cli-reporter
Advanced tools
A way of reporting results of multiple processes without overflowing the terminal
A way of reporting results of multiple processes without overflowing the terminal.
It will rewrite the previous lines, so there never are more visible than the latest message.
Note: If something else is writing to stdout, it will interfere with this module,
since this module can only delete the x last lines
, which no longer matches the
actual lines written to stdout.
The interface:
class AggregatedCLIReporter {
constructor({ showTime = true, showName = false })
set(name, messages, { showTime = true, showName = false })
}
import AggregatedCLIReporter from 'aggregated-cli-reporter'
// Or
const AggregatedCLIReporter = require('aggregated-cli-reporter')
const reporter = new AggregatedCLIReporter()
The constructor can take some configuration options:
showTime
: Shows a timestamp that the message was received. Defaults to true
.showName
: Shows the name passed to #set()
. Defaults to false
.const reporter = new AggregatedCLIReporter({
showTime: false,
showName: true,
})
The reporter.set()
method sets the latest output for a specific name.
reporter.set('tool1', 'Some message')
/* output:
12:45:12: Some message
*/
There can only ever be one message per name, but there is no limit to the number of names.
reporter.set('tool2', 'Some other message')
/* output:
12:45:12: Some message
12:47:22: Some other message
*/
// skip 12 seconds
reporter.set('tool2', 'Something new happened')
/* output:
12:45:12: Some message
12:47:34: Something new happened
*/
The names are printed in the order that they were last modified, so the latest message is always in the bottom.
reporter.set('tool1', 'Something happened to the first tool')
/* output:
12:47:34: Something new happened
12:49:01: Something happened to the first tool
*/
Any characters can be added, including colors and newlines.
reporter.set('tool1', 'Tool 1 is split\non lines')
/* output:
12:47:34: Something new happened
13:01:43: Tool 1 is split
on lines
*/
The message can also be an array, in which case the tool will print each value on a separate line, all prefixed.
reporter.set('tool1', [ 'Something happened', 'that should', 'be split\non lines' ])
/* output:
12:47:34: Something new happened
13:02:23: Something happened
13:02:23: that should
13:02:23: be split
on lines
*/
The #set()
call takes the same arguments as the constructor. The options will
override the default for that specific message only.
const reporter = new AggregatedCLIReporter({ showTime: true, showName: true })
reporter.set('tool1', 'abc')
/* output:
12:34:56: tool1: abc
*/
reporter.set('tool1', 'abc', { showName: false })
/* output:
12:34:56: abc
*/
reporter.set('tool2', 'def', { showTime: false })
/* output:
12:34:56: abc
tool2: def
*/
reporter.set('tool3', [ 'ghi', 'jkl' ])
/* output:
12:34:56: abc
tool2: def
12:34:56: tool3: ghi
12:34:56: tool3: jkl
*/
FAQs
A way of reporting results of multiple processes without overflowing the terminal
The npm package aggregated-cli-reporter receives a total of 0 weekly downloads. As such, aggregated-cli-reporter popularity was classified as not popular.
We found that aggregated-cli-reporter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.