Support help.autocorrect settings "never" and "immediate"

This commit is contained in:
Joey Hess 2025-01-20 11:01:07 -04:00
parent b0ef04f0b7
commit 104ca5e09e
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 5 additions and 1 deletions

View file

@ -55,6 +55,8 @@ prepare cmdname input showmatch matches r =
| otherwise -> sleep n
Nothing -> case getcfg <$> r of
Just "prompt" -> prompt
Just "never" -> unknowncommand
Just "immediate" -> warn Nothing
_ -> list
where
getcfg = fromConfigValue . Git.Config.get "help.autocorrect" "0"
@ -89,3 +91,5 @@ prepare cmdname input showmatch matches r =
resp <- headMaybe . map toLower <$> getLine
when (resp /= Just 'y') $
exitWith (ExitFailure 1)
unknowncommand = giveup $ "Unknown command '" ++ input ++ "'"