Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
circle-cli-util
Advanced tools
Set of helpful CLI utilities
npm install circle-cli-util --save
let cli = require('circle-cli-util');
let promise = circle.projects(project).info();
let projects = yield cli.action('getting project', promise);
console.log(`project name: ${project.name}`);
// getting project... done
// project name: project
Note: to use yield
you need to wrap this in a co block.
Callback style
let cli = require('circle-cli-util');
cli.prompt('email', {}, function (_, email) {
console.log(`your email is: ${email}`);
});
Promise style
let cli = require('circle-cli-util');
cli.prompt('email', {}).then(function (email) {
console.log(`your email is: ${email}`);
});
Generator style (must be wrapped in a co block)
let cli = require('circle-cli-util');
let email = yield cli.prompt('email', {});
console.log(`your email is: ${email}`);
cli.prompt options
cli.prompt('email', {
mask: true, // mask input field after submitting
hide: true // mask characters while entering
});
Supports the same async styles as prompt()
. Errors if not confirmed.
Basic
let cli = require('circle-cli-util');
yield cli.confirmApp('appname', context.flags.confirm);
// ! WARNING: Destructive Action
// ! This command will affect the app appname
// ! To proceed, type appname or re-run this command with --confirm appname
> appname
Custom message
let cli = require('circle-cli-util');
yield cli.confirmApp('appname', context.flags.confirm, 'foo');
// ! foo
// ! To proceed, type appname or re-run this command with --confirm appname
> appname
let cli = require('circle-cli-util');
cli.error("App not found");
// ! App not found
let cli = require('circle-cli-util');
cli.warn("App not found");
// ! App not found
let cli = require('circle-cli-util');
let d = new Date();
console.log(cli.formatDate(d));
// 2001-01-01T08:00:00.000Z
Use hush for verbose logging when CIRCLE_DEBUG=1
.
let cli = require('circle-cli-util');
cli.hush('foo');
// only prints if CIRCLE_DEBUG is set
Pretty print an object.
let cli = require('circle-cli-util');
cli.debug({foo: [1,2,3]});
// { foo: [ 1, 2, 3 ] }
Pretty print a header and hash
let cli = require('circle-cli-util');
cli.styledHeader("MyApp");
cli.styledHash({name: "myapp", collaborators: ["user1@example.com", "user2@example.com"]});
Produces
=== MyApp
Collaborators: user1@example.com
user1@example.com
Name: myapp
cli.table([
{app: 'first-app', language: 'ruby', dyno_count: 3},
{app: 'second-app', language: 'node', dyno_count: 2},
], {
columns: [
{key: 'app'},
{key: 'dyno_count', label: 'Dyno Count'},
{key: 'language', format: language => cli.color.red(language)},
]
});
Produces:
app Dyno Count language
────────── ────────── ────────
first-app 3 ruby
second-app 2 node
Mock stdout and stderr by using cli.log()
and cli.error()
.
let cli = require('circle-cli-util');
cli.log('message 1'); // prints 'message 1'
cli.mockConsole();
cli.log('message 2'); // prints nothing
cli.stdout.should.eq('message 2\n');
Used for initializing a plugin command.
It expects you to return a promise chain. This is usually done with co.
let cli = require('circle-cli-util');
let co = require('co');
let request = require('request');
module.exports.commands = [
{
topic: 'apps',
command: 'info',
needsAuth: true,
needsApp: true,
run: cli.command(function (context) {
return co(function* () {
let projects = yield request.get('https://circleci.com/api/v1/projects');
console.dir(app);
});
})
}
];
With options:
let cli = require('circle-cli-util');
let co = require('co');
module.exports.commands = [
{
topic: 'apps',
command: 'info',
needsAuth: true,
needsApp: true,
run: cli.command(
{preauth: true},
function (context) {
return co(function* () {
let projects = yield request.get('https://circleci.com/api/v1/projects');
console.dir(app);
});
}
)
}
];
npm install
npm test
ISC
FAQs
Set of helpful CLI utilities
The npm package circle-cli-util receives a total of 1 weekly downloads. As such, circle-cli-util popularity was classified as not popular.
We found that circle-cli-util 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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.