relax some argument issues to warnings

This commit is contained in:
Josh Humphries 2018-03-08 10:34:04 -05:00
parent b021950067
commit 798732dd45
1 changed files with 8 additions and 3 deletions

View File

@ -169,10 +169,10 @@ func main() {
args = args[1:] args = args[1:]
} else { } else {
if *data != "" { if *data != "" {
fail(nil, "The -d argument is not used with 'list' or 'describe' verb.") warn("The -d argument is not used with 'list' or 'describe' verb.")
} }
if len(rpcHeaders) > 0 { if len(rpcHeaders) > 0 {
fail(nil, "The -rpc-header argument is not used with 'list' or 'describe' verb.") warn("The -rpc-header argument is not used with 'list' or 'describe' verb.")
} }
if len(args) > 0 { if len(args) > 0 {
symbol = args[0] symbol = args[0]
@ -190,7 +190,7 @@ func main() {
fail(nil, "No host:port specified and no protoset specified.") fail(nil, "No host:port specified and no protoset specified.")
} }
if len(protoset) > 0 && len(reflHeaders) > 0 { if len(protoset) > 0 && len(reflHeaders) > 0 {
fail(nil, "The -reflect-header argument is not used when -protoset files are used ") warn("The -reflect-header argument is not used when -protoset files are used ")
} }
ctx := context.Background() ctx := context.Background()
@ -419,6 +419,11 @@ the method's request type will be sent.
} }
func warn(msg string, args ...interface{}) {
msg = fmt.Sprintf("Warning: %s\n", msg)
fmt.Fprintf(os.Stderr, msg, args...)
}
func fail(err error, msg string, args ...interface{}) { func fail(err error, msg string, args ...interface{}) {
if err != nil { if err != nil {
msg += ": %v" msg += ": %v"