savory
Version:
A command-line interface for operating your Codefresh account
22 lines (21 loc) • 702 B
JavaScript
const
fp = require('lodash/fp'),
jsYaml = require('js-yaml'),
{ middleware: apiMiddleware } = require('../../lib/api_client'),
{ errorFormatter } = require('../style');
module.exports = {
command: "get [id]",
describe: "Gets a pipeline",
builder: (yargs)=> {
return yargs
.positional('id', {
type: "string",
describe: "The name of the pipeline to get"
});
},
handler: fp.pipe(apiMiddleware, ({ _httpClient, id })=> {
_httpClient(`pipelines/${encodeURIComponent(id)}`)
.then(fp.pipe(jsYaml.safeDump, console.log))
.catch(fp.pipe(errorFormatter, console.warn));
})
};