fizzy-cli 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yml +29 -0
- package/.github/workflows/tests.yml +24 -0
- package/AGENTS.md +33 -0
- package/CHANGELOG.md +63 -0
- package/Makefile +20 -9
- package/README.md +88 -1
- package/bin/fizzy +0 -0
- package/bin/fizzy-darwin-amd64 +0 -0
- package/bin/fizzy-darwin-arm64 +0 -0
- package/bin/fizzy-linux-amd64 +0 -0
- package/bin/fizzy-linux-arm64 +0 -0
- package/bin/fizzy-windows-amd64.exe +0 -0
- package/cmd/account.go +14 -0
- package/cmd/account_list.go +44 -0
- package/cmd/account_list_test.go +118 -0
- package/cmd/board.go +38 -12
- package/cmd/board_create.go +60 -0
- package/cmd/board_create_test.go +158 -0
- package/cmd/board_list.go +18 -32
- package/cmd/board_list_test.go +115 -0
- package/cmd/board_test.go +92 -0
- package/cmd/card.go +24 -0
- package/cmd/card_close.go +46 -0
- package/cmd/card_close_test.go +92 -0
- package/cmd/card_create.go +73 -0
- package/cmd/card_create_test.go +206 -0
- package/cmd/card_delete.go +46 -0
- package/cmd/card_delete_test.go +92 -0
- package/cmd/card_list.go +53 -0
- package/cmd/card_list_test.go +148 -0
- package/cmd/card_reopen.go +46 -0
- package/cmd/card_reopen_test.go +92 -0
- package/cmd/card_show.go +46 -0
- package/cmd/card_show_test.go +92 -0
- package/cmd/card_update.go +74 -0
- package/cmd/card_update_test.go +147 -0
- package/cmd/column.go +14 -0
- package/cmd/column_create.go +80 -0
- package/cmd/column_create_test.go +196 -0
- package/cmd/column_list.go +44 -0
- package/cmd/column_list_test.go +138 -0
- package/cmd/login.go +61 -4
- package/cmd/login_test.go +98 -0
- package/cmd/root.go +15 -4
- package/cmd/use.go +85 -0
- package/cmd/use_test.go +186 -0
- package/docs/API.md +1168 -0
- package/go.mod +23 -2
- package/go.sum +43 -0
- package/internal/api/client.go +463 -0
- package/internal/app/app.go +49 -0
- package/internal/colors/colors.go +32 -0
- package/internal/config/config.go +69 -0
- package/internal/testutil/client.go +26 -0
- package/internal/ui/account_list.go +14 -0
- package/internal/ui/account_selector.go +63 -0
- package/internal/ui/board_list.go +14 -0
- package/internal/ui/card_list.go +14 -0
- package/internal/ui/card_show.go +23 -0
- package/internal/ui/column_list.go +28 -0
- package/internal/ui/format.go +14 -0
- package/main.go +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Package testutil
|
|
2
|
+
package testutil
|
|
3
|
+
|
|
4
|
+
import (
|
|
5
|
+
"net/http"
|
|
6
|
+
"time"
|
|
7
|
+
|
|
8
|
+
"github.com/rogeriopvl/fizzy/internal/api"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
func NewTestClient(baseURL, accountSlug, boardID, accessToken string) *api.Client {
|
|
12
|
+
accountBaseURL := baseURL + accountSlug
|
|
13
|
+
|
|
14
|
+
var boardURL string
|
|
15
|
+
if boardID != "" {
|
|
16
|
+
boardURL = accountBaseURL + "/boards" + "/" + boardID
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return &api.Client{
|
|
20
|
+
BaseURL: baseURL,
|
|
21
|
+
AccountBaseURL: accountBaseURL,
|
|
22
|
+
BoardBaseURL: boardURL,
|
|
23
|
+
AccessToken: accessToken,
|
|
24
|
+
HTTPClient: &http.Client{Timeout: 30 * time.Second},
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package ui
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
|
|
6
|
+
"github.com/rogeriopvl/fizzy/internal/api"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
func DisplayAccounts(accounts []api.Account) error {
|
|
10
|
+
for _, account := range accounts {
|
|
11
|
+
fmt.Printf("%s (%s)\n", account.Name, DisplayMeta("slug", account.Slug))
|
|
12
|
+
}
|
|
13
|
+
return nil
|
|
14
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Package ui
|
|
2
|
+
package ui
|
|
3
|
+
|
|
4
|
+
import (
|
|
5
|
+
"fmt"
|
|
6
|
+
|
|
7
|
+
tea "github.com/charmbracelet/bubbletea"
|
|
8
|
+
"github.com/rogeriopvl/fizzy/internal/api"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
type accountModel struct {
|
|
12
|
+
accounts []api.Account
|
|
13
|
+
cursor int
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
func (m accountModel) Init() tea.Cmd {
|
|
17
|
+
return nil
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
func (m accountModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|
21
|
+
switch msg := msg.(type) {
|
|
22
|
+
case tea.KeyMsg:
|
|
23
|
+
switch msg.String() {
|
|
24
|
+
case "ctrl+c", "q":
|
|
25
|
+
return m, tea.Quit
|
|
26
|
+
case "up", "k":
|
|
27
|
+
if m.cursor > 0 {
|
|
28
|
+
m.cursor--
|
|
29
|
+
}
|
|
30
|
+
case "down", "j":
|
|
31
|
+
if m.cursor < len(m.accounts)-1 {
|
|
32
|
+
m.cursor++
|
|
33
|
+
}
|
|
34
|
+
case "enter":
|
|
35
|
+
return m, tea.Quit
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return m, nil
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
func (m accountModel) View() string {
|
|
42
|
+
s := "Select an account:\n\n"
|
|
43
|
+
for i, account := range m.accounts {
|
|
44
|
+
cursor := " "
|
|
45
|
+
if i == m.cursor {
|
|
46
|
+
cursor = "> "
|
|
47
|
+
}
|
|
48
|
+
s += fmt.Sprintf("%s%s (%s)\n", cursor, account.Name, account.Slug)
|
|
49
|
+
}
|
|
50
|
+
s += "\nUse ↑/↓ or k/j to navigate, Enter to select, q to quit"
|
|
51
|
+
return s
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
func SelectAccount(accounts []api.Account) (api.Account, error) {
|
|
55
|
+
m := accountModel{accounts: accounts, cursor: 0}
|
|
56
|
+
p, err := tea.NewProgram(m).Run()
|
|
57
|
+
if err != nil {
|
|
58
|
+
return api.Account{}, err
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
finalModel := p.(accountModel)
|
|
62
|
+
return finalModel.accounts[finalModel.cursor], nil
|
|
63
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
package ui
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
|
|
6
|
+
"github.com/charmbracelet/lipgloss"
|
|
7
|
+
"github.com/rogeriopvl/fizzy/internal/api"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
func DisplayCard(card *api.Card) error {
|
|
11
|
+
boldStyle := lipgloss.NewStyle().Bold(true)
|
|
12
|
+
dimStyle := lipgloss.NewStyle().Bold(true).Faint(true)
|
|
13
|
+
fmt.Printf("%s\n", boldStyle.Render(fmt.Sprintf("%s (#%d)", card.Title, card.Number)))
|
|
14
|
+
fmt.Println("─────────────────────────────────────")
|
|
15
|
+
fmt.Printf("%s %s\n", dimStyle.Render("Description:"), card.Description)
|
|
16
|
+
fmt.Printf("%s %v\n", dimStyle.Render("Tags:"), card.Tags)
|
|
17
|
+
fmt.Printf("%s %v\n", dimStyle.Render("Golden:"), card.Golden)
|
|
18
|
+
fmt.Printf("%s %s\n", dimStyle.Render("Status:"), card.Status)
|
|
19
|
+
fmt.Printf("%s %s\n", dimStyle.Render("Created:"), card.CreatedAt)
|
|
20
|
+
fmt.Printf("%s %s\n", dimStyle.Render("Last Active:"), card.LastActiveAt)
|
|
21
|
+
fmt.Printf("%s %s\n", dimStyle.Render("URL:"), card.URL)
|
|
22
|
+
return nil
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package ui
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
|
|
6
|
+
"github.com/charmbracelet/lipgloss"
|
|
7
|
+
"github.com/rogeriopvl/fizzy/internal/api"
|
|
8
|
+
"github.com/rogeriopvl/fizzy/internal/colors"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
func DisplayColumns(columns []api.Column) error {
|
|
12
|
+
for _, column := range columns {
|
|
13
|
+
colorName := column.Color.Name
|
|
14
|
+
colorDef := colors.ByName(colorName)
|
|
15
|
+
|
|
16
|
+
termColor := lipgloss.Color("7") // default to white
|
|
17
|
+
if colorDef != nil {
|
|
18
|
+
termColor = colorDef.TermColor
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
styledName := lipgloss.NewStyle().
|
|
22
|
+
Foreground(termColor).
|
|
23
|
+
Render(column.Name)
|
|
24
|
+
|
|
25
|
+
fmt.Printf("%s (%s)\n", styledName, DisplayID(column.ID))
|
|
26
|
+
}
|
|
27
|
+
return nil
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package ui
|
|
2
|
+
|
|
3
|
+
import "github.com/charmbracelet/lipgloss"
|
|
4
|
+
|
|
5
|
+
// DisplayMeta returns a formatted metadata string with greyed out styling
|
|
6
|
+
func DisplayMeta(label string, value string) string {
|
|
7
|
+
return lipgloss.NewStyle().
|
|
8
|
+
Foreground(lipgloss.Color("8")). // Grey color
|
|
9
|
+
Render(label + ": " + value)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
func DisplayID(id string) string {
|
|
13
|
+
return DisplayMeta("id", id)
|
|
14
|
+
}
|
package/main.go
CHANGED