diff --git a/configs/profiles/profiles.go b/configs/profiles/profiles.go index 231e3f9..ead8dd9 100644 --- a/configs/profiles/profiles.go +++ b/configs/profiles/profiles.go @@ -162,6 +162,14 @@ func confStringSlice(v *viper.Viper, name string, def []string) []string { return res } +func WriteConfigAs(name string) error { + return writeConfigAs(vDefault, name) +} + +func writeConfigAs(v *viper.Viper, name string) error { + return v.WriteConfigAs(name) +} + //====================================================================== // Local Variables: // mode: Go diff --git a/ui/logsui.go b/ui/logsui.go index f2ec5e0..2546969 100644 --- a/ui/logsui.go +++ b/ui/logsui.go @@ -19,7 +19,6 @@ import ( "github.com/gcla/termshark/v2/configs/profiles" "github.com/gcla/termshark/v2/widgets/fileviewer" log "github.com/sirupsen/logrus" - "github.com/spf13/viper" ) //====================================================================== @@ -43,7 +42,6 @@ func openLogsUi(app gowid.IApp) { } func openConfigUi(app gowid.IApp) { - viper.SetConfigName("termshark") // no need to include file extension - looks for file called termshark.ini for example tmp, err := ioutil.TempFile("", "termshark-*.toml") if err != nil { OpenError(fmt.Sprintf("Could not create temp file: %v", err), app) @@ -51,7 +49,7 @@ func openConfigUi(app gowid.IApp) { } tmp.Close() - err = viper.WriteConfigAs(tmp.Name()) + err = profiles.WriteConfigAs(tmp.Name()) if err != nil { OpenError(fmt.Sprintf("Could not run config viewer\n\n%v", err), app) } else {