fizzy-cli 0.8.0 → 1.0.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/.golangci.yml +56 -0
- package/IMPLEMENTATION_PLAN.md +58 -0
- package/docs/API.md +89 -0
- package/package.json +2 -1
- package/.env +0 -1
- package/.github/workflows/release.yml +0 -29
- package/.github/workflows/tests.yml +0 -24
- package/AGENTS.md +0 -33
- package/CHANGELOG.md +0 -194
- 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 -114
- package/cmd/card_list_test.go +0 -373
- package/cmd/card_not_now.go +0 -46
- package/cmd/card_not_now_test.go +0 -92
- package/cmd/card_reaction.go +0 -13
- package/cmd/card_reaction_create.go +0 -46
- package/cmd/card_reaction_create_test.go +0 -148
- package/cmd/card_reaction_delete.go +0 -46
- package/cmd/card_reaction_delete_test.go +0 -112
- package/cmd/card_reaction_list.go +0 -51
- package/cmd/card_reaction_list_test.go +0 -127
- 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/cmd/user.go +0 -22
- package/cmd/user_deactivate.go +0 -40
- package/cmd/user_deactivate_test.go +0 -121
- package/cmd/user_list.go +0 -44
- package/cmd/user_list_test.go +0 -126
- package/cmd/user_show.go +0 -40
- package/cmd/user_show_test.go +0 -110
- package/cmd/user_update.go +0 -71
- package/cmd/user_update_test.go +0 -177
- package/go.mod +0 -31
- package/go.sum +0 -53
- package/internal/api/boards.go +0 -93
- package/internal/api/cards.go +0 -322
- 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 -130
- package/internal/api/steps.go +0 -101
- package/internal/api/tags.go +0 -24
- package/internal/api/types.go +0 -195
- package/internal/api/users.go +0 -75
- 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/internal/ui/user_list.go +0 -19
- package/internal/ui/user_show.go +0 -23
package/internal/api/users.go
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
package api
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"fmt"
|
|
6
|
-
"net/http"
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
func (c *Client) GetUsers(ctx context.Context) ([]User, error) {
|
|
10
|
-
endpointURL := c.AccountBaseURL + "/users"
|
|
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 []User
|
|
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) GetUser(ctx context.Context, userID string) (*User, error) {
|
|
27
|
-
endpointURL := c.AccountBaseURL + "/users/" + userID
|
|
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 User
|
|
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) PutUser(ctx context.Context, userID string, payload UpdateUserPayload) error {
|
|
44
|
-
endpointURL := c.AccountBaseURL + "/users/" + userID
|
|
45
|
-
|
|
46
|
-
body := map[string]UpdateUserPayload{"user": payload}
|
|
47
|
-
|
|
48
|
-
req, err := c.newRequest(ctx, http.MethodPut, endpointURL, body)
|
|
49
|
-
if err != nil {
|
|
50
|
-
return fmt.Errorf("failed to create update user request: %w", err)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
_, err = c.decodeResponse(req, nil, http.StatusNoContent)
|
|
54
|
-
if err != nil {
|
|
55
|
-
return err
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return nil
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
func (c *Client) DeleteUser(ctx context.Context, userID string) error {
|
|
62
|
-
endpointURL := c.AccountBaseURL + "/users/" + userID
|
|
63
|
-
|
|
64
|
-
req, err := c.newRequest(ctx, http.MethodDelete, endpointURL, nil)
|
|
65
|
-
if err != nil {
|
|
66
|
-
return fmt.Errorf("failed to create delete user request: %w", err)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
_, err = c.decodeResponse(req, nil, http.StatusNoContent)
|
|
70
|
-
if err != nil {
|
|
71
|
-
return err
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return nil
|
|
75
|
-
}
|
package/internal/app/app.go
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// Package app
|
|
2
|
-
package app
|
|
3
|
-
|
|
4
|
-
import (
|
|
5
|
-
"context"
|
|
6
|
-
"fmt"
|
|
7
|
-
"os"
|
|
8
|
-
|
|
9
|
-
"github.com/rogeriopvl/fizzy/internal/api"
|
|
10
|
-
"github.com/rogeriopvl/fizzy/internal/config"
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
type App struct {
|
|
14
|
-
Client *api.Client
|
|
15
|
-
Config *config.Config
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
func New() (*App, error) {
|
|
19
|
-
cfg, err := config.Load()
|
|
20
|
-
if err != nil {
|
|
21
|
-
return nil, fmt.Errorf("loading config: %w", err)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
token, isSet := os.LookupEnv("FIZZY_ACCESS_TOKEN")
|
|
25
|
-
if !isSet || token == "" {
|
|
26
|
-
return &App{Config: cfg}, nil // No token set, app will handle gracefully
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
client, err := api.NewClient(cfg.SelectedAccount, cfg.SelectedBoard)
|
|
30
|
-
if err != nil {
|
|
31
|
-
return nil, fmt.Errorf("creating API client: %w", err)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return &App{Client: client, Config: cfg}, nil
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// contextKey is a type for context keys to avoid collisions.
|
|
38
|
-
type contextKey string
|
|
39
|
-
|
|
40
|
-
const appContextKey contextKey = "app"
|
|
41
|
-
|
|
42
|
-
func FromContext(ctx context.Context) *App {
|
|
43
|
-
app, _ := ctx.Value(appContextKey).(*App)
|
|
44
|
-
return app
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
func (a *App) ToContext(ctx context.Context) context.Context {
|
|
48
|
-
return context.WithValue(ctx, appContextKey, a)
|
|
49
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
package colors
|
|
2
|
-
|
|
3
|
-
import "github.com/charmbracelet/lipgloss"
|
|
4
|
-
|
|
5
|
-
type ColorDef struct {
|
|
6
|
-
Name string
|
|
7
|
-
CSSValue string
|
|
8
|
-
TermColor lipgloss.Color
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
var (
|
|
12
|
-
Blue = ColorDef{"Blue", "var(--color-card-default)", lipgloss.Color("12")}
|
|
13
|
-
Gray = ColorDef{"Gray", "var(--color-card-1)", lipgloss.Color("8")}
|
|
14
|
-
Tan = ColorDef{"Tan", "var(--color-card-2)", lipgloss.Color("180")}
|
|
15
|
-
Yellow = ColorDef{"Yellow", "var(--color-card-3)", lipgloss.Color("11")}
|
|
16
|
-
Lime = ColorDef{"Lime", "var(--color-card-4)", lipgloss.Color("10")}
|
|
17
|
-
Aqua = ColorDef{"Aqua", "var(--color-card-5)", lipgloss.Color("14")}
|
|
18
|
-
Violet = ColorDef{"Violet", "var(--color-card-6)", lipgloss.Color("177")}
|
|
19
|
-
Purple = ColorDef{"Purple", "var(--color-card-7)", lipgloss.Color("135")}
|
|
20
|
-
Pink = ColorDef{"Pink", "var(--color-card-8)", lipgloss.Color("205")}
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
var All = []ColorDef{Blue, Gray, Tan, Yellow, Lime, Aqua, Violet, Purple, Pink}
|
|
24
|
-
|
|
25
|
-
func ByName(name string) *ColorDef {
|
|
26
|
-
for _, c := range All {
|
|
27
|
-
if c.Name == name {
|
|
28
|
-
return &c
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return nil
|
|
32
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// Package config
|
|
2
|
-
package config
|
|
3
|
-
|
|
4
|
-
import (
|
|
5
|
-
"encoding/json"
|
|
6
|
-
"fmt"
|
|
7
|
-
"os"
|
|
8
|
-
"path/filepath"
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
const (
|
|
12
|
-
configDir = ".config/fizzy-cli"
|
|
13
|
-
configFile = "config.json"
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
type Config struct {
|
|
17
|
-
SelectedAccount string `json:"selected_account"`
|
|
18
|
-
SelectedBoard string `json:"selected_board"`
|
|
19
|
-
CurrentUserID string `json:"current_user_id"`
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Load reads the config file from $HOME/.config/fizzy-cli/config.json.
|
|
23
|
-
func Load() (*Config, error) {
|
|
24
|
-
homeDir, err := os.UserHomeDir()
|
|
25
|
-
if err != nil {
|
|
26
|
-
return nil, fmt.Errorf("getting home directory: %w", err)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
configPath := filepath.Join(homeDir, configDir, configFile)
|
|
30
|
-
|
|
31
|
-
data, err := os.ReadFile(configPath)
|
|
32
|
-
if err != nil {
|
|
33
|
-
if os.IsNotExist(err) {
|
|
34
|
-
return &Config{}, nil
|
|
35
|
-
}
|
|
36
|
-
return nil, fmt.Errorf("reading config file: %w", err)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
var config Config
|
|
40
|
-
if err := json.Unmarshal(data, &config); err != nil {
|
|
41
|
-
return nil, fmt.Errorf("parsing config file: %w", err)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return &config, nil
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
func (c *Config) Save() error {
|
|
48
|
-
homeDir, err := os.UserHomeDir()
|
|
49
|
-
if err != nil {
|
|
50
|
-
return fmt.Errorf("getting home directory: %w", err)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
configDirPath := filepath.Join(homeDir, configDir)
|
|
54
|
-
if err := os.MkdirAll(configDirPath, 0o755); err != nil {
|
|
55
|
-
return fmt.Errorf("creating config directory: %w", err)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
configPath := filepath.Join(configDirPath, configFile)
|
|
59
|
-
|
|
60
|
-
data, err := json.MarshalIndent(c, "", " ")
|
|
61
|
-
if err != nil {
|
|
62
|
-
return fmt.Errorf("marshaling config: %w", err)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if err := os.WriteFile(configPath, data, 0o644); err != nil {
|
|
66
|
-
return fmt.Errorf("writing config file: %w", err)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return nil
|
|
70
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
package ui
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"fmt"
|
|
5
|
-
"io"
|
|
6
|
-
|
|
7
|
-
"github.com/rogeriopvl/fizzy/internal/api"
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
func DisplayBoard(w io.Writer, board *api.Board) error {
|
|
11
|
-
fmt.Fprintf(w, "Board: %s\n", board.Name)
|
|
12
|
-
fmt.Fprintf(w, "ID: %s\n", board.ID)
|
|
13
|
-
fmt.Fprintf(w, "All Access: %v\n", board.AllAccess)
|
|
14
|
-
fmt.Fprintf(w, "Created At: %s\n", FormatTime(board.CreatedAt))
|
|
15
|
-
fmt.Fprintf(w, "Created By: %s\n", board.Creator.Name)
|
|
16
|
-
return nil
|
|
17
|
-
}
|
package/internal/ui/card_list.go
DELETED
package/internal/ui/card_show.go
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
package ui
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"fmt"
|
|
5
|
-
"io"
|
|
6
|
-
|
|
7
|
-
"github.com/rogeriopvl/fizzy/internal/api"
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
func DisplayColumn(w io.Writer, column *api.Column) error {
|
|
11
|
-
fmt.Fprintf(w, "Column: %s\n", column.Name)
|
|
12
|
-
fmt.Fprintf(w, "ID: %s\n", column.ID)
|
|
13
|
-
fmt.Fprintf(w, "Color: %s (%s)\n", column.Color.Name, column.Color.Value)
|
|
14
|
-
fmt.Fprintf(w, "Created At: %s\n", FormatTime(column.CreatedAt))
|
|
15
|
-
return nil
|
|
16
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
package ui
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"fmt"
|
|
5
|
-
|
|
6
|
-
"github.com/rogeriopvl/fizzy/internal/api"
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
func DisplayComments(comments []api.Comment) error {
|
|
10
|
-
for _, comment := range comments {
|
|
11
|
-
fmt.Printf("%s - %s (%s)\n", comment.Creator.Name, comment.Body.PlainText, DisplayID(comment.ID))
|
|
12
|
-
}
|
|
13
|
-
return nil
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
func DisplayComment(comment *api.Comment) error {
|
|
17
|
-
fmt.Printf("Author: %s\n", comment.Creator.Name)
|
|
18
|
-
fmt.Printf("Created: %s\n", comment.CreatedAt)
|
|
19
|
-
if comment.UpdatedAt != comment.CreatedAt {
|
|
20
|
-
fmt.Printf("Updated: %s\n", comment.UpdatedAt)
|
|
21
|
-
}
|
|
22
|
-
fmt.Printf("Card: %s\n", comment.Card.Title)
|
|
23
|
-
fmt.Printf("\n%s\n", comment.Body.PlainText)
|
|
24
|
-
return nil
|
|
25
|
-
}
|
package/internal/ui/format.go
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
package ui
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"github.com/charmbracelet/lipgloss"
|
|
5
|
-
"time"
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
// DisplayMeta returns a formatted metadata string with greyed out styling
|
|
9
|
-
func DisplayMeta(label string, value string) string {
|
|
10
|
-
return lipgloss.NewStyle().
|
|
11
|
-
Foreground(lipgloss.Color("8")). // Grey color
|
|
12
|
-
Render(label + ": " + value)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
func DisplayID(id string) string {
|
|
16
|
-
return DisplayMeta("id", id)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// FormatTime converts an RFC3339 timestamp string to a human-readable format.
|
|
20
|
-
// If parsing fails, returns the original string.
|
|
21
|
-
func FormatTime(timeStr string) string {
|
|
22
|
-
t, err := time.Parse(time.RFC3339, timeStr)
|
|
23
|
-
if err != nil {
|
|
24
|
-
return timeStr
|
|
25
|
-
}
|
|
26
|
-
return t.Format("2006-01-02 15:04:05")
|
|
27
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
package ui
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"fmt"
|
|
5
|
-
|
|
6
|
-
"github.com/rogeriopvl/fizzy/internal/api"
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
func DisplayNotifications(notifications []api.Notification) error {
|
|
10
|
-
for _, notification := range notifications {
|
|
11
|
-
fmt.Printf("%s (%s)\n", notification.Title, DisplayID(notification.ID))
|
|
12
|
-
}
|
|
13
|
-
return nil
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
func DisplayNotification(notification *api.Notification) error {
|
|
17
|
-
status := "read"
|
|
18
|
-
if !notification.Read {
|
|
19
|
-
status = "unread"
|
|
20
|
-
}
|
|
21
|
-
fmt.Printf("%s (%s)\n", notification.Title, DisplayID(notification.ID))
|
|
22
|
-
fmt.Printf("Status: %s\n", status)
|
|
23
|
-
fmt.Printf("Card: %s\n", notification.Card.Title)
|
|
24
|
-
fmt.Printf("From: %s\n", notification.Creator.Name)
|
|
25
|
-
fmt.Printf("Message: %s\n", notification.Body)
|
|
26
|
-
return nil
|
|
27
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
package ui
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"fmt"
|
|
5
|
-
|
|
6
|
-
"github.com/rogeriopvl/fizzy/internal/api"
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
func DisplayReactions(reactions []api.Reaction) error {
|
|
10
|
-
for _, reaction := range reactions {
|
|
11
|
-
fmt.Printf("%s %s (%s)\n", reaction.Content, reaction.Reacter.Name, DisplayID(reaction.ID))
|
|
12
|
-
}
|
|
13
|
-
return nil
|
|
14
|
-
}
|
package/internal/ui/user_list.go
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
package ui
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"fmt"
|
|
5
|
-
"io"
|
|
6
|
-
|
|
7
|
-
"github.com/rogeriopvl/fizzy/internal/api"
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
func DisplayUsers(w io.Writer, users []api.User) error {
|
|
11
|
-
for _, user := range users {
|
|
12
|
-
status := "active"
|
|
13
|
-
if !user.Active {
|
|
14
|
-
status = "inactive"
|
|
15
|
-
}
|
|
16
|
-
fmt.Fprintf(w, "%s (%s) - %s [%s]\n", user.Name, user.Email, DisplayID(user.ID), status)
|
|
17
|
-
}
|
|
18
|
-
return nil
|
|
19
|
-
}
|
package/internal/ui/user_show.go
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
package ui
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"fmt"
|
|
5
|
-
"io"
|
|
6
|
-
|
|
7
|
-
"github.com/rogeriopvl/fizzy/internal/api"
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
func DisplayUser(w io.Writer, user *api.User) error {
|
|
11
|
-
status := "active"
|
|
12
|
-
if !user.Active {
|
|
13
|
-
status = "inactive"
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
fmt.Fprintf(w, "User: %s\n", user.Name)
|
|
17
|
-
fmt.Fprintf(w, "ID: %s\n", user.ID)
|
|
18
|
-
fmt.Fprintf(w, "Email: %s\n", user.Email)
|
|
19
|
-
fmt.Fprintf(w, "Role: %s\n", user.Role)
|
|
20
|
-
fmt.Fprintf(w, "Status: %s\n", status)
|
|
21
|
-
fmt.Fprintf(w, "Created At: %s\n", FormatTime(user.CreatedAt))
|
|
22
|
-
return nil
|
|
23
|
-
}
|