Complete inbox CLI implementation
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package inbox
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func resolveBodyValue(body, bodyFile string) (string, error) {
|
||||
if body != "" && bodyFile != "" {
|
||||
return "", fmt.Errorf("body and body-file are mutually exclusive")
|
||||
}
|
||||
if bodyFile == "" {
|
||||
return body, nil
|
||||
}
|
||||
|
||||
content, err := os.ReadFile(bodyFile)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("read body file %q: %w", bodyFile, err)
|
||||
}
|
||||
return string(content), nil
|
||||
}
|
||||
Reference in New Issue
Block a user