Skip to content

Commit e6ba016

Browse files
committed
feat(list): make services the default list type
Before environments and builds where the default type. This seems confusing for new folks. So the default is changed to "services". With the upcoming config capabilities, people can change that behavior BREAKING CHANGE: Default output of "twilio-run list" changed fix: #44
1 parent 9ff9a04 commit e6ba016

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/commands/list.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ async function getConfigFromFlags(flags: ListCliFlags): Promise<ListConfig> {
9595
}
9696

9797
const types = flags.types.split(',') as ListOptions[];
98+
console.log(types);
9899

99100
return {
100101
cwd,
@@ -155,7 +156,7 @@ export async function handler(flags: ListCliFlags): Promise<void> {
155156

156157
export const cliInfo: CliInfo = {
157158
argsDefaults: {
158-
types: 'environments,builds',
159+
types: 'services',
159160
},
160161
options: {
161162
'service-name': {
@@ -216,8 +217,19 @@ export const cliInfo: CliInfo = {
216217
};
217218

218219
function optionBuilder(yargs: Argv<any>): Argv<ListCliFlags> {
220+
if (cliInfo.argsDefaults) {
221+
yargs = Object.keys(cliInfo.argsDefaults).reduce(
222+
(yargs: Argv<any>, name: string) => {
223+
if (cliInfo.argsDefaults && cliInfo.argsDefaults[name]) {
224+
return yargs.default(name, cliInfo.argsDefaults[name]);
225+
}
226+
return yargs;
227+
},
228+
yargs
229+
);
230+
}
231+
219232
yargs = yargs
220-
.default('types', 'environments,builds')
221233
.example(
222234
'$0 list services',
223235
'Lists all existing services/projects associated with your Twilio Account'

0 commit comments

Comments
 (0)