This repository was archived by the owner on Feb 3, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +40
-28
lines changed Expand file tree Collapse file tree 3 files changed +40
-28
lines changed Original file line number Diff line number Diff line change 44
55- Minor updates
66 - Better error messages if the cli fails to create a directory. Fixes #14
7+ - Exports details about the cli command so that other projects can consume it. Fixes #12
78
89## 1.0.1 (May 4, 2018) [ ☰] ( https://github.com/twilio-labs/create-twilio-function/compare/v1.0.0...v1.0.1 )
910
Original file line number Diff line number Diff line change 11const yargs = require ( 'yargs' ) ;
2- const createTwilioFunction = require ( './create-twilio-function ' ) ;
2+ const { handler , describe , cliInfo } = require ( './command ' ) ;
33
44function cli ( cwd ) {
55 yargs . help ( ) ;
@@ -9,41 +9,18 @@ function cli(cwd) {
99
1010 yargs . default ( 'path' , cwd ) ;
1111
12- yargs . usage ( 'Creates a new Twilio Function project' ) ;
12+ yargs . usage ( describe ) ;
1313 yargs . command (
1414 '$0 <name>' ,
15- 'Creates a new Twilio Function project' ,
15+ describe ,
1616 command => {
1717 command . positional ( 'name' , {
1818 describe : 'Name of your project.' ,
1919 type : 'string'
2020 } ) ;
21- command . options ( {
22- 'account-sid' : {
23- alias : 'a' ,
24- describe : 'The Account SID for your Twilio account' ,
25- type : 'string'
26- } ,
27- 'auth-token' : {
28- alias : 't' ,
29- describe : 'Your Twilio account Auth Token' ,
30- type : 'string'
31- } ,
32- 'skip-credentials' : {
33- describe :
34- "Don't ask for Twilio account credentials or import them from the environment" ,
35- type : 'boolean' ,
36- default : false
37- } ,
38- 'import-credentials' : {
39- describe :
40- 'Import credentials from the environment variables TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN' ,
41- type : 'boolean' ,
42- default : false
43- }
44- } ) ;
21+ command . options ( cliInfo . options ) ;
4522 } ,
46- argv => createTwilioFunction ( argv )
23+ argv => handler ( argv )
4724 ) ;
4825
4926 return yargs ;
Original file line number Diff line number Diff line change 1+ const createTwilioFunction = require ( './create-twilio-function' ) ;
2+
3+ const cliInfo = {
4+ options : {
5+ 'account-sid' : {
6+ alias : 'a' ,
7+ describe : 'The Account SID for your Twilio account' ,
8+ type : 'string'
9+ } ,
10+ 'auth-token' : {
11+ alias : 't' ,
12+ describe : 'Your Twilio account Auth Token' ,
13+ type : 'string'
14+ } ,
15+ 'skip-credentials' : {
16+ describe :
17+ "Don't ask for Twilio account credentials or import them from the environment" ,
18+ type : 'boolean' ,
19+ default : false
20+ } ,
21+ 'import-credentials' : {
22+ describe :
23+ 'Import credentials from the environment variables TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN' ,
24+ type : 'boolean' ,
25+ default : false
26+ }
27+ }
28+ } ;
29+
30+ module . exports = {
31+ describe : 'Creates a new Twilio Function project' ,
32+ handler : createTwilioFunction ,
33+ cliInfo : cliInfo
34+ } ;
You can’t perform that action at this time.
0 commit comments