Add wsl linter and fix

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-05-19 14:51:08 +04:00
parent eedfdcecc8
commit 9156d6a16a
882 changed files with 6068 additions and 574 deletions

View File

@@ -105,12 +105,15 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if cmd.Flags().Changed("action") {
filter["action"] = flagAction
}
if cmd.Flags().Changed("visitor-id") {
filter["visitorId"] = flagVisitorID
}
if cmd.Flags().Changed("version") {
filter["version"] = flagVersion
}
if len(filter) > 0 {
variables["filter"] = filter
}
@@ -130,12 +133,15 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := json.Unmarshal(data, &resp); err != nil {
return nil, err
}
if resp.Node == nil {
return nil, fmt.Errorf("cookie banner %s not found", flagBannerID)
}
if resp.Node.Typename != "CookieBanner" {
return nil, fmt.Errorf("expected CookieBanner node, got %s", resp.Node.Typename)
}
return &resp.Node.ConsentRecords, nil
},
)
@@ -158,10 +164,12 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if r.Regulation != nil {
regulation = *r.Regulation
}
countryCode := "-"
if r.CountryCode != nil {
countryCode = *r.CountryCode
}
rows = append(rows, []string{r.ID, r.VisitorID, r.Action, r.SDKVersion, regulation, countryCode, r.CreatedAt})
}

View File

@@ -118,19 +118,24 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("ID:"), v.ID)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Visitor ID:"), v.VisitorID)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Action:"), v.Action)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("SDK Version:"), v.SdkVersion)
if v.Regulation != nil {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Regulation:"), *v.Regulation)
}
if v.CountryCode != nil {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Country Code:"), *v.CountryCode)
}
if v.IPAddress != nil && *v.IPAddress != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("IP Address:"), *v.IPAddress)
}
if v.UserAgent != nil && *v.UserAgent != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("User Agent:"), *v.UserAgent)
}
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Consent Data:"), v.ConsentData)
_, _ = fmt.Fprintln(out)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Created:"), cmdutil.FormatTime(v.CreatedAt))