diff --git a/cardano-api/src/Cardano/Api/Options.hs b/cardano-api/src/Cardano/Api/Options.hs index db957a5dc83..8b4e00e36ad 100644 --- a/cardano-api/src/Cardano/Api/Options.hs +++ b/cardano-api/src/Cardano/Api/Options.hs @@ -4,6 +4,7 @@ module Cardano.Api.Options ( fileOption , inFileOption , outFileOption + , parseFilePath ) where import Cardano.Api.IO (File (..), In, Out) @@ -21,3 +22,12 @@ inFileOption = fileOption outFileOption :: forall. Mod OptionFields FilePath -> Parser (File Out) outFileOption = fileOption + +parseFilePath :: String -> String -> Opt.Parser FilePath +parseFilePath optname desc = + Opt.strOption + ( Opt.long optname + <> Opt.metavar "FILEPATH" + <> Opt.help desc + <> Opt.completer (Opt.bashCompleter "file") + ) diff --git a/cardano-api/src/Cardano/Api/Utils.hs b/cardano-api/src/Cardano/Api/Utils.hs index 2c2146d8e43..72489f6e81f 100644 --- a/cardano-api/src/Cardano/Api/Utils.hs +++ b/cardano-api/src/Cardano/Api/Utils.hs @@ -19,7 +19,6 @@ module Cardano.Api.Utils , failEitherWith , noInlineMaybeToStrictMaybe , note - , parseFilePath , readFileBlocking , renderEra , runParsecParser @@ -40,7 +39,6 @@ import Data.Maybe.Strict import Data.Text (Text) import qualified Data.Text as Text import GHC.IO.Handle.FD (openFileBlocking) -import qualified Options.Applicative as Opt import System.FilePath (()) import System.IO (IOMode (ReadMode), hClose) import qualified Text.Parsec as Parsec @@ -94,15 +92,6 @@ note msg = \case Nothing -> fail msg Just a -> pure a -parseFilePath :: String -> String -> Opt.Parser FilePath -parseFilePath optname desc = - Opt.strOption - ( Opt.long optname - <> Opt.metavar "FILEPATH" - <> Opt.help desc - <> Opt.completer (Opt.bashCompleter "file") - ) - writeSecrets :: FilePath -> [Char] -> [Char] -> (a -> BS.ByteString) -> [a] -> IO () writeSecrets outDir prefix suffix secretOp xs = forM_ (zip xs [0::Int ..]) $