Skip to content

save: add --quiet/-q to suppress progress output#5064

Open
s3onghyun wants to merge 1 commit into
containerd:mainfrom
s3onghyun:save-quiet-flag-v2
Open

save: add --quiet/-q to suppress progress output#5064
s3onghyun wants to merge 1 commit into
containerd:mainfrom
s3onghyun:save-quiet-flag-v2

Conversation

@s3onghyun

Copy link
Copy Markdown

Fixes #4958.

Re-opening #5054, which I accidentally closed with a force-push. This is the same single squashed commit (expect.ExitCodeSuccess review suggestion from @sathiraumesh already applied). Thanks @AkihiroSuda.

nerdctl save always writes a progress bar to stderr, which clutters logs when it is used in scripts and CI. This adds a --quiet/-q flag that suppresses the progress output.

The implementation mirrors the existing --quiet flag on nerdctl load: the flag is threaded into ImageSaveOptions.Quiet, and when set, the transfer progress handler writes to io.Discard instead of os.Stderr. The archive itself is written exactly as before; only the progress output is suppressed.

  • cmd/nerdctl/image/image_save.go: register -q, --quiet and pass it into the options
  • pkg/api/types/image_types.go: add Quiet to ImageSaveOptions
  • pkg/cmd/image/save.go: route progress to io.Discard when quiet
  • docs/command-reference.md: document the flag
  • cmd/nerdctl/image/image_save_test.go: add TestSaveQuiet verifying the archive is still produced correctly with --quiet

Manual check: nerdctl save --help now lists -q, --quiet Suppress the progress output.

Signed-off-by: s3onghyun <s3onghyun@users.noreply.github.com>
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.

nerdctl save --quiet and/or --progress plain

1 participant