Skip to content

feat: added Head command - #730

Merged
ilkinulas merged 15 commits into
peak:masterfrom
4o4x:head-feature
Jul 26, 2024
Merged

ilkinulas merged 15 commits into
peak:masterfrom
4o4x:head-feature

Conversation

@4o4x

@4o4x 4o4x commented Jul 3, 2024

Copy link
Copy Markdown
Contributor

This pull request adds the head command to the program. Closes #682.

The head command is designed to check if a file exists without downloading the object or bucket itself. It retrieves metadata from an object without returning the object itself. This operation is useful for users who are only interested in an object's metadata.

  • Implemented the head command functionality.
  • Added end-point tests to ensure the correctness of the head command implementation.

Usage:

Check if a bucket exists

s5cmd head s3://bucket-name

Check if a file exists and retrieve its metadata

s5cmd head s3://bucket-name/object

@4o4x
4o4x requested review from a team, igungor and seruman and removed request for a team July 3, 2024 15:18
@4o4x 4o4x changed the title Head feature feat: added Head command Jul 4, 2024

@seruman seruman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

besides the review comments, there're left over comments -mostly in tests-, could please take another look at them.

Comment thread command/head.go Outdated
Comment thread command/head.go Outdated
Comment thread command/head.go Outdated
Comment thread command/head.go Outdated
Comment thread command/head.go Outdated
Comment thread e2e/run_test.go Outdated
Comment thread e2e/head_test.go Outdated
Comment thread e2e/head_test.go Outdated
Comment thread command/head.go Outdated
Comment thread e2e/head_test.go Outdated
Comment thread storage/s3.go Outdated
Comment thread storage/s3.go Outdated
Comment thread command/head.go Outdated
Comment thread e2e/head_test.go Outdated
Comment thread e2e/head_test.go Outdated
Comment thread e2e/head_test.go Outdated
Comment thread e2e/head_test.go Outdated
Comment thread storage/s3.go
Comment thread storage/s3_test.go Outdated
Comment thread storage/url/url.go
Comment thread command/head.go Outdated
Comment thread command/head.go Outdated
Comment thread command/head.go Outdated
Comment thread command/head.go
Comment thread command/app.go
Comment thread command/head.go
Comment thread command/head.go
Comment thread command/head.go Outdated
Comment thread storage/url/url.go
Comment thread storage/s3.go
Comment thread command/head.go Outdated
Comment thread command/head.go
Comment thread command/head.go Outdated
Comment thread command/head.go Outdated
Comment thread command/head.go Outdated
Comment thread e2e/head_test.go Outdated
Comment thread README.md Outdated
Comment thread command/head.go Outdated
4o4x added 10 commits July 16, 2024 19:38
Enhancements to `head` command and bug fixes

- Added `version-id` and `raw` flags to the `head` command
- Fixed issue with metadata printing
- Added new tests
The code change corrects a typo in the storage class value in the S3 storage module. The variable `storageClassStr` was misspelled as "STANDART" instead of "STANDARD". This commit fixes the typo to ensure the correct storage class value is used.

Note: This suggested commit message follows the convention observed in the recent repository commits.
Support for displaying metadata in the command output.
The regex in the expected output of the head_test.go file has been updated to account for different orderings of key-value pairs in the metadata. This change ensures that the test passes regardless of the order in which the key-value pairs are printed.
seruman
seruman previously approved these changes Jul 17, 2024
@4o4x

4o4x commented Jul 23, 2024

Copy link
Copy Markdown
Contributor Author

Hello, we have decided with @ilkinulas that all outputs should be in JSON format, so some parts have been changed in this PR. I would really appreciate it if you could review it again.

The code change removes the unused code that was setting the relative path in the `Run` method of the `Head` struct.
Comment thread command/head.go Outdated
Comment thread command/head.go Outdated
Comment thread command/head.go Outdated
Comment thread command/head.go
@ilkinulas
ilkinulas merged commit b5e5143 into peak:master Jul 26, 2024
@tooptoop4

Copy link
Copy Markdown

very interested in this. when is next release @ilkinulas @igungor @seruman ?

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.

Feature request - Check if file exists without ls or downloading the entire object

6 participants