Support help.autocorrect settings "never" and "immediate"
This commit is contained in:
parent
b0ef04f0b7
commit
104ca5e09e
2 changed files with 5 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
git-annex (10.20250116) UNRELEASED; urgency=medium
|
git-annex (10.20250116) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* Support help.autocorrect=prompt.
|
* Support help.autocorrect settings "prompt", "never", and "immediate".
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Mon, 20 Jan 2025 10:24:51 -0400
|
-- Joey Hess <id@joeyh.name> Mon, 20 Jan 2025 10:24:51 -0400
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,8 @@ prepare cmdname input showmatch matches r =
|
||||||
| otherwise -> sleep n
|
| otherwise -> sleep n
|
||||||
Nothing -> case getcfg <$> r of
|
Nothing -> case getcfg <$> r of
|
||||||
Just "prompt" -> prompt
|
Just "prompt" -> prompt
|
||||||
|
Just "never" -> unknowncommand
|
||||||
|
Just "immediate" -> warn Nothing
|
||||||
_ -> list
|
_ -> list
|
||||||
where
|
where
|
||||||
getcfg = fromConfigValue . Git.Config.get "help.autocorrect" "0"
|
getcfg = fromConfigValue . Git.Config.get "help.autocorrect" "0"
|
||||||
|
@ -89,3 +91,5 @@ prepare cmdname input showmatch matches r =
|
||||||
resp <- headMaybe . map toLower <$> getLine
|
resp <- headMaybe . map toLower <$> getLine
|
||||||
when (resp /= Just 'y') $
|
when (resp /= Just 'y') $
|
||||||
exitWith (ExitFailure 1)
|
exitWith (ExitFailure 1)
|
||||||
|
|
||||||
|
unknowncommand = giveup $ "Unknown command '" ++ input ++ "'"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue