fizzy-cli 0.7.0 → 0.9.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/docs/API.md +63 -2
- package/package.json +2 -1
- package/.github/workflows/release.yml +0 -29
- package/.github/workflows/tests.yml +0 -24
- package/AGENTS.md +0 -33
- package/CHANGELOG.md +0 -168
- package/Makefile +0 -43
- package/bin/fizzy +0 -0
- package/cmd/account.go +0 -14
- package/cmd/account_list.go +0 -44
- package/cmd/account_list_test.go +0 -118
- package/cmd/board.go +0 -49
- package/cmd/board_create.go +0 -59
- package/cmd/board_create_test.go +0 -141
- package/cmd/board_delete.go +0 -40
- package/cmd/board_delete_test.go +0 -121
- package/cmd/board_list.go +0 -44
- package/cmd/board_list_test.go +0 -115
- package/cmd/board_show.go +0 -40
- package/cmd/board_show_test.go +0 -113
- package/cmd/board_test.go +0 -92
- package/cmd/board_update.go +0 -72
- package/cmd/board_update_test.go +0 -233
- package/cmd/card.go +0 -24
- package/cmd/card_assign.go +0 -55
- package/cmd/card_assign_test.go +0 -130
- package/cmd/card_close.go +0 -46
- package/cmd/card_close_test.go +0 -92
- package/cmd/card_create.go +0 -72
- package/cmd/card_create_test.go +0 -186
- package/cmd/card_delete.go +0 -46
- package/cmd/card_delete_test.go +0 -92
- package/cmd/card_golden.go +0 -46
- package/cmd/card_golden_test.go +0 -92
- package/cmd/card_list.go +0 -53
- package/cmd/card_list_test.go +0 -148
- package/cmd/card_not_now.go +0 -46
- package/cmd/card_not_now_test.go +0 -92
- package/cmd/card_reopen.go +0 -46
- package/cmd/card_reopen_test.go +0 -92
- package/cmd/card_show.go +0 -46
- package/cmd/card_show_test.go +0 -92
- package/cmd/card_tag.go +0 -51
- package/cmd/card_tag_test.go +0 -112
- package/cmd/card_triage.go +0 -46
- package/cmd/card_ungolden.go +0 -46
- package/cmd/card_ungolden_test.go +0 -92
- package/cmd/card_untriage.go +0 -46
- package/cmd/card_untriage_test.go +0 -92
- package/cmd/card_unwatch.go +0 -46
- package/cmd/card_unwatch_test.go +0 -92
- package/cmd/card_update.go +0 -82
- package/cmd/card_update_test.go +0 -149
- package/cmd/card_watch.go +0 -46
- package/cmd/card_watch_test.go +0 -92
- package/cmd/column.go +0 -14
- package/cmd/column_create.go +0 -79
- package/cmd/column_create_test.go +0 -178
- package/cmd/column_delete.go +0 -40
- package/cmd/column_delete_test.go +0 -121
- package/cmd/column_list.go +0 -44
- package/cmd/column_list_test.go +0 -138
- package/cmd/column_show.go +0 -40
- package/cmd/column_show_test.go +0 -111
- package/cmd/column_update.go +0 -67
- package/cmd/column_update_test.go +0 -198
- package/cmd/comment.go +0 -14
- package/cmd/comment_create.go +0 -51
- package/cmd/comment_create_test.go +0 -129
- package/cmd/comment_delete.go +0 -46
- package/cmd/comment_delete_test.go +0 -92
- package/cmd/comment_list.go +0 -51
- package/cmd/comment_list_test.go +0 -132
- package/cmd/comment_show.go +0 -46
- package/cmd/comment_show_test.go +0 -104
- package/cmd/comment_update.go +0 -51
- package/cmd/comment_update_test.go +0 -130
- package/cmd/login.go +0 -81
- package/cmd/login_test.go +0 -98
- package/cmd/notification.go +0 -14
- package/cmd/notification_list.go +0 -69
- package/cmd/notification_list_test.go +0 -288
- package/cmd/notification_read.go +0 -51
- package/cmd/notification_read_all.go +0 -38
- package/cmd/notification_read_all_test.go +0 -75
- package/cmd/notification_read_test.go +0 -138
- package/cmd/notification_unread.go +0 -44
- package/cmd/notification_unread_test.go +0 -99
- package/cmd/reaction.go +0 -13
- package/cmd/reaction_create.go +0 -46
- package/cmd/reaction_create_test.go +0 -113
- package/cmd/reaction_delete.go +0 -46
- package/cmd/reaction_delete_test.go +0 -92
- package/cmd/reaction_list.go +0 -51
- package/cmd/reaction_list_test.go +0 -125
- package/cmd/root.go +0 -38
- package/cmd/step.go +0 -14
- package/cmd/step_create.go +0 -53
- package/cmd/step_create_test.go +0 -171
- package/cmd/step_delete.go +0 -46
- package/cmd/step_delete_test.go +0 -92
- package/cmd/step_update.go +0 -66
- package/cmd/step_update_test.go +0 -190
- package/cmd/tag.go +0 -15
- package/cmd/tag_list.go +0 -47
- package/cmd/tag_list_test.go +0 -109
- package/cmd/use.go +0 -85
- package/cmd/use_test.go +0 -186
- package/go.mod +0 -31
- package/go.sum +0 -53
- package/internal/api/boards.go +0 -93
- package/internal/api/cards.go +0 -288
- package/internal/api/client.go +0 -99
- package/internal/api/columns.go +0 -113
- package/internal/api/comments.go +0 -108
- package/internal/api/identity.go +0 -24
- package/internal/api/notifications.go +0 -89
- package/internal/api/reactions.go +0 -69
- package/internal/api/steps.go +0 -101
- package/internal/api/tags.go +0 -24
- package/internal/api/types.go +0 -190
- package/internal/app/app.go +0 -49
- package/internal/colors/colors.go +0 -32
- package/internal/config/config.go +0 -70
- package/internal/testutil/client.go +0 -26
- package/internal/ui/account_list.go +0 -14
- package/internal/ui/account_selector.go +0 -63
- package/internal/ui/board_list.go +0 -14
- package/internal/ui/board_show.go +0 -17
- package/internal/ui/card_list.go +0 -14
- package/internal/ui/card_show.go +0 -23
- package/internal/ui/column_list.go +0 -28
- package/internal/ui/column_show.go +0 -16
- package/internal/ui/comment_list.go +0 -25
- package/internal/ui/format.go +0 -27
- package/internal/ui/notification_list.go +0 -27
- package/internal/ui/reaction_list.go +0 -14
package/cmd/tag_list_test.go
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
package cmd
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"encoding/json"
|
|
6
|
-
"net/http"
|
|
7
|
-
"net/http/httptest"
|
|
8
|
-
"testing"
|
|
9
|
-
|
|
10
|
-
"github.com/rogeriopvl/fizzy/internal/api"
|
|
11
|
-
"github.com/rogeriopvl/fizzy/internal/app"
|
|
12
|
-
"github.com/rogeriopvl/fizzy/internal/testutil"
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
func TestTagListCommand(t *testing.T) {
|
|
16
|
-
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
17
|
-
if r.URL.Path != "/tags" {
|
|
18
|
-
t.Errorf("expected /tags, got %s", r.URL.Path)
|
|
19
|
-
}
|
|
20
|
-
if r.Method != http.MethodGet {
|
|
21
|
-
t.Errorf("expected GET, got %s", r.Method)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
auth := r.Header.Get("Authorization")
|
|
25
|
-
if auth != "Bearer test-token" {
|
|
26
|
-
t.Errorf("expected Bearer test-token, got %s", auth)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
w.Header().Set("Content-Type", "application/json")
|
|
30
|
-
response := []api.Tag{
|
|
31
|
-
{
|
|
32
|
-
ID: "tag-123",
|
|
33
|
-
Title: "bug",
|
|
34
|
-
CreatedAt: "2025-01-01T00:00:00Z",
|
|
35
|
-
URL: "http://fizzy.localhost:3006/897362094/cards?tag_ids[]=tag-123",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
ID: "tag-456",
|
|
39
|
-
Title: "feature",
|
|
40
|
-
CreatedAt: "2025-01-02T00:00:00Z",
|
|
41
|
-
URL: "http://fizzy.localhost:3006/897362094/cards?tag_ids[]=tag-456",
|
|
42
|
-
},
|
|
43
|
-
}
|
|
44
|
-
json.NewEncoder(w).Encode(response)
|
|
45
|
-
}))
|
|
46
|
-
defer server.Close()
|
|
47
|
-
|
|
48
|
-
client := testutil.NewTestClient(server.URL, "", "", "test-token")
|
|
49
|
-
testApp := &app.App{Client: client}
|
|
50
|
-
|
|
51
|
-
cmd := tagListCmd
|
|
52
|
-
cmd.SetContext(testApp.ToContext(context.Background()))
|
|
53
|
-
|
|
54
|
-
if err := handleListTags(cmd); err != nil {
|
|
55
|
-
t.Fatalf("handleListTags failed: %v", err)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
func TestTagListCommandNoTags(t *testing.T) {
|
|
60
|
-
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
61
|
-
w.Header().Set("Content-Type", "application/json")
|
|
62
|
-
w.Write([]byte("[]"))
|
|
63
|
-
}))
|
|
64
|
-
defer server.Close()
|
|
65
|
-
|
|
66
|
-
client := testutil.NewTestClient(server.URL, "", "", "test-token")
|
|
67
|
-
testApp := &app.App{Client: client}
|
|
68
|
-
|
|
69
|
-
cmd := tagListCmd
|
|
70
|
-
cmd.SetContext(testApp.ToContext(context.Background()))
|
|
71
|
-
|
|
72
|
-
if err := handleListTags(cmd); err != nil {
|
|
73
|
-
t.Fatalf("handleListTags with no tags failed: %v", err)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
func TestTagListCommandAPIError(t *testing.T) {
|
|
78
|
-
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
79
|
-
w.WriteHeader(http.StatusInternalServerError)
|
|
80
|
-
w.Write([]byte("Internal Server Error"))
|
|
81
|
-
}))
|
|
82
|
-
defer server.Close()
|
|
83
|
-
|
|
84
|
-
client := testutil.NewTestClient(server.URL, "", "", "test-token")
|
|
85
|
-
testApp := &app.App{Client: client}
|
|
86
|
-
|
|
87
|
-
cmd := tagListCmd
|
|
88
|
-
cmd.SetContext(testApp.ToContext(context.Background()))
|
|
89
|
-
|
|
90
|
-
err := handleListTags(cmd)
|
|
91
|
-
if err == nil {
|
|
92
|
-
t.Errorf("expected error for API failure")
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
func TestTagListCommandNoClient(t *testing.T) {
|
|
97
|
-
testApp := &app.App{}
|
|
98
|
-
|
|
99
|
-
cmd := tagListCmd
|
|
100
|
-
cmd.SetContext(testApp.ToContext(context.Background()))
|
|
101
|
-
|
|
102
|
-
err := handleListTags(cmd)
|
|
103
|
-
if err == nil {
|
|
104
|
-
t.Errorf("expected error when client not available")
|
|
105
|
-
}
|
|
106
|
-
if err.Error() != "API client not available" {
|
|
107
|
-
t.Errorf("expected 'client not available' error, got %v", err)
|
|
108
|
-
}
|
|
109
|
-
}
|
package/cmd/use.go
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
package cmd
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"fmt"
|
|
6
|
-
|
|
7
|
-
"github.com/rogeriopvl/fizzy/internal/app"
|
|
8
|
-
"github.com/rogeriopvl/fizzy/internal/config"
|
|
9
|
-
"github.com/spf13/cobra"
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
var useCmd = &cobra.Command{
|
|
13
|
-
Use: "use",
|
|
14
|
-
Short: "Set the active board or account",
|
|
15
|
-
Long: `Set the active board or account to use for subsequent commands`,
|
|
16
|
-
Run: func(cmd *cobra.Command, args []string) {
|
|
17
|
-
if err := handleUse(cmd); err != nil {
|
|
18
|
-
fmt.Fprintf(cmd.OutOrStderr(), "Error: %v\n", err)
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
func handleUse(cmd *cobra.Command) error {
|
|
24
|
-
board, _ := cmd.Flags().GetString("board")
|
|
25
|
-
account, _ := cmd.Flags().GetString("account")
|
|
26
|
-
|
|
27
|
-
if board == "" && account == "" {
|
|
28
|
-
return fmt.Errorf("must specify either --board or --account")
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if board != "" && account != "" {
|
|
32
|
-
return fmt.Errorf("cannot specify both --board and --account")
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
cfg, err := config.Load()
|
|
36
|
-
if err != nil {
|
|
37
|
-
return fmt.Errorf("loading config: %w", err)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if board != "" {
|
|
41
|
-
a := app.FromContext(cmd.Context())
|
|
42
|
-
if a == nil || a.Client == nil {
|
|
43
|
-
return fmt.Errorf("API client not available")
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
boards, err := a.Client.GetBoards(context.Background())
|
|
47
|
-
if err != nil {
|
|
48
|
-
return fmt.Errorf("fetching boards: %w", err)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
var boardID string
|
|
52
|
-
for _, b := range boards {
|
|
53
|
-
if b.Name == board {
|
|
54
|
-
boardID = b.ID
|
|
55
|
-
break
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if boardID == "" {
|
|
60
|
-
return fmt.Errorf("board '%s' not found", board)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
cfg.SelectedBoard = boardID
|
|
64
|
-
if err := cfg.Save(); err != nil {
|
|
65
|
-
return fmt.Errorf("saving config: %w", err)
|
|
66
|
-
}
|
|
67
|
-
fmt.Printf("Selected board: %s\n", board)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if account != "" {
|
|
71
|
-
cfg.SelectedAccount = account
|
|
72
|
-
if err := cfg.Save(); err != nil {
|
|
73
|
-
return fmt.Errorf("saving config: %w", err)
|
|
74
|
-
}
|
|
75
|
-
fmt.Printf("Selected account: %s\n", account)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return nil
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
func init() {
|
|
82
|
-
rootCmd.AddCommand(useCmd)
|
|
83
|
-
useCmd.Flags().String("board", "", "Board name to use")
|
|
84
|
-
useCmd.Flags().String("account", "", "Account slug to use")
|
|
85
|
-
}
|
package/cmd/use_test.go
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
package cmd
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"encoding/json"
|
|
6
|
-
"fmt"
|
|
7
|
-
"net/http"
|
|
8
|
-
"net/http/httptest"
|
|
9
|
-
"testing"
|
|
10
|
-
|
|
11
|
-
"github.com/rogeriopvl/fizzy/internal/api"
|
|
12
|
-
"github.com/rogeriopvl/fizzy/internal/app"
|
|
13
|
-
"github.com/rogeriopvl/fizzy/internal/config"
|
|
14
|
-
"github.com/rogeriopvl/fizzy/internal/testutil"
|
|
15
|
-
"github.com/spf13/cobra"
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
func newUseCmd() *cobra.Command {
|
|
19
|
-
cmd := &cobra.Command{
|
|
20
|
-
Use: "use",
|
|
21
|
-
Short: "Set the active board or account",
|
|
22
|
-
Long: `Set the active board or account to use for subsequent commands`,
|
|
23
|
-
Run: func(cmd *cobra.Command, args []string) {
|
|
24
|
-
if err := handleUse(cmd); err != nil {
|
|
25
|
-
fmt.Fprintf(cmd.OutOrStderr(), "Error: %v\n", err)
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
}
|
|
29
|
-
cmd.Flags().String("board", "", "Board name to use")
|
|
30
|
-
cmd.Flags().String("account", "", "Account slug to use")
|
|
31
|
-
return cmd
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
func TestUseCommandSetBoard(t *testing.T) {
|
|
35
|
-
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
36
|
-
if r.URL.Path != "/boards" {
|
|
37
|
-
t.Errorf("expected /boards, got %s", r.URL.Path)
|
|
38
|
-
}
|
|
39
|
-
if r.Method != http.MethodGet {
|
|
40
|
-
t.Errorf("expected GET, got %s", r.Method)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
auth := r.Header.Get("Authorization")
|
|
44
|
-
if auth == "" {
|
|
45
|
-
t.Error("missing Authorization header")
|
|
46
|
-
}
|
|
47
|
-
if auth != "Bearer test-token" {
|
|
48
|
-
t.Errorf("expected Bearer test-token, got %s", auth)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
w.Header().Set("Content-Type", "application/json")
|
|
52
|
-
response := []api.Board{
|
|
53
|
-
{
|
|
54
|
-
ID: "board-123",
|
|
55
|
-
Name: "My Project",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
ID: "board-456",
|
|
59
|
-
Name: "Other Board",
|
|
60
|
-
},
|
|
61
|
-
}
|
|
62
|
-
json.NewEncoder(w).Encode(response)
|
|
63
|
-
}))
|
|
64
|
-
defer server.Close()
|
|
65
|
-
|
|
66
|
-
tmpDir := t.TempDir()
|
|
67
|
-
t.Setenv("HOME", tmpDir)
|
|
68
|
-
|
|
69
|
-
client := testutil.NewTestClient(server.URL, "", "", "test-token")
|
|
70
|
-
cfg := &config.Config{}
|
|
71
|
-
testApp := &app.App{
|
|
72
|
-
Client: client,
|
|
73
|
-
Config: cfg,
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
cmd := newUseCmd()
|
|
77
|
-
cmd.SetContext(testApp.ToContext(context.Background()))
|
|
78
|
-
cmd.ParseFlags([]string{"--board", "My Project"})
|
|
79
|
-
|
|
80
|
-
if err := handleUse(cmd); err != nil {
|
|
81
|
-
t.Fatalf("handleUse failed: %v", err)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
savedCfg, err := config.Load()
|
|
85
|
-
if err != nil {
|
|
86
|
-
t.Fatalf("failed to load config: %v", err)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if savedCfg.SelectedBoard != "board-123" {
|
|
90
|
-
t.Errorf("expected SelectedBoard=board-123, got %s", savedCfg.SelectedBoard)
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
func TestUseCommandSetAccount(t *testing.T) {
|
|
95
|
-
tmpDir := t.TempDir()
|
|
96
|
-
t.Setenv("HOME", tmpDir)
|
|
97
|
-
|
|
98
|
-
cmd := newUseCmd()
|
|
99
|
-
cmd.ParseFlags([]string{"--account", "my-company"})
|
|
100
|
-
|
|
101
|
-
cfg := &config.Config{}
|
|
102
|
-
testApp := &app.App{Config: cfg}
|
|
103
|
-
cmd.SetContext(testApp.ToContext(context.Background()))
|
|
104
|
-
|
|
105
|
-
if err := handleUse(cmd); err != nil {
|
|
106
|
-
t.Fatalf("handleUse failed: %v", err)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
savedCfg, err := config.Load()
|
|
110
|
-
if err != nil {
|
|
111
|
-
t.Fatalf("failed to load config: %v", err)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if savedCfg.SelectedAccount != "my-company" {
|
|
115
|
-
t.Errorf("expected SelectedAccount=my-company, got %s", savedCfg.SelectedAccount)
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
func TestUseCommandBoardNotFound(t *testing.T) {
|
|
120
|
-
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
121
|
-
if r.Method != http.MethodGet {
|
|
122
|
-
t.Errorf("expected GET, got %s", r.Method)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
auth := r.Header.Get("Authorization")
|
|
126
|
-
if auth != "Bearer test-token" {
|
|
127
|
-
t.Errorf("expected Bearer test-token, got %s", auth)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
w.Header().Set("Content-Type", "application/json")
|
|
131
|
-
response := []api.Board{
|
|
132
|
-
{ID: "board-123", Name: "Existing Board"},
|
|
133
|
-
}
|
|
134
|
-
json.NewEncoder(w).Encode(response)
|
|
135
|
-
}))
|
|
136
|
-
defer server.Close()
|
|
137
|
-
|
|
138
|
-
tmpDir := t.TempDir()
|
|
139
|
-
t.Setenv("HOME", tmpDir)
|
|
140
|
-
|
|
141
|
-
client := testutil.NewTestClient(server.URL, "", "", "test-token")
|
|
142
|
-
testApp := &app.App{
|
|
143
|
-
Client: client,
|
|
144
|
-
Config: &config.Config{},
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
cmd := newUseCmd()
|
|
148
|
-
cmd.SetContext(testApp.ToContext(context.Background()))
|
|
149
|
-
cmd.ParseFlags([]string{"--board", "Nonexistent Board"})
|
|
150
|
-
|
|
151
|
-
err := handleUse(cmd)
|
|
152
|
-
if err == nil {
|
|
153
|
-
t.Errorf("expected error for nonexistent board")
|
|
154
|
-
}
|
|
155
|
-
if err.Error() != "board 'Nonexistent Board' not found" {
|
|
156
|
-
t.Errorf("expected 'not found' error, got %v", err)
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
func TestUseCommandBothFlagsError(t *testing.T) {
|
|
161
|
-
cmd := newUseCmd()
|
|
162
|
-
cmd.ParseFlags([]string{"--board", "Board", "--account", "Account"})
|
|
163
|
-
cmd.SetContext(context.Background())
|
|
164
|
-
|
|
165
|
-
err := handleUse(cmd)
|
|
166
|
-
if err == nil {
|
|
167
|
-
t.Errorf("expected error when both flags provided")
|
|
168
|
-
}
|
|
169
|
-
if err.Error() != "cannot specify both --board and --account" {
|
|
170
|
-
t.Errorf("expected 'both flags' error, got %v", err)
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
func TestUseCommandNoFlagsError(t *testing.T) {
|
|
175
|
-
cmd := newUseCmd()
|
|
176
|
-
cmd.SetContext(context.Background())
|
|
177
|
-
cmd.ParseFlags([]string{})
|
|
178
|
-
|
|
179
|
-
err := handleUse(cmd)
|
|
180
|
-
if err == nil {
|
|
181
|
-
t.Errorf("expected error when no flags provided")
|
|
182
|
-
}
|
|
183
|
-
if err.Error() != "must specify either --board or --account" {
|
|
184
|
-
t.Errorf("expected 'no flags' error, got %v", err)
|
|
185
|
-
}
|
|
186
|
-
}
|
package/go.mod
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
module github.com/rogeriopvl/fizzy
|
|
2
|
-
|
|
3
|
-
go 1.25.1
|
|
4
|
-
|
|
5
|
-
require (
|
|
6
|
-
github.com/charmbracelet/bubbletea v1.3.10
|
|
7
|
-
github.com/charmbracelet/lipgloss v1.1.0
|
|
8
|
-
github.com/spf13/cobra v1.10.2
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
require (
|
|
12
|
-
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
|
13
|
-
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
|
|
14
|
-
github.com/charmbracelet/x/ansi v0.10.1 // indirect
|
|
15
|
-
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
|
|
16
|
-
github.com/charmbracelet/x/term v0.2.1 // indirect
|
|
17
|
-
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
|
|
18
|
-
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
|
19
|
-
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
|
20
|
-
github.com/mattn/go-isatty v0.0.20 // indirect
|
|
21
|
-
github.com/mattn/go-localereader v0.0.1 // indirect
|
|
22
|
-
github.com/mattn/go-runewidth v0.0.16 // indirect
|
|
23
|
-
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
|
|
24
|
-
github.com/muesli/cancelreader v0.2.2 // indirect
|
|
25
|
-
github.com/muesli/termenv v0.16.0 // indirect
|
|
26
|
-
github.com/rivo/uniseg v0.4.7 // indirect
|
|
27
|
-
github.com/spf13/pflag v1.0.9 // indirect
|
|
28
|
-
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
|
29
|
-
golang.org/x/sys v0.36.0 // indirect
|
|
30
|
-
golang.org/x/text v0.3.8 // indirect
|
|
31
|
-
)
|
package/go.sum
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
|
|
2
|
-
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
|
|
3
|
-
github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=
|
|
4
|
-
github.com/charmbracelet/bubbletea v1.3.10/go.mod h1:ORQfo0fk8U+po9VaNvnV95UPWA1BitP1E0N6xJPlHr4=
|
|
5
|
-
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs=
|
|
6
|
-
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk=
|
|
7
|
-
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
|
|
8
|
-
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
|
|
9
|
-
github.com/charmbracelet/x/ansi v0.10.1 h1:rL3Koar5XvX0pHGfovN03f5cxLbCF2YvLeyz7D2jVDQ=
|
|
10
|
-
github.com/charmbracelet/x/ansi v0.10.1/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE=
|
|
11
|
-
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8=
|
|
12
|
-
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
|
|
13
|
-
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
|
|
14
|
-
github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
|
|
15
|
-
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
|
16
|
-
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
|
|
17
|
-
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
|
|
18
|
-
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
|
19
|
-
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
|
20
|
-
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
|
21
|
-
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
|
22
|
-
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
|
23
|
-
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
|
24
|
-
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
|
|
25
|
-
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
|
|
26
|
-
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
|
27
|
-
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
|
28
|
-
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
|
|
29
|
-
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
|
|
30
|
-
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
|
|
31
|
-
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
|
|
32
|
-
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
|
|
33
|
-
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
|
|
34
|
-
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
|
35
|
-
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
|
36
|
-
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
|
37
|
-
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
|
38
|
-
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
|
|
39
|
-
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
|
|
40
|
-
github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
|
|
41
|
-
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
|
42
|
-
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
|
|
43
|
-
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
|
|
44
|
-
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
|
45
|
-
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E=
|
|
46
|
-
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
|
|
47
|
-
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
48
|
-
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
49
|
-
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
|
|
50
|
-
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
|
51
|
-
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
|
|
52
|
-
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
|
53
|
-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
package/internal/api/boards.go
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
package api
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"fmt"
|
|
6
|
-
"net/http"
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
func (c *Client) GetBoards(ctx context.Context) ([]Board, error) {
|
|
10
|
-
endpointURL := c.AccountBaseURL + "/boards"
|
|
11
|
-
|
|
12
|
-
req, err := c.newRequest(ctx, http.MethodGet, endpointURL, nil)
|
|
13
|
-
if err != nil {
|
|
14
|
-
return nil, fmt.Errorf("failed to create request: %w", err)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
var response []Board
|
|
18
|
-
_, err = c.decodeResponse(req, &response)
|
|
19
|
-
if err != nil {
|
|
20
|
-
return nil, err
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return response, nil
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
func (c *Client) GetBoard(ctx context.Context, boardID string) (*Board, error) {
|
|
27
|
-
endpointURL := c.AccountBaseURL + "/boards/" + boardID
|
|
28
|
-
|
|
29
|
-
req, err := c.newRequest(ctx, http.MethodGet, endpointURL, nil)
|
|
30
|
-
if err != nil {
|
|
31
|
-
return nil, fmt.Errorf("failed to create request: %w", err)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
var response Board
|
|
35
|
-
_, err = c.decodeResponse(req, &response)
|
|
36
|
-
if err != nil {
|
|
37
|
-
return nil, err
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return &response, nil
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
func (c *Client) PostBoards(ctx context.Context, payload CreateBoardPayload) (bool, error) {
|
|
44
|
-
endpointURL := c.AccountBaseURL + "/boards"
|
|
45
|
-
|
|
46
|
-
body := map[string]CreateBoardPayload{"board": payload}
|
|
47
|
-
|
|
48
|
-
req, err := c.newRequest(ctx, http.MethodPost, endpointURL, body)
|
|
49
|
-
if err != nil {
|
|
50
|
-
return false, fmt.Errorf("failed to create board request: %w", err)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
_, err = c.decodeResponse(req, nil, http.StatusCreated)
|
|
54
|
-
if err != nil {
|
|
55
|
-
return false, err
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return true, nil
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
func (c *Client) PutBoard(ctx context.Context, boardID string, payload UpdateBoardPayload) error {
|
|
62
|
-
endpointURL := c.AccountBaseURL + "/boards/" + boardID
|
|
63
|
-
|
|
64
|
-
body := map[string]UpdateBoardPayload{"board": payload}
|
|
65
|
-
|
|
66
|
-
req, err := c.newRequest(ctx, http.MethodPut, endpointURL, body)
|
|
67
|
-
if err != nil {
|
|
68
|
-
return fmt.Errorf("failed to create update board request: %w", err)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
_, err = c.decodeResponse(req, nil, http.StatusNoContent)
|
|
72
|
-
if err != nil {
|
|
73
|
-
return err
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return nil
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
func (c *Client) DeleteBoard(ctx context.Context, boardID string) error {
|
|
80
|
-
endpointURL := c.AccountBaseURL + "/boards/" + boardID
|
|
81
|
-
|
|
82
|
-
req, err := c.newRequest(ctx, http.MethodDelete, endpointURL, nil)
|
|
83
|
-
if err != nil {
|
|
84
|
-
return fmt.Errorf("failed to create delete board request: %w", err)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
_, err = c.decodeResponse(req, nil, http.StatusNoContent)
|
|
88
|
-
if err != nil {
|
|
89
|
-
return err
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return nil
|
|
93
|
-
}
|