update wording to match current wording in git

This commit is contained in:
Joey Hess 2019-09-15 19:01:05 -04:00
parent 91caba25be
commit 92ea93ee21
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -40,13 +40,14 @@ fuzzymatches input showchoice choices = fst $ unzip $
similarEnough (_, cst) = cst < similarityFloor similarEnough (_, cst) = cst < similarityFloor
{- Takes action based on git's autocorrect configuration, in preparation for {- Takes action based on git's autocorrect configuration, in preparation for
- an autocorrected command being run. -} - an autocorrected command being run.
-}
prepare :: String -> (c -> String) -> [c] -> Maybe Repo -> IO () prepare :: String -> (c -> String) -> [c] -> Maybe Repo -> IO ()
prepare input showmatch matches r = prepare input showmatch matches r =
case readish . Git.Config.get "help.autocorrect" "0" =<< r of case readish . Git.Config.get "help.autocorrect" "0" =<< r of
Just n Just n
| n == 0 -> list | n == 0 -> list
| n < 0 -> warn | n < 0 -> warn Nothing
| otherwise -> sleep n | otherwise -> sleep n
Nothing -> list Nothing -> list
where where
@ -55,17 +56,16 @@ prepare input showmatch matches r =
, "" , ""
, "Did you mean one of these?" , "Did you mean one of these?"
] ++ map (\m -> "\t" ++ showmatch m) matches ] ++ map (\m -> "\t" ++ showmatch m) matches
warn = warn :: Maybe Float -> IO ()
hPutStr stderr $ unlines warn mdelaysec = hPutStr stderr $ unlines
[ "WARNING: You called a command named '" ++ [ "WARNING: You called a git-annex command named '" ++
input ++ "', which does not exist." input ++ "', which does not exist."
, "Continuing under the assumption that you meant '" ++ , case mdelaysec of
showmatch (Prelude.head matches) ++ "'" Nothing -> "Continuing under the assumption that you meant " ++ match
Just sec -> "Continuing in " ++ show sec ++ " seconds, assuming that you meant " ++ match
] ]
where
match = "'" ++ showmatch (Prelude.head matches) ++ "'."
sleep n = do sleep n = do
warn warn (Just (fromIntegral n / 10 :: Float))
hPutStrLn stderr $ unwords
[ "in"
, show (fromIntegral n / 10 :: Float)
, "seconds automatically..."]
threadDelay (n * 100000) -- deciseconds to microseconds threadDelay (n * 100000) -- deciseconds to microseconds