forked from TrueCloudLab/frostfs-node
[#1233] neofs-cli: Do not print info if output format is strict
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
5eef0f46c5
commit
800d01e28c
1 changed files with 10 additions and 2 deletions
|
@ -559,15 +559,17 @@ func getObject(cmd *cobra.Command, _ []string) {
|
||||||
exitOnErr(cmd, errf("rpc error: %w", err))
|
exitOnErr(cmd, errf("rpc error: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hdrFile := cmd.Flag("header").Value.String()
|
||||||
if filename != "" {
|
if filename != "" {
|
||||||
if p != nil {
|
if p != nil {
|
||||||
p.Finish()
|
p.Finish()
|
||||||
}
|
}
|
||||||
|
if hdrFile != "" || !strictOutput(cmd) {
|
||||||
cmd.Printf("[%s] Object successfully saved\n", filename)
|
cmd.Printf("[%s] Object successfully saved\n", filename)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Print header only if file is not streamed to stdout.
|
// Print header only if file is not streamed to stdout.
|
||||||
hdrFile := cmd.Flag("header").Value.String()
|
|
||||||
if filename != "" || hdrFile != "" {
|
if filename != "" || hdrFile != "" {
|
||||||
err = saveAndPrintHeader(cmd, res.Header(), hdrFile)
|
err = saveAndPrintHeader(cmd, res.Header(), hdrFile)
|
||||||
exitOnErr(cmd, err)
|
exitOnErr(cmd, err)
|
||||||
|
@ -1002,6 +1004,12 @@ func printSplitHeader(cmd *cobra.Command, obj *object.Object) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func strictOutput(cmd *cobra.Command) bool {
|
||||||
|
toJSON, _ := cmd.Flags().GetBool("json")
|
||||||
|
toProto, _ := cmd.Flags().GetBool("proto")
|
||||||
|
return toJSON || toProto
|
||||||
|
}
|
||||||
|
|
||||||
func marshalHeader(cmd *cobra.Command, hdr *object.Object) ([]byte, error) {
|
func marshalHeader(cmd *cobra.Command, hdr *object.Object) ([]byte, error) {
|
||||||
toJSON, _ := cmd.Flags().GetBool("json")
|
toJSON, _ := cmd.Flags().GetBool("json")
|
||||||
toProto, _ := cmd.Flags().GetBool("proto")
|
toProto, _ := cmd.Flags().GetBool("proto")
|
||||||
|
|
Loading…
Reference in a new issue