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

cli: add a default range for object hash to cli help #2984

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cmd/neofs-cli/modules/object/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"strings"

internalclient "github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/client"
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/common"
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/commonflags"
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/key"
"github.com/nspcc-dev/neofs-sdk-go/checksum"
Expand Down Expand Up @@ -42,7 +43,7 @@
flags.String(commonflags.OIDFlag, "", commonflags.OIDFlagUsage)
_ = objectHashCmd.MarkFlagRequired(commonflags.OIDFlag)

flags.String("range", "", "Range to take hash from in the form offset1:length1,...")
flags.String("range", "", "Range to take hash from in the form offset1:length1,... Full object payload length if not specified")

Check warning on line 46 in cmd/neofs-cli/modules/object/hash.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-cli/modules/object/hash.go#L46

Added line #L46 was not covered by tests
carpawell marked this conversation as resolved.
Show resolved Hide resolved
flags.String("type", hashSha256, "Hash type. Either 'sha256' or 'tz'")
flags.String(getRangeHashSaltFlag, "", "Salt in hex format")
}
Expand Down Expand Up @@ -87,6 +88,7 @@
tz := typ == hashTz
fullHash := len(ranges) == 0
if fullHash {
common.PrintVerbose(cmd, "Get the hash of the full object payload.")

Check warning on line 91 in cmd/neofs-cli/modules/object/hash.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-cli/modules/object/hash.go#L91

Added line #L91 was not covered by tests
var headPrm internalclient.HeadObjectPrm
headPrm.SetPrivateKey(*pk)
headPrm.SetClient(cli)
Expand Down
Loading