File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -65,19 +65,20 @@ def first_time_use(ctx):
6565
6666def list_commands (ctx ):
6767 table_data = [['Command' , 'Description' , 'Alias' ]]
68- commands = read_commands ( )
68+ no_of_columns = len ( table_data [ 0 ] )
6969
70+ commands = read_commands ()
7071 for cmd , fields in commands .items ():
7172 table_data .append (['$ ' + cmd , fields ['desc' ], fields ['alias' ]])
7273
7374 table = AsciiTable (table_data )
74- max_widths = [ table .column_max_width ( 0 ), table . column_max_width ( 1 )]
75+ max_width = table .table_width // 3
7576
7677 for i in range (len (table_data ) - 1 ):
77- for j in [ 0 , 1 ] :
78+ for j in range ( no_of_columns ) :
7879 data = table .table_data [i + 1 ][j ]
79- if len (data ) > max_widths [ j ] :
80- table .table_data [i + 1 ][j ] = '\n ' .join (wrap (data , max_widths [ j ] ))
80+ if len (data ) > max_width :
81+ table .table_data [i + 1 ][j ] = '\n ' .join (wrap (data , max_width ))
8182
8283 table .inner_row_border = True
8384 print (table .table )
You can’t perform that action at this time.
0 commit comments