Skip to content

Commit b87030e

Browse files
override existing function and update options
1 parent f95eee0 commit b87030e

File tree

4 files changed

+62
-49
lines changed

4 files changed

+62
-49
lines changed

README.md

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ OPTIONS
8888
-s, --schema=schema (required) [default: templates] schema path
8989
```
9090

91-
_See code: [src/commands/autopilot/create.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/create.js)_
91+
_See code: [src/commands/autopilot/create.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/create.js)_
9292

9393
## `twilio autopilot:delete`
9494

@@ -106,7 +106,7 @@ OPTIONS
106106
--uniqueName=uniqueName assistant uniqueName
107107
```
108108

109-
_See code: [src/commands/autopilot/delete.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/delete.js)_
109+
_See code: [src/commands/autopilot/delete.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/delete.js)_
110110

111111
## `twilio autopilot:deploy`
112112

@@ -130,9 +130,11 @@ OPTIONS
130130
-u, --account-sid=account-sid A specific account SID to be used for deployment. Uses fields in .env otherwise
131131
132132
--auth-token=auth-token Use a specific auth token for deployment. Uses fields from .env otherwise
133+
134+
--override-existing-project Deploys Serverless project to existing service if a naming conflict has been found.
133135
```
134136

135-
_See code: [src/commands/autopilot/deploy.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/deploy.js)_
137+
_See code: [src/commands/autopilot/deploy.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/deploy.js)_
136138

137139
## `twilio autopilot:export`
138140

@@ -150,7 +152,7 @@ OPTIONS
150152
--uniqueName=uniqueName assistant uniqueName
151153
```
152154

153-
_See code: [src/commands/autopilot/export.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/export.js)_
155+
_See code: [src/commands/autopilot/export.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/export.js)_
154156

155157
## `twilio autopilot:fields:create`
156158

@@ -175,7 +177,7 @@ OPTIONS
175177
--uniqueName=uniqueName (required) field unique name
176178
```
177179

178-
_See code: [src/commands/autopilot/fields/create.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/fields/create.js)_
180+
_See code: [src/commands/autopilot/fields/create.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/fields/create.js)_
179181

180182
## `twilio autopilot:fields:delete`
181183

@@ -198,7 +200,7 @@ OPTIONS
198200
--taskSid=taskSid task sid
199201
```
200202

201-
_See code: [src/commands/autopilot/fields/delete.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/fields/delete.js)_
203+
_See code: [src/commands/autopilot/fields/delete.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/fields/delete.js)_
202204

203205
## `twilio autopilot:fields:list`
204206

@@ -217,7 +219,7 @@ OPTIONS
217219
--taskSid=taskSid task sid
218220
```
219221

220-
_See code: [src/commands/autopilot/fields/list.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/fields/list.js)_
222+
_See code: [src/commands/autopilot/fields/list.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/fields/list.js)_
221223

222224
## `twilio autopilot:fieldtypes:create`
223225

@@ -236,7 +238,7 @@ OPTIONS
236238
--uniqueName=uniqueName (required) unique name for the field type
237239
```
238240

239-
_See code: [src/commands/autopilot/fieldtypes/create.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/fieldtypes/create.js)_
241+
_See code: [src/commands/autopilot/fieldtypes/create.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/fieldtypes/create.js)_
240242

241243
## `twilio autopilot:fieldtypes:list`
242244

@@ -254,7 +256,7 @@ OPTIONS
254256
--properties=properties [default: sid, uniqueName] The Autopilot Assistant FieldType List.
255257
```
256258

257-
_See code: [src/commands/autopilot/fieldtypes/list.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/fieldtypes/list.js)_
259+
_See code: [src/commands/autopilot/fieldtypes/list.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/fieldtypes/list.js)_
258260

259261
## `twilio autopilot:fieldtypes:update`
260262

@@ -274,7 +276,7 @@ OPTIONS
274276
--uniqueName=uniqueName field type unique name to update
275277
```
276278

