empty.go

 1package repo
 2
 3import (
 4	"fmt"
 5	"strings"
 6
 7	"github.com/charmbracelet/soft-serve/server/config"
 8)
 9
10func defaultEmptyRepoMsg(cfg *config.Config, repo string) string {
11	host := cfg.Host
12	if cfg.SSH.Port != 22 {
13		host = fmt.Sprintf("%s:%d", host, cfg.SSH.Port)
14	}
15	repo = strings.TrimSuffix(repo, ".git")
16	return fmt.Sprintf(`# Quick Start
17
18Get started by cloning this repository, add your files, commit, and push.
19
20## Clone this repository.
21
22`+"```"+`sh
23git clone ssh://%[1]s/%[2]s.git
24`+"```"+`
25
26## Creating a new repository on the command line
27
28`+"```"+`sh
29touch README.md
30git init
31git add README.md
32git branch -M main
33git commit -m "first commit"
34git remote add origin ssh://%[1]s/%[2]s.git
35git push -u origin main
36`+"```"+`
37
38## Pushing an existing repository from the command line
39
40`+"```"+`sh
41git remote add origin ssh://%[1]s/%[2]s.git
42git push -u origin main
43`+"```"+`
44`, host, repo)
45}