Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
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
Exemplo n.º 5
0
    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