github.com/mutagen-io/mutagen@v0.18.0-rc1/cmd/error.go (about)

     1  package cmd
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  
     7  	"github.com/fatih/color"
     8  )
     9  
    10  // Warning prints a warning message to standard error.
    11  func Warning(message string) {
    12  	fmt.Fprintln(color.Error, color.YellowString("Warning:"), message)
    13  }
    14  
    15  // Error prints an error message to standard error.
    16  func Error(err error) {
    17  	fmt.Fprintln(os.Stderr, "Error:", err)
    18  }
    19  
    20  // Fatal prints an error message to standard error and then terminates the
    21  // process with an error exit code.
    22  func Fatal(err error) {
    23  	Error(err)
    24  	os.Exit(1)
    25  }