Skip to content

Commit

Permalink
feat(config): auto pre-fill with existing inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
GTANAdam authored and Serpentiel committed Nov 10, 2022
1 parent cebb4ed commit 25ebdbb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/Serpentiel/betterglobekey/internal/pkg/assets"
"github.com/Serpentiel/betterglobekey/internal/pkg/eventlistener"
"github.com/Serpentiel/betterglobekey/pkg/inputsource"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.uber.org/zap"
Expand Down Expand Up @@ -77,6 +78,11 @@ func runRootCmd(cmd *cobra.Command, args []string) {
if err = viper.ReadInConfig(); err != nil {
logger.Fatalw("failed to read config", zap.Error(err))
}

viper.Set("input_sources.primary", inputsource.All())
if err = viper.WriteConfig(); err != nil {
logger.Fatalw("failed to write config", zap.Error(err))
}
}
}

Expand Down

0 comments on commit 25ebdbb

Please sign in to comment.