Skip to content
Myr

Fix typos and wording in the command tutorial

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 213f179 · Browse files · 1 file+14 added−14 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+14 added−14 removed

  • other:+14 added−14 removed

1 file+14 added−14 removed

modified:tutorials/commands/README.md+14 added-14 removed
11 unmodified lines
1213## Let's Go!1415For this tutorial we're building a very simple program that makes an HTTP16request to a server over HTTP and reports the status code of the response.16request to a server and reports the status code of the response.1718We'll import a few necessary packages and put the URL we're going to check in19a `const`.20
13 unmodified lines
34```3536## The Model3738Next we'll define our model. The only things we need to store are the HTTP39response and a possible error.38Next we'll define our model. The only things we need to store are the status39code of HTTP response and a possible error.4041```go42 type model struct {43 status int
31 unmodified lines
75 type statusMsg int76 type errMsg error77```7879And notice that we've defined two new `Msg` types. They can be any type, even a80struct. We'll come back to them later later in our update function.79And notice that we've defined two new `Msg` types. They can be any type, even80an empty struct. We'll come back to them later later in our update function.81First, let's write our initialization function.8283## The Initialization Function8485The initilization function is incredibly simple. We return an empty model and86fire off the `Cmd` we made earlier.85The initilization function is very simple. We return an empty model and the86the `Cmd` we made earlier. Note that we don't call the function; the Bubble Tea87runtime will do that when the time is right.8889```go90 func initialize() (tea.Model, tea.Cmd) {91 return model{}, checkServer
25 unmodified lines
117 return m, tea.Quit118119 case tea.KeyMsg:120 // Ctrl+c quits. Even with short running programs it's good to have120 // an quit key, just incase your logic is off. Users will be very121 // a quit key, just incase your logic is off. Users will be very122 // annoyed if they can't exit.123 if msg.Type == tea.KeyCtrlC {124 return m, tea.Quit125 }
43 unmodified lines
169 }170 }171```172172And that's that! There's one more thing you should is helpful to know about173And that's that. There's one more thing you should is helpful to know about174`Cmd`s, though.175176## One More Thing About Commands177
21 unmodified lines
199that's the one that runs asynchronously.200201## Anyway, Now What?202202After doing this tutorial and [the previous one][basics] you should be ready203to build a Bubble Tea program of your own.203After doing this tutorial and [the previous one][basics] you should be ready to204build a Bubble Tea program of your own. We also recommend that you look at the205Bubble Tea [example programs][examples] as well as [Bubbles][bubbles],206a component library for Bubble Tea.207205We also recommend that you look at the Bubble Tea [example programs][examples]206as well as [Bubbles][bubbles], a component library for Bubble Tea.207208And, of course, check out the [Go Docs][docs].209210### Bubble Tea in the Wild211
27 unmodified lines