Skip to content

Commit

Permalink
Include clone urls in default README
Browse files Browse the repository at this point in the history
  • Loading branch information
Toby Padilla committed Aug 12, 2021
1 parent eb1b2cb commit 912de2f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
14 changes: 8 additions & 6 deletions tui/bubble.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion tui/bubbles/repo/bubble.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions tui/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}`
Expand Down

0 comments on commit 912de2f

Please sign in to comment.