made region select more robust

This commit is contained in:
Eslam A. Hefnawy 2015-12-18 13:25:01 +02:00
parent 860ce56889
commit acfefd08cf
9 changed files with 10 additions and 10 deletions

View File

@ -263,7 +263,7 @@ class ServerlessPlugin {
* CLI: Prompt Select Region
*/
cliPromptSelectRegion(message, addAllRegions, region, stage) {
cliPromptSelectRegion(message, addAllRegions, existing, region, stage) {
let _this = this;
@ -288,7 +288,7 @@ class ServerlessPlugin {
return BbPromise.reject(new SError('Stage ' + stage + ' does not exist in your project', SError.errorCodes.UNKNOWN));
}
if (addAllRegions) {
if (existing) {
// list only regions in stage
regionChoices = [];

View File

@ -134,7 +134,7 @@ module.exports = function(SPlugin, serverlessPath) {
})
})
.then(function() {
return _this.cliPromptSelectRegion('Choose a Region in this Stage: ', true, _this.evt.region, _this.evt.stage)
return _this.cliPromptSelectRegion('Choose a Region in this Stage: ', false, true, _this.evt.region, _this.evt.stage)
.then(region => {
_this.evt.region = region;
})

View File

@ -130,7 +130,7 @@ module.exports = function(SPlugin, serverlessPath) {
})
})
.then(function(){
return _this.cliPromptSelectRegion('Select a region to get env var from: ', true, _this.evt.region, _this.evt.stage)
return _this.cliPromptSelectRegion('Select a region to get env var from: ', true, true, _this.evt.region, _this.evt.stage)
.then(region => {
_this.evt.region = region;
BbPromise.resolve();

View File

@ -116,7 +116,7 @@ module.exports = function(SPlugin, serverlessPath) {
BbPromise.resolve();
})
.then(function(){
return _this.cliPromptSelectRegion('Select a region to list env vars from: ', true, _this.evt.region, _this.evt.stage)
return _this.cliPromptSelectRegion('Select a region to list env vars from: ', true, true, _this.evt.region, _this.evt.stage)
.then(region => {
_this.evt.region = region;
BbPromise.resolve();

View File

@ -143,7 +143,7 @@ module.exports = function(SPlugin, serverlessPath) {
})
})
.then(function(){
return _this.cliPromptSelectRegion('Select a region to set env var in: ', true, _this.evt.region, _this.evt.stage)
return _this.cliPromptSelectRegion('Select a region to set env var in: ', true, true, _this.evt.region, _this.evt.stage)
.then(region => {
_this.evt.region = region;
BbPromise.resolve();

View File

@ -130,7 +130,7 @@ module.exports = function(SPlugin, serverlessPath) {
})
})
.then(function(){
return _this.cliPromptSelectRegion('Select a region to unset env var from: ', true, _this.evt.region, _this.evt.stage)
return _this.cliPromptSelectRegion('Select a region to unset env var from: ', true, true, _this.evt.region, _this.evt.stage)
.then(region => {
_this.evt.region = region;
BbPromise.resolve();

View File

@ -126,7 +126,7 @@ module.exports = function(SPlugin, serverlessPath) {
BbPromise.resolve();
})
.then(function(){
return _this.cliPromptSelectRegion('Select a new region for your existing stage: ', false, _this.evt.region, _this.evt.stage)
return _this.cliPromptSelectRegion('Select a new region for your existing stage: ', false, false, _this.evt.region, _this.evt.stage)
.then(region => {
_this.evt.region = region;
BbPromise.resolve();

View File

@ -113,7 +113,7 @@ module.exports = function(SPlugin, serverlessPath) {
BbPromise.resolve();
})
.then(function(){
return _this.cliPromptSelectRegion('Which region are you deploying to: ', false, _this.evt.region, false)
return _this.cliPromptSelectRegion('Which region are you deploying to: ', false, true, _this.evt.region, _this.evt.stage)
.then(region => {
_this.evt.region = region;
BbPromise.resolve();

View File

@ -143,7 +143,7 @@ module.exports = function(SPlugin, serverlessPath) {
BbPromise.resolve();
})
.then(function(){
return _this.cliPromptSelectRegion('Select a region for your new stage: ', false, _this.evt.region, false)
return _this.cliPromptSelectRegion('Select a region for your new stage: ', false, false, _this.evt.region, false)
.then(region => {
_this.evt.region = region;
BbPromise.resolve();