1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-12 04:23:03 +02:00
lazygit/pkg/config/dummies.go
2020-09-29 20:48:49 +10:00

27 lines
588 B
Go

package config
import (
"github.com/spf13/viper"
yaml "gopkg.in/yaml.v2"
)
// NewDummyAppConfig creates a new dummy AppConfig for testing
func NewDummyAppConfig() *AppConfig {
userConfig := viper.New()
userConfig.SetConfigType("yaml")
if err := LoadDefaults(userConfig, GetDefaultConfig()); err != nil {
panic(err)
}
appConfig := &AppConfig{
Name: "lazygit",
Version: "unversioned",
Commit: "",
BuildDate: "",
Debug: false,
BuildSource: "",
UserConfig: userConfig,
}
_ = yaml.Unmarshal([]byte{}, appConfig.AppState)
return appConfig
}