(self)
The run method for the command.
The run method for the command.
The run method for the command .
def run(self):
        """The run method for the command."""
        sketches = Sketch.query.all()

        name_len = max([len(x.name) for x in sketches])
        desc_len = max([len(x.description) for x in sketches])

        if not name_len:
            name_len = 5
        if not desc_len:
            desc_len = 10

        fmt_string = '{{0:^3d}} | {{1:{0:d}s}} | {{2:{1:d}s}}'.format(
            name_len, desc_len)

        print('+-'*40)
        print(' ID | Name {0:s} | Description'.format(' '*(name_len-5)))
        print('+-'*40)
        for sketch in sketches:
            status = sketch.get_status.status
            if status == 'deleted':
                continue

            if status == 'archived':
                name = '{0:s} (archived)'.format(sketch.name)
            else:
                name = sketch.name

            print(fmt_string.format(
                sketch.id, name, sketch.description))
            print('-'*80)
def run ( self ) : sketches = Sketch . query . all ( ) name_len = max ( [ len ( x . name ) for x in sketches ] ) desc_len = max ( [ len ( x . description ) for x in sketches ] ) if not name_len : name_len = 5 if not desc_len : desc_len = 10 fmt_string = '{{0:^3d}} | {{1:{0:d}s}} | {{2:{1:d}s}}' . format ( name_len , desc_len ) print ( '+-' * 40 ) print ( ' ID | Name {0:s} | Description' . format ( ' ' * ( name_len - 5 ) ) ) print ( '+-' * 40 ) for sketch in sketches : status = sketch . get_status . status if status == 'deleted' : continue if status == 'archived' : name = '{0:s} (archived)' . format ( sketch . name ) else : name = sketch . name print ( fmt_string . format ( sketch . id , name , sketch . description ) ) print ( '-' * 80 )