Skip to content

Commit 4c05627

Browse files
Fix runner delete (#482)
1 parent 906a1f6 commit 4c05627

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/interface/cli/commands/hybrid/delete.cmd.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,23 @@ const deleteCmd = new Command({
114114
console.log(colors.yellow('No agents related to the specified kubernetes cluster and namespace were found, displaying all agents'));
115115
agentsChoices = agents;
116116
}
117+
const choicesToAgentNames = agentsChoices.reduce((acc, a) => {
118+
acc[`${a.name}\t${a.runtimes.length ? `(attached runtimes: ${a.runtimes.join(', ')})` : ''}`] = a.name;
119+
return acc;
120+
}, {});
117121
const answer = await inquirer.prompt({
118122
type: 'list',
119123
name: 'name',
120124
message: 'Agent name to uninstall',
121-
choices: agentsChoices.map(a => `${a.name}\t${a.runtimes.length ? `(attached runtimes: ${a.runtimes.join(', ')})` : ''}`),
125+
choices: Object.keys(choicesToAgentNames),
122126
});
123-
agentName = answer.name;
127+
agentName = choicesToAgentNames[answer.name];
124128
}
125129

126130
// check that agent exists
127131
const agent = _.find(agents, curr => curr.name === agentName);
128132
if (!agent) {
129-
console.log(colors.red(`Agent with name ${agentName} doesn't exists`));
133+
console.log(colors.red(`Agent with name "${agentName}" doesn't exists`));
130134
return;
131135
}
132136
if (agent.runtimes && agent.runtimes.length > 1) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.64.8",
3+
"version": "0.64.9",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)