Skip to content
Myr

Update wording in simple example

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christian Rocha · committed by Christian Rocha · parent dc3e244 · Browse files · 1 file+6 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−7 removed

  • other:+6 added−7 removed

1 file+6 added−7 removed

modified:examples/simple/main.go+6 added-7 removed
30 unmodified lines
31// program, so often it's a struct. For this simple example, however, all32// we'll need is a simple integer.33type model int3435// Init optionally return an initial command we should run. In this case we35// Init optionally returns an initial command we should run. In this case we36// want to start the timer.37func (m model) Init() tea.Cmd {38 return tick39}4041// Update is called when messages are recived. The idea is that you inspect42// the message and update the model (or send back a new one) accordingly. You43// can also return a commmand, which is a function that peforms I/O and44// returns a message.41// Update is called when messages are recived. The idea is that you inspect the42// message and send back an updated model accordingly. You can also return43// a commmand, which is a function that peforms I/O and returns a message.44func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {45 switch msg.(type) {46 case tea.KeyMsg:47 return m, tea.Quit
6 unmodified lines
54 }55 return m, nil56}5759// Views take data from the model and return a string which will be rendered60// to the terminal.58// Views return a string based on data in the model. That string which will be59// rendered to the terminal.60func (m model) View() string {61 return fmt.Sprintf("Hi. This program will exit in %d seconds. To quit sooner press any key.\n", m)62}63
8 unmodified lines