Skip to content

Add worker commands to the CLI#9

Merged
berggren merged 1 commit intomainfrom
worker-commands
Mar 23, 2026
Merged

Add worker commands to the CLI#9
berggren merged 1 commit intomainfrom
worker-commands

Conversation

@berggren
Copy link
Copy Markdown
Contributor

Summary

Implemented a new CLI command group and subcommand to list registered workers from the system API.

Technical Details:

  • Command Registration: Added newWorkersCmd to the root command structure in cmd/openrelik/internal/cli/cli.go, enabling workers as a top-level CLI category.
  • Worker Listing Logic: Created newListWorkersCmd in cmd/openrelik/internal/cli/workers.go. This command interacts with the worker service via client.Workers().Registered() to fetch worker metadata and uses formatAndPrint for output rendering.
  • API Integration: Configured the command to communicate with the /api/v1/taskqueue/tasks/registered endpoint.
  • Testing: Added cmd/openrelik/internal/cli/workers_test.go containing unit tests that mock the API server. These tests verify correct command execution, output parsing, and support for JSON formatting via the --output flag.

@berggren berggren requested a review from hacktobeer March 20, 2026 11:01
@berggren berggren merged commit c181336 into main Mar 23, 2026
3 checks passed
@berggren berggren deleted the worker-commands branch March 23, 2026 08:56
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.

2 participants