Revision bd40efdf kamaki/cli/commands/cyclades_cli.py

b/kamaki/cli/commands/cyclades_cli.py
37 37
from kamaki.cli.errors import raiseCLIError, CLISyntaxError
38 38
from kamaki.clients.cyclades import CycladesClient, ClientError
39 39
from kamaki.cli.argument import FlagArgument, ValueArgument, KeyValueArgument
40
from kamaki.cli.argument import ProgressBarArgument, DateArgument
40
from kamaki.cli.argument import ProgressBarArgument, DateArgument, IntArgument
41 41
from kamaki.cli.commands import _command_init
42 42

  
43 43
from base64 import b64encode
......
609 609

  
610 610
@command(flavor_cmds)
611 611
class flavor_list(_init_cyclades):
612
    """List flavors"""
612
    """List available hardware flavors"""
613 613

  
614 614
    arguments = dict(
615
        detail=FlagArgument('show detailed output', '-l')
615
        detail=FlagArgument('show detailed output', '-l'),
616
        limit=IntArgument('limit the number of flavors to list', '-n'),
617
        more=FlagArgument(
618
            'output results in pages (-n to set items per page, defaul is 10)',
619
            '--more')
616 620
    )
617 621

  
618 622
    def main(self):
......
621 625
            flavors = self.client.list_flavors(self['detail'])
622 626
        except Exception as err:
623 627
            raiseCLIError(err)
624
        print_items(flavors, with_redundancy=self['detail'])
628
        if self['more']:
629
            print_items(
630
                flavors,
631
                with_redundancy=self['detail'],
632
                page_size=self['limit'] if self['limit'] else 10)
633
        else:
634
            print_items(
635
                flavors,
636
                with_redundancy=self['detail'],
637
                page_size=self['limit'])
625 638

  
626 639

  
627 640
@command(flavor_cmds)

Also available in: Unified diff