18 lines
269 B
Go
18 lines
269 B
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
// A helper function to handle errors in the program. If it is given an error,
|
|
// the program will exist, and print the error.
|
|
func HandleError(err error) {
|
|
if err == nil {
|
|
return
|
|
}
|
|
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(1)
|
|
}
|