circle-cli-util
Set of helpful CLI utilities
Installation
npm install circle-cli-util --save
Action
let cli = ;let promise = circle;let projects = cliaction'getting project' promise;console; // getting project... done// project name: project
Note: to use yield
you need to wrap this in a co block.
Prompt
Callback style
let cli = ;cliprompt'email' {} { console;};
Promise style
let cli = ;cliprompt'email' {};
Generator style (must be wrapped in a co block)
let cli = ;let email = cliprompt'email' {};console;
cli.prompt options
cliprompt'email' mask: true // mask input field after submitting hide: true // mask characters while entering;
Confirm App
Supports the same async styles as prompt()
. Errors if not confirmed.
Basic
let cli = ; cli; // ! 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 = ; cli; // ! foo// ! To proceed, type appname or re-run this command with --confirm appname > appname
Errors
let cli = ;cli;// ! App not found
Warnings
let cli = ;cli;// ! App not found
Dates
let cli = ;let d = ;console;// 2001-01-01T08:00:00.000Z
Hush
Use hush for verbose logging when CIRCLE_DEBUG=1
.
let cli = ;cli;// only prints if CIRCLE_DEBUG is set
Debug
Pretty print an object.
let cli = ;cli;// { foo: [ 1, 2, 3 ] }
Stylized output
Pretty print a header and hash
let cli = ;cli;cli;
Produces
=== MyApp
Collaborators: user1@example.com
user1@example.com
Name: myapp
Table
cli;
Produces:
app Dyno Count language
────────── ────────── ────────
first-app 3 ruby
second-app 2 node
Mocking
Mock stdout and stderr by using cli.log()
and cli.error()
.
let cli = ;cli; // prints 'message 1'cli;cli; // prints nothingclistdoutshould;
Command
Used for initializing a plugin command.
It expects you to return a promise chain. This is usually done with co.
let cli = ;let co = ;let request = ;moduleexportscommands = topic: 'apps' command: 'info' needsAuth: true needsApp: true run: cli ;
With options:
let cli = ;let co = ;moduleexportscommands = topic: 'apps' command: 'info' needsAuth: true needsApp: true run: cli ;
Tests
npm installnpm test
License
ISC