forked from TrueCloudLab/frostfs-node
[#1962] cli: common.PrintVerbose
prints via cobra.Command.Printf
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com> Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
cff4184cd3
commit
8ee590794f
24 changed files with 116 additions and 134 deletions
|
@ -36,22 +36,22 @@ func parseContainerID(cmd *cobra.Command) cid.ID {
|
|||
// decodes session.Container from the file by path provided in
|
||||
// commonflags.SessionToken flag. Returns nil if the path is not specified.
|
||||
func getSession(cmd *cobra.Command) *session.Container {
|
||||
common.PrintVerbose("Reading container session...")
|
||||
common.PrintVerbose(cmd, "Reading container session...")
|
||||
|
||||
path, _ := cmd.Flags().GetString(commonflags.SessionToken)
|
||||
if path == "" {
|
||||
common.PrintVerbose("Session not provided.")
|
||||
common.PrintVerbose(cmd, "Session not provided.")
|
||||
return nil
|
||||
}
|
||||
|
||||
common.PrintVerbose("Reading container session from the file [%s]...", path)
|
||||
common.PrintVerbose(cmd, "Reading container session from the file [%s]...", path)
|
||||
|
||||
var res session.Container
|
||||
|
||||
err := common.ReadBinaryOrJSON(&res, path)
|
||||
err := common.ReadBinaryOrJSON(cmd, &res, path)
|
||||
common.ExitOnErr(cmd, "read container session: %v", err)
|
||||
|
||||
common.PrintVerbose("Session successfully read.")
|
||||
common.PrintVerbose(cmd, "Session successfully read.")
|
||||
|
||||
return &res
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue