🐛 Fail gracefully when none found
This commit is contained in:
		
					parent
					
						
							
								5881f3d538
							
						
					
				
			
			
				commit
				
					
						7a198a0273
					
				
			
		
					 7 changed files with 37 additions and 8 deletions
				
			
		
							
								
								
									
										20
									
								
								io/message/message.go
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								io/message/message.go
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| package message | ||||
| 
 | ||||
| import "github.com/rivo/tview" | ||||
| 
 | ||||
| func Message(text string) { | ||||
| 	app := tview.NewApplication() | ||||
| 	modal := tview.NewModal() | ||||
| 	if text != "" { | ||||
| 		modal.SetText(text) | ||||
| 	} | ||||
| 
 | ||||
| 	modal.AddButtons([]string{"Ok"}). | ||||
| 		SetDoneFunc(func(buttonIndex int, buttonLabel string) { | ||||
| 			app.Stop() | ||||
| 		}) | ||||
| 
 | ||||
| 	if err := app.SetRoot(modal, false).EnableMouse(true).Run(); err != nil { | ||||
| 		panic(err) | ||||
| 	} | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue