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

@@ -102,16 +102,19 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
return err
}
}
if flagOrigin == "" {
if err := huh.NewInput().Title("Origin").Value(&flagOrigin).Run(); err != nil {
return err
}
}
if flagPath == "" {
if err := huh.NewInput().Title("Path").Value(&flagPath).Run(); err != nil {
return err
}
}
if flagDisplayName == "" {
if err := huh.NewInput().Title("Display name").Value(&flagDisplayName).Run(); err != nil {
return err
@@ -122,12 +125,15 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if flagResourceType == "" {
return fmt.Errorf("resource-type is required; pass --resource-type or run interactively")
}
if flagOrigin == "" {
return fmt.Errorf("origin is required; pass --origin or run interactively")
}
if flagPath == "" {
return fmt.Errorf("path is required; pass --path or run interactively")
}
if flagDisplayName == "" {
return fmt.Errorf("display-name is required; pass --display-name or run interactively")
}

View File

@@ -46,10 +46,12 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
if !f.IOStreams.IsInteractive() {
return fmt.Errorf("cannot delete tracker resource: confirmation required, use --yes to confirm")
}
var confirmed bool
if err := huh.NewConfirm().Title(fmt.Sprintf("Delete tracker resource %s?", args[0])).Value(&confirmed).Run(); err != nil {
return err
}
if !confirmed {
return nil
}

View File

@@ -113,12 +113,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 category %s not found", flagCategoryID)
}
if resp.Node.Typename != "CookieCategory" {
return nil, fmt.Errorf("expected CookieCategory node, got %s", resp.Node.Typename)
}
return &resp.Node.TrackerResources, nil
},
)
@@ -141,10 +144,12 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if r.Excluded {
excluded = "yes"
}
lastDetected := ""
if r.LastDetectedAt != nil {
lastDetected = cmdutil.FormatTime(*r.LastDetectedAt)
}
rows = append(rows, []string{r.ID, r.Type, r.Origin, r.Path, r.DisplayName, excluded, lastDetected})
}

View File

@@ -81,9 +81,11 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
if cmd.Flags().Changed("display-name") {
input["displayName"] = flagDisplayName
}
if cmd.Flags().Changed("description") {
input["description"] = flagDescription
}
if cmd.Flags().Changed("excluded") {
input["excluded"] = flagExcluded
}

View File

@@ -119,13 +119,16 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Type:"), v.Type)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Origin:"), v.Origin)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Path:"), v.Path)
_, _ = fmt.Fprintf(out, "%s%v\n", label.Render("Excluded:"), v.Excluded)
if v.Description != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Description:"), v.Description)
}
if v.LastDetectedAt != nil {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Last Detected:"), cmdutil.FormatTime(*v.LastDetectedAt))
}
_, _ = fmt.Fprintln(out)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Created:"), cmdutil.FormatTime(v.CreatedAt))
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Updated:"), cmdutil.FormatTime(v.UpdatedAt))