Skip to content

fix: plain output formatting across all command modules#19

Open
itsjeremyjohnson wants to merge 2 commits intomainfrom
fix/plain-output
Open

fix: plain output formatting across all command modules#19
itsjeremyjohnson wants to merge 2 commits intomainfrom
fix/plain-output

Conversation

@itsjeremyjohnson
Copy link
Copy Markdown
Collaborator

@itsjeremyjohnson itsjeremyjohnson commented Apr 6, 2026

Standardizes plain output formatting across all ClickUp CLI command modules and consolidates progress tracking.

Greptile Summary

This PR standardizes --plain output formatting across all 12 ClickUp CLI command modules by adding outfmt.IsPlain(ctx) / outfmt.WritePlain(os.Stdout, headers, rows) branches to every Run() method. The plain-output additions are well-structured and follow the project's stdout/stderr discipline from AGENTS.md.

However, two consistent defects are introduced:

  • --force vs --yes flag mismatch in all delete/remove warning messages — Every destructive command defines a flag named --yes (short -y) but prints "Use --force to confirm deletion." Any user or script following the on-screen prompt will receive a "flag provided but not defined: --force" error.
  • Inconsistent exit code when confirmation is skippedChatDeleteChannelCmd, ChatDeleteMessageCmd, CommentsDeleteCmd, and UsersRemoveCmd return nil (exit 0) when the user omits --yes, while every other delete command correctly returns a non-zero error. This makes scripted usage unreliable.

Confidence Score: 2/5

Not safe to merge — every delete/remove command displays an incorrect --force flag name; users following the on-screen prompt will receive a runtime flag error.

The plain-output additions are correct and well-structured, matching the project's AGENTS.md patterns. However, the --force vs --yes mismatch is a widespread usability defect that affects every destructive operation in the CLI and will block real users from confirming deletions. The additional inconsistency in exit codes (nil vs error) further complicates reliable scripted use.

All files containing Delete or Remove commands require warning message corrections: chat.go, checklists.go, comments.go, folders.go, goals.go, lists.go, spaces.go, tags.go, time.go, users.go, views.go, webhooks.go

Important Files Changed

Filename Overview
internal/cmd/chat.go Adds plain output for all 13 chat subcommands; --force flag name mismatch in both delete warning messages; ChatDeleteChannelCmd and ChatDeleteMessageCmd return nil (exit 0) on cancellation
internal/cmd/comments.go Adds plain output across all comment subcommands; --force mismatch in delete warning; CommentsDeleteCmd returns nil (exit 0) on cancellation instead of an error
internal/cmd/users.go Adds plain output for user management commands; --force mismatch in remove warning; UsersRemoveCmd returns nil (exit 0) on cancellation instead of an error
internal/cmd/checklists.go Adds plain output for all checklist operations; --force flag name mismatch in both delete warning messages
internal/cmd/goals.go Adds plain output for goals and key results; --force flag name mismatch in both delete warning messages
internal/cmd/time.go Adds plain output for all 13 time-tracking subcommands; --force flag name mismatch in TimeDeleteCmd warning
internal/cmd/views.go Adds plain output for view operations; --force flag name mismatch in ViewsDeleteCmd warning
internal/cmd/webhooks.go Adds plain output for webhook operations; --force flag name mismatch in WebhooksDeleteCmd warning
internal/cmd/folders.go Adds plain output for folder operations; --force flag name mismatch in FoldersDeleteCmd warning
internal/cmd/lists.go Adds plain output for list operations; --force flag name mismatch in ListsDeleteCmd warning
internal/cmd/spaces.go Adds plain output for space operations; --force flag name mismatch in SpacesDeleteCmd warning
internal/cmd/tags.go Adds plain output for tag operations; --force flag name mismatch in TagsDeleteCmd warning
cmd/clickup/main.go No meaningful changes; CLI entrypoint delegates to cmd.Execute() unchanged

Sequence Diagram

sequenceDiagram
    participant User as User (Terminal)
    participant Main as main.go
    participant Execute as cmd.Execute()
    participant Run as Cmd.Run(ctx)
    participant OutFmt as outfmt
    participant Stdout as stdout
    participant Stderr as stderr

    User->>Main: clickup <command> [--json|--plain]
    Main->>Execute: Execute(os.Args[1:])
    Execute->>Execute: Parse flags, build ctx with output mode
    Execute->>Run: Run(ctx)
    Run->>Run: Call ClickUp API
    alt --json flag
        Run->>OutFmt: IsJSON(ctx) → true
        Run->>OutFmt: WriteJSON(stdout, result)
        OutFmt->>Stdout: JSON payload
    else --plain flag
        Run->>OutFmt: IsPlain(ctx) → true
        Run->>OutFmt: WritePlain(stdout, headers, rows)
        OutFmt->>Stdout: Tab-separated rows
    else default (human-readable)
        Run->>Stderr: Status / progress messages
        Run->>Stdout: Formatted data
    end
    Run-->>Execute: nil / error
    Execute-->>Main: nil / error
    Main->>User: exit 0 / exit 1
Loading

Comments Outside Diff (1)

  1. internal/cmd/chat.go, line 319-324 (link)

    P0 --force flag referenced but --yes is the actual flag

    The warning tells users "Use --force to confirm deletion." but the struct field is Yes bool with name:"yes" short:"y". Running clickup chat delete-channel <id> --force will produce a "flag provided but not defined: --force" error at runtime. Users following the on-screen instruction will never be able to complete the deletion.

    The same mismatch exists in every other delete/remove command across the PR:

    • internal/cmd/chat.go:452-453 (ChatDeleteMessageCmd)
    • internal/cmd/checklists.go:108-109 (ChecklistsDeleteCmd) and checklists.go:256-257 (ChecklistsDeleteItemCmd)
    • internal/cmd/comments.go:117-118 (CommentsDeleteCmd)
    • internal/cmd/folders.go:142-143 (FoldersDeleteCmd)
    • internal/cmd/goals.go:337-338 (GoalsDeleteCmd) and goals.go:499-500 (GoalsDeleteKeyResultCmd)
    • internal/cmd/lists.go:305-307 (ListsDeleteCmd)
    • internal/cmd/spaces.go:242-243 (SpacesDeleteCmd)
    • internal/cmd/tags.go:204-205 (TagsDeleteCmd)
    • internal/cmd/time.go:472-473 (TimeDeleteCmd)
    • internal/cmd/users.go:148-149 (UsersRemoveCmd)
    • internal/cmd/views.go:355-356 (ViewsDeleteCmd)
    • internal/cmd/webhooks.go:181-182 (WebhooksDeleteCmd)

    All warning messages should reference --yes to match the defined flag:

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: internal/cmd/chat.go
    Line: 319-324
    
    Comment:
    **`--force` flag referenced but `--yes` is the actual flag**
    
    The warning tells users `"Use --force to confirm deletion."` but the struct field is `Yes bool` with `name:"yes" short:"y"`. Running `clickup chat delete-channel <id> --force` will produce a **"flag provided but not defined: --force"** error at runtime. Users following the on-screen instruction will never be able to complete the deletion.
    
    The same mismatch exists in every other delete/remove command across the PR:
    - `internal/cmd/chat.go:452-453` (`ChatDeleteMessageCmd`)
    - `internal/cmd/checklists.go:108-109` (`ChecklistsDeleteCmd`) and `checklists.go:256-257` (`ChecklistsDeleteItemCmd`)
    - `internal/cmd/comments.go:117-118` (`CommentsDeleteCmd`)
    - `internal/cmd/folders.go:142-143` (`FoldersDeleteCmd`)
    - `internal/cmd/goals.go:337-338` (`GoalsDeleteCmd`) and `goals.go:499-500` (`GoalsDeleteKeyResultCmd`)
    - `internal/cmd/lists.go:305-307` (`ListsDeleteCmd`)
    - `internal/cmd/spaces.go:242-243` (`SpacesDeleteCmd`)
    - `internal/cmd/tags.go:204-205` (`TagsDeleteCmd`)
    - `internal/cmd/time.go:472-473` (`TimeDeleteCmd`)
    - `internal/cmd/users.go:148-149` (`UsersRemoveCmd`)
    - `internal/cmd/views.go:355-356` (`ViewsDeleteCmd`)
    - `internal/cmd/webhooks.go:181-182` (`WebhooksDeleteCmd`)
    
    All warning messages should reference `--yes` to match the defined flag:
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.

    Fix in Codex Fix in Claude Code

Fix All in Codex Fix All in Claude Code

Prompt To Fix All With AI
This is a comment left during a code review.
Path: internal/cmd/chat.go
Line: 319-324

Comment:
**`--force` flag referenced but `--yes` is the actual flag**

The warning tells users `"Use --force to confirm deletion."` but the struct field is `Yes bool` with `name:"yes" short:"y"`. Running `clickup chat delete-channel <id> --force` will produce a **"flag provided but not defined: --force"** error at runtime. Users following the on-screen instruction will never be able to complete the deletion.

The same mismatch exists in every other delete/remove command across the PR:
- `internal/cmd/chat.go:452-453` (`ChatDeleteMessageCmd`)
- `internal/cmd/checklists.go:108-109` (`ChecklistsDeleteCmd`) and `checklists.go:256-257` (`ChecklistsDeleteItemCmd`)
- `internal/cmd/comments.go:117-118` (`CommentsDeleteCmd`)
- `internal/cmd/folders.go:142-143` (`FoldersDeleteCmd`)
- `internal/cmd/goals.go:337-338` (`GoalsDeleteCmd`) and `goals.go:499-500` (`GoalsDeleteKeyResultCmd`)
- `internal/cmd/lists.go:305-307` (`ListsDeleteCmd`)
- `internal/cmd/spaces.go:242-243` (`SpacesDeleteCmd`)
- `internal/cmd/tags.go:204-205` (`TagsDeleteCmd`)
- `internal/cmd/time.go:472-473` (`TimeDeleteCmd`)
- `internal/cmd/users.go:148-149` (`UsersRemoveCmd`)
- `internal/cmd/views.go:355-356` (`ViewsDeleteCmd`)
- `internal/cmd/webhooks.go:181-182` (`WebhooksDeleteCmd`)