277-
_See code: [src/commands/autopilot/fieldtypes/update.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/fieldtypes/update.js)_
279+
_See code: [src/commands/autopilot/fieldtypes/update.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/fieldtypes/update.js)_
278280

279281
## `twilio autopilot:fieldvalues:upload`
280282

@@ -293,7 +295,7 @@ OPTIONS
293295
--fileName=fileName (required) a CSV file of field values (one on each row with synonyms in columns)
294296
```
295297

296-
_See code: [src/commands/autopilot/fieldvalues/upload.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/fieldvalues/upload.js)_
298+
_See code: [src/commands/autopilot/fieldvalues/upload.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/fieldvalues/upload.js)_
297299

298300
## `twilio autopilot:import [TYPE]`
299301

@@ -322,7 +324,7 @@ DESCRIPTION
322324
-> twilio autopilot:import alexa --model <alexa-interaction-model-file> [--redirectURL <alexa-back-end-hanlder-url>]
323325
```
324326

325-
_See code: [src/commands/autopilot/import.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/import.js)_
327+
_See code: [src/commands/autopilot/import.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/import.js)_
326328

327329
## `twilio autopilot:init`
328330

@@ -336,11 +338,11 @@ OPTIONS
336338
-l=(debug|info|warn|error|none) [default: info] Level of logging messages.
337339
-o=(columns|json|tsv) [default: columns] Format of command output.
338340
-p, --profile=profile Shorthand identifier for your profile.
339-
-u, --accountSid=accountSid A specific account SID to be used for deployment
340-
--authToken=authToken Use a specific auth token for deployment
341+
-u, --account-sid=account-sid A specific account SID to be used for deployment. Uses fields in .env otherwise
342+
--auth-token=auth-token Use a specific auth token for deployment. Uses fields from .env otherwise
341343
```
342344

343-
_See code: [src/commands/autopilot/init.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/init.js)_
345+
_See code: [src/commands/autopilot/init.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/init.js)_
344346

345347
## `twilio autopilot:list`
346348

@@ -357,7 +359,7 @@ OPTIONS
357359
--properties=properties [default: sid, uniqueName, friendlyName] The Autopilot Assistant List.
358360
```
359361

360-
_See code: [src/commands/autopilot/list.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/list.js)_
362+
_See code: [src/commands/autopilot/list.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/list.js)_
361363

362364
## `twilio autopilot:modelbuilds:create`
363365

@@ -375,7 +377,7 @@ OPTIONS
375377
-u, --callbackURL=callbackURL URL to get notified of model build status
376378
```
377379

378-
_See code: [src/commands/autopilot/modelbuilds/create.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/modelbuilds/create.js)_
380+
_See code: [src/commands/autopilot/modelbuilds/create.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/modelbuilds/create.js)_
379381

380382
## `twilio autopilot:queries:export`
381383

@@ -393,7 +395,7 @@ OPTIONS
393395
-s, --assistantSid=assistantSid (required) assistant that owns the task
394396
```
395397

396-
_See code: [src/commands/autopilot/queries/export.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/queries/export.js)_
398+
_See code: [src/commands/autopilot/queries/export.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/queries/export.js)_
397399

398400
## `twilio autopilot:samples:upload`
399401

@@ -412,7 +414,7 @@ OPTIONS
412414
--taskSid=taskSid task sid
413415
```
414416

415-
_See code: [src/commands/autopilot/samples/upload.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/samples/upload.js)_
417+
_See code: [src/commands/autopilot/samples/upload.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/samples/upload.js)_
416418

417419
## `twilio autopilot:simulate`
418420

@@ -430,7 +432,7 @@ OPTIONS
430432
-t, --text=text (required) User text input
431433
```
432434

433-
_See code: [src/commands/autopilot/simulate.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/simulate.js)_
435+
_See code: [src/commands/autopilot/simulate.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/simulate.js)_
434436

