@@ -3,6 +3,7 @@ var fs = require('fs'),
33 parseUrl = require ( 'url' ) . parse ,
44 request = require ( 'request' ) ,
55 argv = require ( 'optimist' ) . argv ,
6+ prompt = require ( 'prompt' ) ,
67 FormData = require ( 'form-data' ) ,
78 IonicProject = require ( './project' ) ,
89 IonicTask = require ( './task' ) . IonicTask ,
@@ -30,16 +31,36 @@ IonicTask.prototype.run = function(ionic) {
3031 login . get ( ionic , function ( jar ) {
3132 self . jar = jar ;
3233
33- if ( argv [ 'versions ' ] || argv . v ) {
34+ if ( argv [ 'list ' ] || argv . l ) {
3435 self . versions ( self ) ;
35- } else if ( argv [ 'deploy' ] || argv . d ) {
36+ } else {
3637 if ( ! self . inputValues [ 'uuid' ] ) {
37- // Deploying a new version
38- var upload = new IonicUploadTask ( ) ;
3938
40- upload . setNote ( self . inputValues [ 'note' ] || '' ) ;
41- upload . run ( self . ionic , function ( ) {
42- self . deploy ( self ) ;
39+ var schema = [ {
40+ name : 'confirm' ,
41+ description : 'Deploy the current working copy? (yes/no)' . yellow ,
42+ required : true
43+ } ] ;
44+
45+ prompt . override = argv ;
46+ prompt . message = '' ;
47+ prompt . delimiter = '' ;
48+ prompt . start ( ) ;
49+
50+ prompt . get ( schema , function ( err , result ) {
51+ if ( err ) {
52+ return ionic . fail ( 'Error logging in: ' + err ) ;
53+ }
54+
55+ if ( result . confirm == 'yes' || result . confirm == 'y' ) {
56+ // Deploying a new version
57+ var upload = new IonicUploadTask ( ) ;
58+
59+ upload . setNote ( self . inputValues [ 'note' ] || '' ) ;
60+ upload . run ( self . ionic , function ( ) {
61+ self . deploy ( self ) ;
62+ } ) ;
63+ }
4364 } ) ;
4465 } else {
4566 self . deploy ( self ) ;
@@ -163,7 +184,12 @@ IonicTask.prototype.getCmdLineOptions = function() {
163184 }
164185
165186 getCmdArgValue ( 'note' , 'n' ) ;
166- getCmdArgValue ( 'uuid' , 'u' ) ;
187+
188+ var uuid = argv . _ [ 1 ] ;
189+
190+ if ( typeof uuid !== 'undefined' && uuid ) {
191+ self . inputValues [ 'uuid' ] = uuid ;
192+ }
167193} ;
168194
169195IonicTask . prototype . getCsrfToken = function ( jar ) {
0 commit comments