def complete_region(self, commands): # we only care about top command cmd = commands[-1] if cmd == '-r' or cmd == '--region': io.echo(*[r.name for r in region.get_all_regions()]) return True return False
def get_region(region_argument, interactive, force_non_interactive=False): # Get region from command line arguments region = get_region_from_inputs(region_argument) # Ask for region if (not region) and force_non_interactive: # Choose defaults region_list = regions.get_all_regions() region = region_list[2].name if not region or (interactive and not region_argument): io.echo() io.echo('Select a default region') region_list = regions.get_all_regions() result = utils.prompt_for_item_in_list(region_list, default=3) region = result.name return region
def get_region(self): # Get region from command line arguments region = self.get_region_from_inputs() # Ask for region if (not region) and self.force_non_interactive: # Choose defaults region_list = regions.get_all_regions() region = region_list[2].name if not region or \ (self.interactive and not self.app.pargs.region): io.echo() io.echo('Select a default region') region_list = regions.get_all_regions() result = utils.prompt_for_item_in_list(region_list, default=3) region = result.name return region