435437
## `twilio autopilot:tasks:create`
436438

@@ -449,7 +451,7 @@ OPTIONS
449451
--uniqueName=uniqueName (required) unique name for task
450452
```
451453

452-
_See code: [src/commands/autopilot/tasks/create.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/tasks/create.js)_
454+
_See code: [src/commands/autopilot/tasks/create.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/tasks/create.js)_
453455

454456
## `twilio autopilot:tasks:delete`
455457

@@ -467,7 +469,7 @@ OPTIONS
467469
--taskSid=taskSid task sid
468470
```
469471

470-
_See code: [src/commands/autopilot/tasks/delete.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/tasks/delete.js)_
472+
_See code: [src/commands/autopilot/tasks/delete.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/tasks/delete.js)_
471473

472474
## `twilio autopilot:tasks:list`
473475

@@ -485,7 +487,7 @@ OPTIONS
485487
--properties=properties [default: sid, uniqueName, friendlyName] The Autopilot Assistant Task List.
486488
```
487489

488-
_See code: [src/commands/autopilot/tasks/list.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/tasks/list.js)_
490+
_See code: [src/commands/autopilot/tasks/list.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/tasks/list.js)_
489491

490492
## `twilio autopilot:tasks:update`
491493

@@ -505,7 +507,7 @@ OPTIONS
505507
--uniqueName=uniqueName task unique name to update
506508
```
507509

508-
_See code: [src/commands/autopilot/tasks/update.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/tasks/update.js)_
510+
_See code: [src/commands/autopilot/tasks/update.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/tasks/update.js)_
509511

510512
## `twilio autopilot:update`
511513

@@ -523,7 +525,7 @@ OPTIONS
523525
--uniqueName=uniqueName assistant uniqueName
524526
```
525527

526-
_See code: [src/commands/autopilot/update.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/update.js)_
528+
_See code: [src/commands/autopilot/update.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/update.js)_
527529

528530
## `twilio autopilot:webhooks:create`
529531

@@ -544,7 +546,7 @@ OPTIONS
544546
-w, --webhookUniqueName=webhookUniqueName (required) unique name for webhook
545547
```
546548

547-
_See code: [src/commands/autopilot/webhooks/create.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/webhooks/create.js)_
549+
_See code: [src/commands/autopilot/webhooks/create.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/webhooks/create.js)_
548550

549551
## `twilio autopilot:webhooks:delete`
550552

@@ -562,7 +564,7 @@ OPTIONS
562564
--webhookSid=webhookSid SID of the webhook to delete
563565
```
564566

565-
_See code: [src/commands/autopilot/webhooks/delete.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/webhooks/delete.js)_
567+
_See code: [src/commands/autopilot/webhooks/delete.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/webhooks/delete.js)_
566568

567569
## `twilio autopilot:webhooks:list`
568570

@@ -582,7 +584,7 @@ OPTIONS
582584
webhookMethod] The Autopilot Assistant Webhooks List.
583585
```
584586

585-
_See code: [src/commands/autopilot/webhooks/list.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/webhooks/list.js)_
587+
_See code: [src/commands/autopilot/webhooks/list.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/webhooks/list.js)_
586588

587589
## `twilio autopilot:webhooks:update`
588590

