Matt Low
9c9b8fa412
Renamed initialize functions from `Initialize*` to `New*`, return an error from them instead of using Fatal.
33 lines
423 B
Go
33 lines
423 B
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
var config *Config
|
|
var store *Store
|
|
|
|
func init() {
|
|
var err error
|
|
|
|
config, err = NewConfig()
|
|
if err != nil {
|
|
Fatal("%v\n", err)
|
|
}
|
|
|
|
store, err = NewStore()
|
|
if err != nil {
|
|
Fatal("%v\n", err)
|
|
}
|
|
}
|
|
|
|
func Fatal(format string, args ...any) {
|
|
fmt.Fprintf(os.Stderr, format, args...)
|
|
os.Exit(1)
|
|
}
|
|
|
|
func Warn(format string, args ...any) {
|
|
fmt.Fprintf(os.Stderr, format, args...)
|
|
}
|