mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
This commit is contained in:
parent
8c10e9d1e0
commit
3bf90dc9f1
2 changed files with 6 additions and 3 deletions
|
@ -30,11 +30,12 @@ Array [
|
|||
"taskName",
|
||||
Object {
|
||||
"args": Array [
|
||||
"f",
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
"f",
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
const run = require('./run');
|
||||
|
||||
module.exports = function createCommanderAction(taskName, getOptions = () => {}) {
|
||||
return async (command, ...args) => {
|
||||
return async (...args) => {
|
||||
try {
|
||||
await run(taskName, getOptions(...args));
|
||||
// command is the last arg passed by commander, but we move it to the front of the list
|
||||
const command = args.pop();
|
||||
await run(taskName, getOptions(command, ...args));
|
||||
} catch (error) {
|
||||
process.stderr.write(`Task "${taskName}" failed:\n\n${error.stack || error.message}\n`);
|
||||
process.exit(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue