Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add --output-stream(-o), --no-api-output(-n) option #8

Merged
merged 1 commit into from
May 20, 2024
Merged

Conversation

fujiwara
Copy link
Owner

--output-stream option

--output-stream (-o) option allows you to bind the io.ReadCloser of the API output to a file or stdout.

$ aws-sdk-client-go s3 get-object '{"Bucket": "my-bucket", "Key": "my.txt"}' --output-stream my.txt

s3#GetObjectOutput has Body field of io.ReadeCloser. --output-stream option binds the file to the field.

When the output struct has only one field of io.ReadCloser, aws-sdk-client-go copies it to the file automatically. (Currently, all SDK output structs have at most one io.ReadCloser field.)

If --output-stream is "-", aws-sdk-client-go writes into stdout. The result of the API also writes to stdout by default. If you don't want to output the result, use --no-api-output (-n).

@fujiwara fujiwara merged commit 4bbdf36 into main May 20, 2024
4 checks passed
@fujiwara fujiwara deleted the output-stream branch May 20, 2024 07:44
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