Skip to content

Commit 801f1df

Browse files
Safe get cmd (#330)
* safe getting resources * update version * update docs
1 parent 5d6724d commit 801f1df

File tree

20 files changed

+33
-24
lines changed

20 files changed

+33
-24
lines changed

lib/interface/cli/commands/annotation/get.cmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const command = new Command({
3535
const { entityType, entityId, labels } = argv;
3636

3737
const annotations = await Logic.listAnnotations({ entityId, entityType, labels });
38-
Output.print(annotations.map(Annotation.fromResponse));
38+
Output.print(_.map(annotations, Annotation.fromResponse));
3939
},
4040
});
4141

lib/interface/cli/commands/board/get.cmd.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const debug = require('debug')('codefresh:cli:create:pipelines2');
2+
const _ = require('lodash');
23
const Command = require('../../Command');
34
const CFError = require('cf-errors');
45
const { sdk } = require('../../../../logic');
@@ -53,7 +54,7 @@ const command = new Command({
5354
}
5455
} else {
5556
const boards = await sdk.helm.boards.list();
56-
Output.print(boards.map(Board.fromResponse));
57+
Output.print(_.map(boards, Board.fromResponse));
5758
}
5859
},
5960
});

lib/interface/cli/commands/cluster/get.cmd.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const _ = require('lodash');
12
const Command = require('../../Command');
23
const Output = require('../../../../output/Output');
34
const getRoot = require('../root/get.cmd');
@@ -21,7 +22,7 @@ const command = new Command({
2122
},
2223
handler: async (argv) => {
2324
const clusters = await sdk.clusters.list();
24-
Output.print(clusters.map(Cluster.fromResponse));
25+
Output.print(_.map(clusters, Cluster.fromResponse));
2526
},
2627
});
2728

lib/interface/cli/commands/composition/get.cmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const command = new Command({
3434
} else {
3535
compositions = await sdk.compositions.list();
3636
}
37-
Output.print(compositions.map(Composition.fromResponse));
37+
Output.print(_.map(compositions, Composition.fromResponse));
3838
},
3939
});
4040

lib/interface/cli/commands/context/get.cmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const command = new Command({
5252
} else {
5353
contexts = await sdk.contexts.list(data);
5454
}
55-
Output.print(contexts.map(Context.fromResponse));
55+
Output.print(_.map(contexts, Context.fromResponse));
5656
},
5757
});
5858

lib/interface/cli/commands/environment/get.cmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const command = new Command({
3535
} else {
3636
environments = await sdk.envs.list();
3737
}
38-
Output.print(environments.map(Environment.fromResponse));
38+
Output.print(_.map(environments, Environment.fromResponse));
3939
},
4040
});
4141

lib/interface/cli/commands/helm/repo/get.cmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const command = new Command({
5353
} else {
5454
repos = await sdk.helm.repos.list();
5555
}
56-
Output.print(repos.map(HelmRepo.fromResponse));
56+
Output.print(_.map(repos, HelmRepo.fromResponse));
5757
},
5858
});
5959

lib/interface/cli/commands/pipeline/get.cmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ const command = new Command({
9696
labels,
9797
projectId: _projectId,
9898
});
99-
Output.print(pipelines.docs.map(Pipeline.fromResponse));
99+
Output.print(_.map(_.get(pipelines, 'docs'), Pipeline.fromResponse));
100100
}
101101
},
102102
});

lib/interface/cli/commands/pipeline/get.completion.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
const _ = require('lodash');
12
const pipelines = () => require('../../../../logic').sdk.pipelines;
23
const Pipeline = require('../../../../logic/entities/Pipeline');
34
const { authContextWrapper } = require('../../completion/helpers');
45

56
const positionalHandler = async ({word, argv}) => {
67
const pips = await pipelines().list({ limit: 25, offset: 0 });
7-
return pips.docs.map(Pipeline.fromResponse).map(p => p.name);
8+
return _.map(_.get(pips, 'docs'), Pipeline.fromResponse).map(p => p.name);
89
};
910

1011
module.exports = {

lib/interface/cli/commands/registry/get.cmd.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const debug = require('debug')('codefresh:cli:get:cluster');
2+
const _ = require('lodash');
23
const Command = require('../../Command');
34
const Output = require('../../../../output/Output');
45
const getRoot = require('../root/get.cmd');
@@ -21,7 +22,7 @@ const command = new Command({
2122
},
2223
handler: async (argv) => {
2324
const registries = await sdk.registries.list();
24-
Output.print(registries.map(Registry.fromResponse));
25+
Output.print(_.map(registries, Registry.fromResponse));
2526
},
2627
});
2728

0 commit comments

Comments
 (0)