Skip to content

Commit 6faeac2

Browse files
Merge pull request #38 from codefresh-io/CF-4974
Cf 4974
2 parents 9895b9f + dad468d commit 6faeac2

File tree

7 files changed

+18
-17
lines changed

7 files changed

+18
-17
lines changed

lib/interface/cli/commands/get/commands/compositions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ const builder = (yargs) => {
1717

1818
const handler = async (argv) => {
1919
const compositionId = argv.id;
20-
20+
const output = argv.output ? argv.output : 'default';
2121
let compositions;
2222
// TODO:need to decide for one way for error handeling
2323
if (compositionId) {
2424
compositions = await composition.getCompositionByIdentifier(compositionId);
25-
specifyOutputForSingle(argv.output, compositions);
25+
specifyOutputForSingle(output, compositions);
2626
} else {
2727
compositions = await composition.getCompositions();
28-
specifyOutputForArray(argv.output, compositions);
28+
specifyOutputForArray(output, compositions);
2929
}
3030

3131
};

lib/interface/cli/commands/get/commands/contexts.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ const handler = async (argv) => {
3131
if (argv.owner) {
3232
data.owner = argv.owner;
3333
}
34-
34+
const output = argv.output ? argv.output : 'default';
3535
if (argv.name) {
3636
try {
3737
const singleContext = await context.getContextByName(argv.name, data.owner);
38-
specifyOutputForSingle(argv.output, singleContext);
38+
specifyOutputForSingle(output, singleContext);
3939
}
4040
catch (err) {
4141
const error = new CFError({
@@ -48,7 +48,7 @@ const handler = async (argv) => {
4848
else {
4949
try {
5050
const contextArray = await context.getContexts(data);
51-
specifyOutputForArray(argv.output, contextArray);
51+
specifyOutputForArray(output, contextArray);
5252
}
5353
catch (err) {
5454
const error = new CFError({

lib/interface/cli/commands/get/commands/environments.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ const builder = (yargs) => {
1717

1818
const handler = async (argv) => {
1919
const environmentId = argv.id;
20-
20+
const output = argv.output ? argv.output : 'default';
2121
let environments;
2222
// TODO:need to decide for one way for error handeling
2323
if (environmentId) {
2424
environments = await environment.getEnvironmentById(environmentId);
25-
specifyOutputForSingle(argv.output, environments);
25+
specifyOutputForSingle(output, environments);
2626
} else {
2727
environments = await environment.getEnvironments();
28-
specifyOutputForArray(argv.output, environments);
28+
specifyOutputForArray(output, environments);
2929
}
3030

3131
};

lib/interface/cli/commands/get/commands/images.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const handler = async (argv) => {
4545
if (!allRegistries) {
4646
filterRegistries = DEFAULTS.CODEFRESH_REGISTRIES;
4747
}
48-
48+
const output = argv.output ? argv.output : 'default';
4949
let images;
5050
// TODO:need to decide for one way for error handeling
5151
if (imageId) {
@@ -60,7 +60,7 @@ const handler = async (argv) => {
6060
});
6161
}
6262

63-
specifyOutputForArray(argv.output, images);
63+
specifyOutputForArray(output, images);
6464
};
6565

6666
module.exports = {

lib/interface/cli/commands/get/commands/pipelines.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const handler = async (argv) => {
2727
const id = argv.id;
2828
const repoOwner = argv['repo-owner'];
2929
const repoName = argv['repo-name'];
30+
const output = argv.output ? argv.output : 'default';
3031

3132
let pipelines;
3233
// TODO:need to decide for one way for error handeling
@@ -41,9 +42,9 @@ const handler = async (argv) => {
4142
}
4243

4344
if (_.isArray(pipelines)) {
44-
specifyOutputForArray(argv.output, pipelines);
45+
specifyOutputForArray(output, pipelines);
4546
} else {
46-
specifyOutputForSingle(argv.output, pipelines);
47+
specifyOutputForSingle(output, pipelines);
4748
}
4849
};
4950

lib/interface/cli/commands/get/commands/workflows.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,19 @@ const handler = async (argv) => {
2828
const workflowId = argv.id;
2929
const limit = argv.limit;
3030
const page = argv.page;
31+
const output = argv.output ? argv.output : 'default';
3132

3233
let workflows;
3334
// TODO:need to decide for one way for error handeling
3435
if (workflowId) {
3536
workflows = await workflow.getWorkflowById(workflowId);
36-
specifyOutputForSingle(argv.output, workflows);
37+
specifyOutputForSingle(output, workflows);
3738
} else {
3839
workflows = await workflow.getWorkflows({
3940
limit,
4041
page,
4142
});
42-
specifyOutputForArray(argv.output, workflows);
43+
specifyOutputForArray(output, workflows);
4344
}
4445
};
4546

lib/interface/cli/commands/get/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ const builder = (yargs) => {
2626
.option('output', {
2727
describe: 'Output format',
2828
alias: 'o',
29-
choices: ['json', 'yaml', 'wide', 'name', 'default'],
30-
default: 'default',
29+
choices: ['json', 'yaml', 'wide', 'name'],
3130
});
3231

3332
crudFilenameOption(yargs);

0 commit comments

Comments
 (0)