@@ -35,7 +35,7 @@ def format_output(data, fmt='table'): # pylint: disable=R0911,R0912
3535
3636 # responds to .prettytable()
3737 if hasattr (data , 'prettytable' ) and fmt in ('table' , 'raw' ):
38- return format_prettytable (data )
38+ return format_prettytable (data , fmt )
3939
4040 # responds to .to_python()
4141 if hasattr (data , 'to_python' ):
@@ -68,12 +68,12 @@ def format_output(data, fmt='table'): # pylint: disable=R0911,R0912
6868 return str (data )
6969
7070
71- def format_prettytable (table ):
71+ def format_prettytable (table , fmt = 'table' ):
7272 """Converts SoftLayer.CLI.formatting.Table instance to a prettytable."""
7373 for i , row in enumerate (table .rows ):
7474 for j , item in enumerate (row ):
7575 table .rows [i ][j ] = format_output (item )
76- ptable = table .prettytable ()
76+ ptable = table .prettytable (fmt )
7777 return ptable
7878
7979
@@ -208,7 +208,6 @@ def to_python(self):
208208 return self
209209
210210 def __str__ (self ):
211- print ("CASTSDFSDFSDFSDFSDF" )
212211 return self .separator .join (str (x ) for x in self )
213212
214213
@@ -258,9 +257,12 @@ def to_python(self):
258257 items .append (dict (zip (self .columns , formatted_row )))
259258 return items
260259
261- def prettytable (self ):
260+ def prettytable (self , fmt = 'table' ):
262261 """Returns a RICH table instance."""
263- table = rTable (title = self .title , box = box .SQUARE , header_style = "bright_cyan" )
262+ box_style = box .SQUARE
263+ if fmt == 'raw' :
264+ box_style = None
265+ table = rTable (title = self .title , box = box_style , header_style = "bright_cyan" )
264266 if self .sortby :
265267 try :
266268 # https://docs.python.org/3/howto/sorting.html#key-functions
0 commit comments