Skip to content

Commit

Permalink
feat: it's alive
Browse files Browse the repository at this point in the history
  • Loading branch information
cfoust committed Nov 2, 2023
1 parent 5bf9ca8 commit 113c2a3
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 11 deletions.
9 changes: 4 additions & 5 deletions ci/goreleaser-for-darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ builds:
binary: cy
ldflags:
- -w -s
- -X github.com/bytebase/bytebase/backend/bin/server/cmd.version={{.Version}}
- -X github.com/bytebase/bytebase/backend/bin/server/cmd.goversion=${GO_VERSION}
- -X github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit={{.Commit}}
- -X github.com/bytebase/bytebase/backend/bin/server/cmd.buildtime={{.Timestamp}}
- -X github.com/bytebase/bytebase/backend/bin/server/cmd.builduser=goreleaser
- -X github.com/cfoust/cy/info.Version={{.Version}}
- -X github.com/cfoust/cy/info.GoVersion=${GO_VERSION}
- -X github.com/cfoust/cy/info.GitCommit={{.Commit}}
- -X github.com/cfoust/cy/info.BuildTime={{.Timestamp}}
tags:
- release
- embed_frontend
Expand Down
10 changes: 5 additions & 5 deletions ci/goreleaser-for-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ builds:
binary: cy
ldflags:
- -w -s
- -X github.com/cfoust/cy/backend/bin/server/cmd.version={{.Version}}
- -X github.com/cfoust/cy/backend/bin/server/cmd.goversion=${GO_VERSION}
- -X github.com/cfoust/cy/backend/bin/server/cmd.gitcommit={{.Commit}}
- -X github.com/cfoust/cy/backend/bin/server/cmd.buildtime={{.Timestamp}}
- -X github.com/cfoust/cy/backend/bin/server/cmd.builduser=goreleaser
- -X github.com/cfoust/cy/info.version={{.Version}}
- -X github.com/cfoust/cy/info.goversion=${GO_VERSION}
- -X github.com/cfoust/cy/info.gitcommit={{.Commit}}
- -X github.com/cfoust/cy/info.buildtime={{.Timestamp}}
- -X github.com/cfoust/cy/info.builduser=goreleaser
tags:
- release
- embed_frontend
Expand Down
2 changes: 1 addition & 1 deletion pkg/mux/screen/splash/background.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func generateBackground(render *taro.Renderer, size geom.Size) image.Image {

r := rand.New(rand.NewSource(time.Now().UnixNano()))

for i := 0; i < 10+r.Intn(25); i++ {
for i := 0; i < 20+r.Intn(25); i++ {
style := render.
NewStyle().
Foreground(lipgloss.Color(
Expand Down
47 changes: 47 additions & 0 deletions pkg/mux/screen/splash/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ package splash

import (
"context"
"fmt"

"github.com/cfoust/cy/pkg/anim"
"github.com/cfoust/cy/pkg/geom"
"github.com/cfoust/cy/pkg/geom/image"
"github.com/cfoust/cy/pkg/geom/tty"
"github.com/cfoust/cy/pkg/taro"
"github.com/cfoust/cy/pkg/util"
"github.com/cfoust/cy/pkg/version"

tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
)

type Splash struct {
Expand Down Expand Up @@ -48,6 +51,50 @@ func (s *Splash) View(state *tty.State) {
state.Image,
bg,
)

boxContents := lipgloss.JoinVertical(
lipgloss.Center,
lipgloss.NewStyle().
Width(50).
Align(lipgloss.Center).
Render("CY - Cy IMProved"),
"",
fmt.Sprintf("version %s", version.Version),
"",
"by Caleb Foust",
"cy is open source and freely distributable",
)

boxStyle := s.render.NewStyle().
Border(lipgloss.RoundedBorder()).
BorderForeground(lipgloss.Color("#874BFD")).
BorderTop(true).
BorderLeft(true).
BorderRight(true).
BorderBottom(true)

boxText := boxStyle.Render(boxContents)
boxSize := geom.Vec2{
R: lipgloss.Height(boxText),
C: lipgloss.Width(boxText),
}

box := image.New(boxSize)
s.render.RenderAt(
box,
0,
0,
boxText,
)

image.Copy(
geom.Vec2{
R: (size.R / 2) - (boxSize.R / 2),
C: (size.C / 2) - (boxSize.C / 2),
},
state.Image,
box,
)
}

func New(ctx context.Context, size geom.Size) *taro.Program {
Expand Down
9 changes: 9 additions & 0 deletions pkg/version/module.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package version

// These should be set via go build -ldflags -X 'xxxx'.
var (
Version = "development"
GoVersion = "1.19"
GitCommit = "unknown"
BuildTime = "unknown"
)

0 comments on commit 113c2a3

Please sign in to comment.