All warning messages should reference `--yes` to match the defined flag:

```suggestion
	if !cmd.Yes {
		fmt.Fprintf(os.Stderr, "Warning: This will delete channel %s and all its messages.\n", cmd.ChannelID)
		fmt.Fprint(os.Stderr, "Use --yes to confirm deletion.\n")

		return nil
	}
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: internal/cmd/comments.go
Line: 116-119

Comment:
**Inconsistent exit code when confirmation is skipped**

`CommentsDeleteCmd` returns `nil` (exit 0) when the user hasn't supplied `--yes`, which is indistinguishable from a successful deletion. Every other delete command introduced in this PR — `ChecklistsDeleteCmd`, `GoalsDeleteCmd`, `TagsDeleteCmd`, `TimeDeleteCmd`, `ViewsDeleteCmd`, `WebhooksDeleteCmd` — returns `fmt.Errorf("operation cancelled: use --force to confirm")` (exit 1). The same `return nil` pattern also appears in `internal/cmd/chat.go:324` (`ChatDeleteChannelCmd`), `chat.go:454` (`ChatDeleteMessageCmd`), and `internal/cmd/users.go:151` (`UsersRemoveCmd`).

Scripts that check exit codes to detect skipped deletions will silently miss the cancellation for these four commands.

```suggestion
	if !cmd.Yes {
		fmt.Fprintf(os.Stderr, "Warning: This will permanently delete comment %s\n", cmd.CommentID)
		fmt.Fprint(os.Stderr, "Use --yes to confirm deletion\n")

		return fmt.Errorf("operation cancelled: use --yes to confirm")
	}
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "chore: update build prompt and consolida..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Test User and others added 2 commits April 5, 2026 23:14
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Comment thread internal/cmd/comments.go
Comment on lines +116 to 119
if !cmd.Yes {
fmt.Fprintf(os.Stderr, "Warning: This will permanently delete comment %s\n", cmd.CommentID)
fmt.Fprint(os.Stderr, "Use --force to confirm deletion\n")
return nil
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Inconsistent exit code when confirmation is skipped

CommentsDeleteCmd returns nil (exit 0) when the user hasn't supplied --yes, which is indistinguishable from a successful deletion. Every other delete command introduced in this PR — ChecklistsDeleteCmd, GoalsDeleteCmd, TagsDeleteCmd, TimeDeleteCmd, ViewsDeleteCmd, WebhooksDeleteCmd — returns fmt.Errorf("operation cancelled: use --force to confirm") (exit 1). The same return nil pattern also appears in internal/cmd/chat.go:324 (ChatDeleteChannelCmd), chat.go:454 (ChatDeleteMessageCmd), and internal/cmd/users.go:151 (UsersRemoveCmd).

Scripts that check exit codes to detect skipped deletions will silently miss the cancellation for these four commands.

Suggested change
if !cmd.Yes {
fmt.Fprintf(os.Stderr, "Warning: This will permanently delete comment %s\n", cmd.CommentID)
fmt.Fprint(os.Stderr, "Use --force to confirm deletion\n")
return nil
if !cmd.Yes {
fmt.Fprintf(os.Stderr, "Warning: This will permanently delete comment %s\n", cmd.CommentID)
fmt.Fprint(os.Stderr, "Use --yes to confirm deletion\n")
return fmt.Errorf("operation cancelled: use --yes to confirm")
}
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/cmd/comments.go
Line: 116-119

Comment:
**Inconsistent exit code when confirmation is skipped**

`CommentsDeleteCmd` returns `nil` (exit 0) when the user hasn't supplied `--yes`, which is indistinguishable from a successful deletion. Every other delete command introduced in this PR — `ChecklistsDeleteCmd`, `GoalsDeleteCmd`, `TagsDeleteCmd`, `TimeDeleteCmd`, `ViewsDeleteCmd`, `WebhooksDeleteCmd` — returns `fmt.Errorf("operation cancelled: use --force to confirm")` (exit 1). The same `return nil` pattern also appears in `internal/cmd/chat.go:324` (`ChatDeleteChannelCmd`), `chat.go:454` (`ChatDeleteMessageCmd`), and `internal/cmd/users.go:151` (`UsersRemoveCmd`).

Scripts that check exit codes to detect skipped deletions will silently miss the cancellation for these four commands.

```suggestion
	if !cmd.Yes {
		fmt.Fprintf(os.Stderr, "Warning: This will permanently delete comment %s\n", cmd.CommentID)
		fmt.Fprint(os.Stderr, "Use --yes to confirm deletion\n")

		return fmt.Errorf("operation cancelled: use --yes to confirm")
	}
```

How can I resolve this? If you propose a fix, please make it concise.

Fix in Codex Fix in Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant