forked from charmbracelet/bubbles
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add set-window-title command (charmbracelet#611)
Set the terminal window title using termenv. Fixes: charmbracelet/bubbletea#610
- Loading branch information
1 parent
bc1c475
commit 2bcb0af
Showing
5 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package main | ||
|
||
// A simple example illustrating how to set a window title. | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
tea "github.com/charmbracelet/bubbletea" | ||
) | ||
|
||
type model struct{} | ||
|
||
func (m model) Init() tea.Cmd { | ||
return tea.SetWindowTitle("Bubble Tea Example") | ||
} | ||
|
||
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | ||
switch msg.(type) { | ||
case tea.KeyMsg: | ||
return m, tea.Quit | ||
} | ||
return m, nil | ||
} | ||
|
||
func (m model) View() string { | ||
return "\nPress any key to quit." | ||
} | ||
|
||
func main() { | ||
if _, err := tea.NewProgram(model{}).Run(); err != nil { | ||
fmt.Println("Uh oh:", err) | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters