Include clone urls in default README

Toby Padilla created

Change summary

tui/bubble.go              | 14 ++++++++------
tui/bubbles/repo/bubble.go |  8 +++++++-
tui/defaults.go            |  6 ++++--
3 files changed, 19 insertions(+), 9 deletions(-)

Detailed changes

tui/bubble.go 🔗

@@ -24,19 +24,21 @@ const (
 	quitState
 )
 
-type MenuEntry struct {
-	Name string `json:"name"`
-	Note string `json:"note"`
-	Repo string `json:"repo"`
-}
-
 type Config struct {
 	Name         string      `json:"name"`
+	Host         string      `json:"host"`
+	Port         int64       `json:"port"`
 	ShowAllRepos bool        `json:"show_all_repos"`
 	Menu         []MenuEntry `json:"menu"`
 	RepoSource   *git.RepoSource
 }
 
+type MenuEntry struct {
+	Name string `json:"name"`
+	Note string `json:"note"`
+	Repo string `json:"repo"`
+}
+
 type SessionConfig struct {
 	Width         int
 	Height        int

tui/bubbles/repo/bubble.go 🔗

@@ -41,7 +41,13 @@ func (b *Bubble) Init() tea.Cmd {
 }
 
 func (b *Bubble) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
-	return b.readmeViewport.Update(msg)
+	var cmds []tea.Cmd
+	rv, cmd := b.readmeViewport.Update(msg)
+	b.readmeViewport = rv.(*ViewportBubble)
+	if cmd != nil {
+		cmds = append(cmds, cmd)
+	}
+	return b, tea.Batch(cmds...)
 }
 
 func (b *Bubble) View() string {

tui/defaults.go 🔗

@@ -9,16 +9,18 @@ import (
 	"github.com/go-git/go-git/v5/plumbing/object"
 )
 
-const defaultReadme = "# Smoothie\nWelcome to Smoothie. To setup your own configuration, please clone this repo."
+const defaultReadme = "# Smoothie\n\n Welcome! You can configure your Smoothie server by cloning this repo and pushing changes.\n\n## Repos\n\n{{ range .Menu }}* {{ .Name }}{{ if .Note }} - {{ .Note }} {{ end }}\n  - `git clone ssh://{{$.Host}}:{{$.Port}}/{{.Repo}}`\n{{ end }}"
 
 const defaultConfig = `{
 	"name": "Smoothie",
 	"show_all_repos": true,
+	"host": "localhost",
+	"port": 23231,
 	"menu": [
 	  {
 			"name": "Home",
 			"repo": "config",
-			"note": "Configuration and content repo"
+			"note": "Configuration and content repo for this server"
 		}
 	]
 }`