savory
Version:
A command-line interface for operating your Codefresh account
23 lines (21 loc) • 660 B
JavaScript
const
fp = require('lodash/fp'),
{ middleware: httpClientMiddleware } = require('../../lib/api_client'),
{
tableFormatter,
errorFormatter
} = require('../style');
module.exports = {
command: ["list", "ls"],
builder: (yargs)=> yargs,
handler: fp.pipe(httpClientMiddleware, ({ _httpClient })=> {
_httpClient('contexts')
.then(
fp.pipe(
fp.map(fp.at(["metadata.name", "spec.type"])), tableFormatter({ title: ["Name", "Type"] }),
console.log
)
)
.catch(fp.pipe(errorFormatter, console.warn));
})
};