Skip to content

Commit b18c035

Browse files
committed
fix: exit when get release failed
1 parent c98b896 commit b18c035

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

cmd/ghdl.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ gh-dl handles archived or compressed file as well`,
3131
ghRelease := ghdl.GHRelease{RepoPath: repo, TagName: tag}
3232
ghReleaseDl, err := ghRelease.GetGHReleases()
3333
if err != nil {
34-
h.Print(fmt.Sprintf("get gh releases failed: %s\n", err), h.PrintModeErr)
34+
h.Print(fmt.Sprintf("get gh releases failed: %s", err), h.PrintModeErr)
35+
os.Exit(1)
3536
}
3637

3738
if binaryNameFlag != "" {

helper/sl/sl.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (m model) View() string {
5757
colorS := paddingS.Copy().
5858
Foreground(blue).BorderLeft(true).BorderForeground(blue)
5959
if m.selected == -1 {
60-
s := paddingS.Copy().Foreground(yellow).Render("gh-dl can't figure out which release to download\nplease select it manully") + "\n"
60+
s := "\n" + paddingS.Copy().Foreground(yellow).Render("gh-dl can't figure out which release to download\nplease select it manully") + "\n\n"
6161
for i, choice := range m.choices {
6262
if m.cursor == i {
6363
s += colorS.Render(choice) + "\n"
@@ -68,7 +68,7 @@ func (m model) View() string {
6868
// Send the UI for rendering
6969
return s + "\n"
7070
} else {
71-
s := paddingS.Copy().Foreground(yellow).Render(fmt.Sprintf("start downloading %s", lipgloss.NewStyle().Foreground(blue).Render(m.choices[m.selected]))) + "\n"
71+
s := "\n" + paddingS.Copy().Foreground(yellow).Render(fmt.Sprintf("start downloading %s", lipgloss.NewStyle().Foreground(blue).Render(m.choices[m.selected]))) + "\n"
7272
return s
7373
}
7474
}

0 commit comments

Comments
 (0)