Skip to content

Add --format flag support to rt commands#3456

Merged
ehl-jf merged 3 commits into
masterfrom
JGC-478-format-flag
May 12, 2026
Merged

Add --format flag support to rt commands#3456
ehl-jf merged 3 commits into
masterfrom
JGC-478-format-flag

Conversation

@ehl-jf
Copy link
Copy Markdown
Contributor

@ehl-jf ehl-jf commented Apr 28, 2026

Summary

Adds --format flag support to several rt commands so their output can be machine-consumed (JSON) and, where useful, rendered as a summary table. Behavior without --format is unchanged.

Commands now accepting --format:

Command Accepted values
rt permission-target-create (ptc) json
rt permission-target-update (ptu) json
rt users-create (uc) json
rt transfer-config json
rt transfer-config-merge json, table
rt transfer-files json, table

Implementation notes:

  • permission-target-create / permission-target-update: switched from TemplateConsumer flag set to dedicated PermissionTargetCreate / PermissionTargetUpdate keys so the new --format flag is actually wired in (fix in commit 946c0320).
  • For commands whose underlying client layer discards the response body, a synthetic {"status_code":200,"message":"OK"} payload is emitted via cliutils.FormatHTTPResponseJSON on success.
  • transfer-config-merge and transfer-files get richer structured output: a transferConfigMergeResult / transferFilesResult struct rendered as either JSON or a tabwriter summary table.
  • New flag entries (permission-target-create-format, permission-target-update-format, transfer-config-format, transfer-config-merge-format, transfer-files-format, users-create-format) registered in utils/cliutils/commandsflags.go.

Tests:

  • artifactory/cli_test.go: +509 lines covering format parsing, JSON/table rendering, error propagation, and unsupported-format handling for the affected commands.

Dependencies:

  • Bumps jfrog-cli-artifactory to 0.8.1-0.20260512080921-ec417dc1b7ee.
  • Bumps jfrog-client-go to 1.55.1-0.20260508101905-a17af78a38d7.

Files changed: artifactory/cli.go, artifactory/cli_test.go, utils/cliutils/commandsflags.go, go.mod, go.sum.


  • All tests have passed. If this feature is not already covered by the tests, new tests have been added.
  • The pull request is targeting the master branch.
  • The code has been validated to compile successfully by running go vet ./....
  • The code has been formatted properly using go fmt ./....

@ehl-jf ehl-jf force-pushed the JGC-478-format-flag branch from 2d65caf to 6395942 Compare April 28, 2026 14:48
Comment thread go.mod Outdated
@ehl-jf ehl-jf force-pushed the JGC-471-format-support branch 9 times, most recently from fe21cb8 to 5af9d26 Compare April 30, 2026 14:26
Base automatically changed from JGC-471-format-support to master April 30, 2026 15:10
@ehl-jf ehl-jf force-pushed the JGC-478-format-flag branch from f8e42c5 to 0c88add Compare May 4, 2026 06:42
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@ehl-jf ehl-jf added the safe to test Approve running integration tests on a pull request label May 4, 2026
@ehl-jf ehl-jf force-pushed the JGC-478-format-flag branch from 0c88add to b75c5ac Compare May 4, 2026 07:17
@ehl-jf ehl-jf added safe to test Approve running integration tests on a pull request and removed safe to test Approve running integration tests on a pull request labels May 12, 2026
@ehl-jf ehl-jf merged commit 35ede4e into master May 12, 2026
86 of 88 checks passed
@ehl-jf ehl-jf deleted the JGC-478-format-flag branch May 12, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Approve running integration tests on a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants