55 "io/ioutil"
66 "os"
77 "path"
8+ "strings"
89 "time"
910
1011 "github.com/mitchellh/go-wordwrap"
2223 isShowingSaved = false
2324)
2425
25- func showInteractiveResults (supportBundleName string , analyzeResults []* analyzerunner.AnalyzeResult ) error {
26+ func showInteractiveResults (supportBundleName string , analyzeResults []* analyzerunner.AnalyzeResult , archivePath string ) error {
2627 if err := ui .Init (); err != nil {
2728 return errors .Wrap (err , "failed to create terminal ui" )
2829 }
@@ -49,7 +50,7 @@ func showInteractiveResults(supportBundleName string, analyzeResults []*analyzer
4950 if err != nil {
5051 // show
5152 } else {
52- showSaved (filename )
53+ showSaved (filename , archivePath )
5354 go func () {
5455 time .Sleep (time .Second * 5 )
5556 isShowingSaved = false
@@ -214,18 +215,36 @@ func drawDetails(analysisResult *analyzerunner.AnalyzeResult) {
214215 ui .Render (message )
215216}
216217
217- func showSaved (filename string ) {
218+ func showSaved (filename string , archivePath string ) {
218219 termWidth , termHeight := ui .TerminalDimensions ()
219220
221+ f := `A support bundle was generated and saved at %s.
222+ Please send this file to your software vendor for support.`
223+ additionalMessageText := fmt .Sprintf (f , archivePath )
224+
220225 savedMessage := widgets .NewParagraph ()
221- savedMessage .Text = fmt .Sprintf ("Support Bundle analysis results saved to\n \n %s" , filename )
226+ savedMessage .Text = fmt .Sprintf ("Support Bundle analysis results saved to\n \n %s\n \n %s " , filename , additionalMessageText )
222227 savedMessage .WrapText = true
223228 savedMessage .Border = true
224229
225- left := termWidth / 2 - 20
226- right := termWidth / 2 + 20
227- top := termHeight / 2 - 4
228- bottom := termHeight / 2 + 4
230+ // Split the text into lines and find the longest line
231+ lines := strings .Split (savedMessage .Text , "\n " )
232+ maxLineLength := 0
233+ for _ , line := range lines {
234+ if len (line ) > maxLineLength {
235+ // maxLineLength is set to half of the line length to prevent the showing text with more space than needed
236+ maxLineLength = len (line )/ 2 + constants .MESSAGE_TEXT_PADDING
237+ }
238+ }
239+
240+ if maxLineLength > termWidth / 2 {
241+ maxLineLength = termWidth / 2
242+ }
243+
244+ left := termWidth / 2 - maxLineLength
245+ right := termWidth / 2 + maxLineLength
246+ top := termHeight / 2 - len (lines )
247+ bottom := termHeight / 2 + len (lines )
229248
230249 savedMessage .SetRect (left , top , right , bottom )
231250 ui .Render (savedMessage )
0 commit comments