@@ -604,7 +606,7 @@ OPTIONS
604606
--webhookSid=webhookSid SID of the webhook to update
605607
```
606608

607-
_See code: [src/commands/autopilot/webhooks/update.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.16/src/commands/autopilot/webhooks/update.js)_
609+
_See code: [src/commands/autopilot/webhooks/update.js](https://github.com/tingiris/twilio-cli-autopilot-plugin/blob/v1.0.0-beta.17/src/commands/autopilot/webhooks/update.js)_
608610

609611
## `twilio help [COMMAND]`
610612

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@dabblelab/plugin-autopilot",
33
"description": "Create, Update, Delete, List, Simulate, Import and Export Twilio Autopilot Assistant",
4-
"version": "1.0.0-beta.16",
4+
"version": "1.0.0-beta.17",
55
"author": "Steve Tingiris",
66
"bugs": "https://github.com/tingiris/twilio-cli-autopilot-plugin/issues",
77
"dependencies": {

src/commands/autopilot/init.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ const {flags} = require('@oclif/command'),
66
ora = require('ora'),
77
path = require('path');
88

9+
const { initCliInfo } = require('../../lib/serverless/deploy');
10+
const {
11+
convertYargsOptionsToOclifFlags,
12+
normalizeFlags,
13+
createExternalCliOptions,
14+
} = require('../../utils');
15+
916
class InitAssistant extends TwilioClientCommand {
1017

1118
async runCommand() {
@@ -16,6 +23,7 @@ class InitAssistant extends TwilioClientCommand {
1623
let { flags, args } = this.parse(InitAssistant),
1724
clonedAssistant = '';
1825

26+
flags = normalizeFlags(flags);
1927

2028
let url = 'https://raw.githubusercontent.com/Mohammad-Khalid/autopilot-templates/master/Templates/templates.json';
2129

@@ -47,15 +55,7 @@ class InitAssistant extends TwilioClientCommand {
4755
InitAssistant.description = `Init autopilot bot template`;
4856

4957
InitAssistant.flags = Object.assign(
50-
{
51-
"accountSid" : flags.string({
52-
char : 'u',
53-
description : 'A specific account SID to be used for deployment'
54-
}),
55-
"authToken" : flags.string({
56-
description : 'Use a specific auth token for deployment'
57-
})
58-
},
58+
convertYargsOptionsToOclifFlags(initCliInfo.options),
5959
TwilioClientCommand.flags
6060
)
6161

src/lib/serverless/deploy.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,10 @@ function handleError(err, spinner, flags, config) {
3232
if (err.name === 'conflicting-servicename') {
3333
const fullCommand = utils_2.getFullCommand(flags);
3434
const messageBody = common_tags_1.stripIndent `
35-
Here are a few ways to solve this problem:
36-
37-
- Rename your project in the package.json "name" property
38-
- Pass an explicit name to your deployment
39-
> ${utils_2.constructCommandName(fullCommand, 'deploy', [
40-
'-n',
41-
'my-new-service-name',
42-
])}
4335
- Deploy to the existing service with the name "${err['serviceName'] || config.serviceName}"
4436
> ${utils_2.constructCommandName(fullCommand, 'deploy', [
4537
'--override-existing-project',
4638
])}
47-
- Run deployment in force mode
48-
> ${utils_2.constructCommandName(fullCommand, 'deploy', ['--force'])}
4939
`;
5040
logger_1.logger.error(messageBody, err.message);
5141
}
@@ -145,9 +135,30 @@ exports.cliInfo = {
145135
describe: 'Upload assets. Can be turned off with --no-assets',
146136
default: true,
147137
hidden : true
138+
},
139+
'override-existing-project': {
140+
type: 'boolean',
141+
describe: 'Deploys Serverless project to existing service if a naming conflict has been found.',
142+
default: false,
148143
}
149144
}),
150145
};
146+
147+
exports.initCliInfo = {
148+
options: Object.assign({},
149+
{
150+
'account-sid': {
151+
type: 'string',
152+
alias: 'u',
153+
describe: 'A specific account SID to be used for deployment. Uses fields in .env otherwise'
154+
},
155+
'auth-token': {
156+
type: 'string',
157+
describe: 'Use a specific auth token for deployment. Uses fields from .env otherwise',
158+
}
159+
}
160+
),
161+
};
151162
function optionBuilder(yargs) {
152163
yargs = yargs
153164
.example('$0 deploy', 'Deploys all functions and assets in the current working directory')

0 commit comments

Comments
 (0)