github.com/wtfutil/wtf@v0.43.0/modules/airbrake/result_table.go (about)

     1  package airbrake
     2  
     3  import (
     4  	"github.com/wtfutil/wtf/utils"
     5  	"github.com/wtfutil/wtf/view"
     6  )
     7  
     8  type resultTable struct {
     9  	propertyMap map[string]string
    10  
    11  	colWidth0   int
    12  	colWidth1   int
    13  	tableHeight int
    14  }
    15  
    16  func newResultTable(result, message string) *resultTable {
    17  	propTable := &resultTable{
    18  		colWidth0:   20,
    19  		colWidth1:   51,
    20  		tableHeight: 15,
    21  	}
    22  	propTable.propertyMap = map[string]string{result: message}
    23  
    24  	return propTable
    25  }
    26  
    27  func (propTable *resultTable) render() string {
    28  	tbl := view.NewInfoTable(
    29  		[]string{"Result", "Message"},
    30  		propTable.propertyMap,
    31  		propTable.colWidth0,
    32  		propTable.colWidth1,
    33  		propTable.tableHeight,
    34  	)
    35  
    36  	return tbl.Render() + utils.CenterText("Esc to close", 80)
    37  }