[#1259] neofs-cli: Use more cmd.PrintErr*()
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
44138adacf
commit
c8b585b991
1 changed files with 8 additions and 8 deletions
|
@ -68,19 +68,19 @@ func createEACL(cmd *cobra.Command, _ []string) {
|
||||||
|
|
||||||
containerID := cid.New()
|
containerID := cid.New()
|
||||||
if err := containerID.Parse(cidArg); err != nil {
|
if err := containerID.Parse(cidArg); err != nil {
|
||||||
cmd.Printf("invalid container ID: %v\n", err)
|
cmd.PrintErrf("invalid container ID: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
rulesFile, err := getRulesFromFile(fileArg)
|
rulesFile, err := getRulesFromFile(fileArg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cmd.Printf("can't read rules from file: %v\n", err)
|
cmd.PrintErrf("can't read rules from file: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
rules = append(rules, rulesFile...)
|
rules = append(rules, rulesFile...)
|
||||||
if len(rules) == 0 {
|
if len(rules) == 0 {
|
||||||
cmd.Println("no extended ACL rules has been provided")
|
cmd.PrintErrln("no extended ACL rules has been provided")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,13 +89,13 @@ func createEACL(cmd *cobra.Command, _ []string) {
|
||||||
for _, ruleStr := range rules {
|
for _, ruleStr := range rules {
|
||||||
r, err := shlex.Split(ruleStr)
|
r, err := shlex.Split(ruleStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cmd.Printf("can't parse rule '%s': %v\n", ruleStr, err)
|
cmd.PrintErrf("can't parse rule '%s': %v\n", ruleStr, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = parseTable(tb, r)
|
err = parseTable(tb, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cmd.Printf("can't create extended ACL record from rule '%s': %v\n", ruleStr, err)
|
cmd.PrintErrf("can't create extended ACL record from rule '%s': %v\n", ruleStr, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,14 +104,14 @@ func createEACL(cmd *cobra.Command, _ []string) {
|
||||||
|
|
||||||
data, err := tb.MarshalJSON()
|
data, err := tb.MarshalJSON()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cmd.Println(err)
|
cmd.PrintErrln(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
err = json.Indent(buf, data, "", " ")
|
err = json.Indent(buf, data, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cmd.Println(err)
|
cmd.PrintErrln(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ func createEACL(cmd *cobra.Command, _ []string) {
|
||||||
|
|
||||||
err = ioutil.WriteFile(outArg, buf.Bytes(), 0644)
|
err = ioutil.WriteFile(outArg, buf.Bytes(), 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cmd.Println(err)
|
cmd.PrintErrln(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue