1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-03 13:21:56 +02:00

Don't set platform defaults on OSConfig struct immediately

Instead, query the platform defaults only if the config is empty. This will be
necessary later to distinguish an empty config from a default config, so that we
can give deprecation warnings.
This commit is contained in:
Stefan Haller 2023-03-29 11:42:37 +02:00
parent 08d679c3a8
commit b7e029adc7
2 changed files with 7 additions and 1 deletions

View File

@ -79,6 +79,9 @@ func FileType(path string) string {
func (c *OSCommand) OpenFile(filename string) error { func (c *OSCommand) OpenFile(filename string) error {
commandTemplate := c.UserConfig.OS.OpenCommand commandTemplate := c.UserConfig.OS.OpenCommand
if commandTemplate == "" {
commandTemplate = config.GetPlatformDefaultConfig().OpenCommand
}
templateValues := map[string]string{ templateValues := map[string]string{
"filename": c.Quote(filename), "filename": c.Quote(filename),
} }
@ -88,6 +91,9 @@ func (c *OSCommand) OpenFile(filename string) error {
func (c *OSCommand) OpenLink(link string) error { func (c *OSCommand) OpenLink(link string) error {
commandTemplate := c.UserConfig.OS.OpenLinkCommand commandTemplate := c.UserConfig.OS.OpenLinkCommand
if commandTemplate == "" {
commandTemplate = config.GetPlatformDefaultConfig().OpenLinkCommand
}
templateValues := map[string]string{ templateValues := map[string]string{
"link": c.Quote(link), "link": c.Quote(link),
} }

View File

@ -599,7 +599,7 @@ func GetDefaultConfig() *UserConfig {
BulkMenu: "b", BulkMenu: "b",
}, },
}, },
OS: GetPlatformDefaultConfig(), OS: OSConfig{},
DisableStartupPopups: false, DisableStartupPopups: false,
CustomCommands: []CustomCommand(nil), CustomCommands: []CustomCommand(nil),
Services: map[string]string(nil), Services: map[string]string(nil),