package main import ( "fmt" "github.com/adlio/trello" "github.com/rs/zerolog/log" "github.com/urfave/cli/v2" ) func unassignCards(cCtx *cli.Context) error { client := getTrelloClient() board, err := client.GetBoard(trelloBordID, trello.Defaults()) if err != nil { return fmt.Errorf("cant get bord: %w", err) } log.Debug().Interface("bord", board).Msg("get bord") me, err := client.GetMyMember(trello.Defaults()) if err != nil { return fmt.Errorf("cant get member: %w", err) } log.Debug().Str("name", me.FullName).Str("id", me.ID).Interface("me", me).Msg("Got User") cards, err := board.GetCards(trello.Defaults()) if err != nil { return fmt.Errorf("cant get cards from board: %w", err) } for _, card := range cards { if len(card.IDMembers) > 0 { continue } log.Debug().Interface("card", card).Msg("Add Member to card") _, err = card.AddMemberID(me.ID) if err != nil { return fmt.Errorf("cant add member to card: %w", err) } } return nil }