diff --git a/lib-opt/GHCup/OptParse/Config.hs b/lib-opt/GHCup/OptParse/Config.hs index 97cf23d..b4f8bf6 100644 --- a/lib-opt/GHCup/OptParse/Config.hs +++ b/lib-opt/GHCup/OptParse/Config.hs @@ -193,10 +193,14 @@ config configCommand settings userConf keybindings runLogger = case configComman throwE $ ParseError "Empty values are not allowed" Nothing -> do usersettings <- decodeSettings k + when (usersettings == defaultUserSettings) + $ throwE $ ParseError ("Failed to parse setting (maybe typo?): " <> k) lift $ doConfig usersettings pure () Just v -> do usersettings <- decodeSettings (k <> ": " <> v <> "\n") + when (usersettings == defaultUserSettings) + $ throwE $ ParseError ("Failed to parse key '" <> k <> "' with value '" <> v <> "' as user setting. Maybe typo?") lift $ doConfig usersettings pure () case r of @@ -204,7 +208,9 @@ config configCommand settings userConf keybindings runLogger = case configComman VLeft (V (JSONDecodeError e)) -> do runLogger $ logError $ "Error decoding config: " <> T.pack e pure $ ExitFailure 65 - VLeft _ -> pure $ ExitFailure 65 + VLeft e -> do + runLogger (logError $ T.pack $ prettyHFError e) + pure $ ExitFailure 65 AddReleaseChannel force new -> do r <- runE @'[DuplicateReleaseChannel] $ do diff --git a/lib/GHCup/Types.hs b/lib/GHCup/Types.hs index 53b3c3c..3763623 100644 --- a/lib/GHCup/Types.hs +++ b/lib/GHCup/Types.hs @@ -398,7 +398,7 @@ data UserSettings = UserSettings , uPlatformOverride :: Maybe PlatformRequest , uMirrors :: Maybe DownloadMirrors } - deriving (Show, GHC.Generic) + deriving (Show, GHC.Generic, Eq) defaultUserSettings :: UserSettings defaultUserSettings = UserSettings Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing @@ -459,7 +459,7 @@ data UserKeyBindings = UserKeyBindings , kShowAll :: Maybe KeyCombination , kShowAllTools :: Maybe KeyCombination } - deriving (Show, GHC.Generic) + deriving (Show, GHC.Generic, Eq) data KeyBindings = KeyBindings { bUp :: KeyCombination