Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Oct 25, 2023
1 parent 92aed82 commit 1aeaf57
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"github.com/Selyss/chtsht/pkg/chtsht"
"github.com/akamensky/argparse"
// tea "github.com/charmbracelet/bubbletea"
"log"
"os"
)
Expand Down Expand Up @@ -87,7 +88,6 @@ func main() {
fmt.Print("Query: ")
var query string
fmt.Scanln(&query)

url := fmt.Sprintf("cht.sh/%s/%s", selection, query)
chtsht.DisplayOutput(url)
return
Expand Down
1 change: 0 additions & 1 deletion pkg/chtsht/commands.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package chtsht

import (
tea "github.com/charmbracelet/bubbletea"
"log"
"os"
"os/exec"
Expand Down
18 changes: 5 additions & 13 deletions pkg/chtsht/spinner.go
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
package chtsht

// A simple program demonstrating the spinner component from the Bubbles

// component library.

import (
"fmt"

"github.com/charmbracelet/bubbles/spinner"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"log"
)

type errMsg error

type model struct {
spinner spinner.Model
spinner spinner.Model

quitting bool
err error
}

func initialModel() model {
func InitialModel() model {
s := spinner.New()
s.Spinner = spinner.Dot
s.Style = lipgloss.NewStyle().Foreground(lipgloss.Color("205"))
Expand All @@ -42,9 +44,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}

case errMsg:

m.err = msg

return m, nil

default:
Expand All @@ -61,14 +61,6 @@ func (m model) View() string {
str := fmt.Sprintf("\n\n %s Loading queries...press q to quit\n\n", m.spinner.View())
if m.quitting {
return str + "\n"

}
return str
}

func main() {
p := tea.NewProgram(initialModel())
if _, err := p.Run(); err != nil {
log.Fatal(err)
}
}

0 comments on commit 1aeaf57

Please sign in to comment.