more OsPath conversion (639/749)

Sponsored-by: k0ld
This commit is contained in:
Joey Hess 2025-02-07 16:07:05 -04:00
parent a5d48edd94
commit c74c75b352
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
28 changed files with 147 additions and 132 deletions

View file

@ -5,6 +5,8 @@
- Licensed under the GNU AGPL version 3 or higher.
-}
{-# LANGUAGE OverloadedStrings #-}
module CmdLine (
dispatch,
usage,
@ -29,6 +31,7 @@ import Annex.Action
import Annex.Environment
import Command
import Types.Messages
import qualified Utility.OsString as OS
{- Parses input arguments, finds a matching Command, and runs it. -}
dispatch :: Bool -> Bool -> CmdParams -> [Command] -> [(String, String)] -> IO Git.Repo -> String -> String -> IO ()
@ -159,17 +162,18 @@ findAddonCommand Nothing = return Nothing
findAddonCommand (Just subcommandname) =
searchPath c >>= \case
Nothing -> return Nothing
Just p -> return (Just (mkAddonCommand p subcommandname))
Just p -> return (Just (mkAddonCommand (fromOsPath p) subcommandname))
where
c = "git-annex-" ++ subcommandname
findAllAddonCommands :: IO [Command]
findAllAddonCommands =
filter isaddoncommand
. map (\p -> mkAddonCommand p (deprefix p))
<$> searchPathContents ("git-annex-" `isPrefixOf`)
. map go
<$> searchPathContents (literalOsPath "git-annex-" `OS.isPrefixOf`)
where
deprefix = replace "git-annex-" "" . takeFileName
go p = mkAddonCommand (fromOsPath p) (deprefix p)
deprefix = replace "git-annex-" "" . fromOsPath . takeFileName
isaddoncommand c
-- git-annex-shell
| cmdname c == "shell" = False