Skip to content

Commit ae79afc

Browse files
saas-1368 hide inherited filename option (#270)
* make crudFilenameOption non-global + add crudFilenameOption where it was used by inheritance * return draftlog to Output + make root commands by default require auth + describe choices for date format option * update version
1 parent c167fce commit ae79afc

File tree

13 files changed

+36
-7
lines changed

13 files changed

+36
-7
lines changed

lib/interface/cli/Command.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ class Command {
1010
constructor(command) {
1111
this.root = command.root;
1212
delete command.root;
13-
if (command.hasOwnProperty('requiresAuthentication')) {
14-
this.requiresAuthentication = command.requiresAuthentication;
15-
}
13+
14+
this.requiresAuthentication = command.hasOwnProperty('requiresAuthentication') ? command.requiresAuthentication : true;
1615
this.betaCommand = command.betaCommand || false;
1716
this.onPremCommand = command.onPremCommand || false;
1817

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const { prepareKeyValueCompostionFromCLIEnvOption, printError } = require('../..
66
const { composition } = require('../../../../logic').api;
77
const fs = require('fs');
88
const createRoot = require('../root/create.cmd');
9+
const { crudFilenameOption } = require('../../helpers/general');
910

1011

1112
const command = new Command({
@@ -18,6 +19,7 @@ const command = new Command({
1819
title: 'Create Composition',
1920
},
2021
builder: (yargs) => {
22+
crudFilenameOption(yargs);
2123
return yargs
2224
.positional('name', {
2325
describe: 'Name of composition',

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const CFError = require('cf-errors');
44
const _ = require('lodash');
55
const { composition } = require('../../../../logic').api;
66
const deleteRoot = require('../root/delete.cmd');
7+
const { crudFilenameOption } = require('../../helpers/general');
78

89

910
const command = new Command({
@@ -16,6 +17,7 @@ const command = new Command({
1617
title: 'Delete Composition',
1718
},
1819
builder: (yargs) => {
20+
crudFilenameOption(yargs);
1921
return yargs
2022
.positional('name', {
2123
describe: 'Composition name',

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const CFError = require('cf-errors');
44
const _ = require('lodash');
55
const { composition } = require('../../../../logic').api;
66
const replaceRoot = require('../root/replace.cmd');
7+
const { crudFilenameOption } = require('../../helpers/general');
78

89

910
const command = new Command({
@@ -16,6 +17,7 @@ const command = new Command({
1617
title: 'Replace Composition',
1718
},
1819
builder: (yargs) => {
20+
crudFilenameOption(yargs);
1921
return yargs;
2022
},
2123
handler: async (argv) => {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const CFError = require('cf-errors');
44
const _ = require('lodash');
55
const { context } = require('../../../../logic').api;
66
const applyRoot = require('../root/apply.cmd');
7+
const { crudFilenameOption } = require('../../helpers/general');
78

89

910
const command = new Command({
@@ -18,6 +19,7 @@ const command = new Command({
1819
weight: 90,
1920
},
2021
builder: (yargs) => {
22+
crudFilenameOption(yargs);
2123
return yargs
2224
.example('codefresh apply context -f ./context.yml', 'Apply changes to a context');
2325
},

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const CFError = require('cf-errors');
44
const _ = require('lodash');
55
const { context } = require('../../../../logic').api;
66
const deleteRoot = require('../root/delete.cmd');
7+
const { crudFilenameOption } = require('../../helpers/general');
78

89
const command = new Command({
910
command: 'context [name]',
@@ -15,6 +16,7 @@ const command = new Command({
1516
title: 'Delete Context',
1617
},
1718
builder: (yargs) => {
19+
crudFilenameOption(yargs);
1820
return yargs
1921
.positional('name', {
2022
describe: 'Name of context',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const get = new Command({
2626
group: 'Output Options',
2727
})
2828
.option('date-format', {
29-
describe: 'Date format: default, date, datetime, date-diff or custom',
29+
describe: 'Provide predefined or custom date format. Predefined options: ["default", "date", "datetime", "date-diff"]',
3030
alias: 'df',
3131
group: 'Output Options',
3232
})

lib/interface/cli/commands/runtimeEnvironments/apply.cmd.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const CFError = require('cf-errors');
44
const _ = require('lodash');
55
const { runtimeEnvironments } = require('../../../../logic').api;
66
const applyRoot = require('../root/apply.cmd');
7+
const { crudFilenameOption } = require('../../helpers/general');
78

89

910
const command = new Command({
@@ -18,6 +19,7 @@ const command = new Command({
1819
weight: 90,
1920
},
2021
builder: (yargs) => {
22+
crudFilenameOption(yargs);
2123
return yargs
2224
.positional('name', {
2325
describe: 'Runtime environments name',

lib/interface/cli/commands/systemRuntimeEnvironments/apply.cmd.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const CFError = require('cf-errors');
44
const _ = require('lodash');
55
const { runtimeEnvironments } = require('../../../../logic').api;
66
const applyRoot = require('../root/apply.cmd');
7+
const { crudFilenameOption } = require('../../helpers/general');
78

89

910
const command = new Command({
@@ -18,6 +19,7 @@ const command = new Command({
1819
weight: 90,
1920
},
2021
builder: (yargs) => {
22+
crudFilenameOption(yargs);
2123
return yargs
2224
.positional('name', {
2325
describe: 'Runtime environments name',

lib/interface/cli/helpers/general.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ const crudFilenameOption = (yargs, options = {}) => {
102102
const filenameOption = {
103103
alias: options.alias || 'f',
104104
describe: options.describe || 'Filename or directory of spec files use to create the resource',
105+
global: options.global || false,
105106
};
106107
if (options.group) {
107108
filenameOption.group = options.group;

0 commit comments

Comments
 (0)