diff --git a/cardano-api/cardano-api.cabal b/cardano-api/cardano-api.cabal index b98778ace9..010bb3da82 100644 --- a/cardano-api/cardano-api.cabal +++ b/cardano-api/cardano-api.cabal @@ -197,7 +197,6 @@ library internal microlens-aeson, mtl, network, - optparse-applicative-fork, ouroboros-consensus ^>=0.20, ouroboros-consensus-cardano ^>=0.19, ouroboros-consensus-diffusion ^>=0.17, diff --git a/cardano-api/internal/Cardano/Api/Utils.hs b/cardano-api/internal/Cardano/Api/Utils.hs index f0afd2619b..3c8d7cc28a 100644 --- a/cardano-api/internal/Cardano/Api/Utils.hs +++ b/cardano-api/internal/Cardano/Api/Utils.hs @@ -19,14 +19,11 @@ module Cardano.Api.Utils , failEitherWith , noInlineMaybeToStrictMaybe , note - , parseFilePath , readFileBlocking , runParsecParser , textShow - , modifyWith -- ** CLI option parsing - , bounded , unsafeBoundedRational ) where @@ -34,7 +31,6 @@ where import Cardano.Ledger.BaseTypes import Cardano.Ledger.Shelley () import Control.Exception (bracket) -import Control.Monad (when) import qualified Data.Aeson.Types as Aeson import qualified Data.ByteString as BS import qualified Data.ByteString.Builder as Builder @@ -45,14 +41,10 @@ import qualified Data.Text as Text import Data.Typeable import GHC.IO.Handle.FD (openFileBlocking) import GHC.Stack -import Options.Applicative (ReadM) -import qualified Options.Applicative as Opt -import Options.Applicative.Builder (eitherReader) import System.IO (IOMode (ReadMode), hClose) import qualified Text.Parsec as Parsec import qualified Text.Parsec.String as Parsec import qualified Text.ParserCombinators.Parsec.Error as Parsec -import qualified Text.Read as Read (?!) :: Maybe a -> e -> Either e a Nothing ?! e = Left e @@ -94,15 +86,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") - ) - readFileBlocking :: FilePath -> IO BS.ByteString readFileBlocking path = bracket @@ -123,21 +106,6 @@ readFileBlocking path = textShow :: Show a => a -> Text textShow = Text.pack . show -bounded :: forall a. (Bounded a, Integral a, Show a) => String -> ReadM a -bounded t = eitherReader $ \s -> do - i <- Read.readEither @Integer s - when (i < fromIntegral (minBound @a)) $ Left $ t <> " must not be less than " <> show (minBound @a) - when (i > fromIntegral (maxBound @a)) $ Left $ t <> " must not greater than " <> show (maxBound @a) - pure (fromIntegral i) - --- | Aids type inference. Use this function to ensure the value is a function --- that modifies a value. -modifyWith - :: () - => (a -> a) - -> (a -> a) -modifyWith = id - -- | Convert Rational to a bounded rational. Throw an exception when the rational is out of bounds. unsafeBoundedRational :: forall r diff --git a/cardano-api/src/Cardano/Api.hs b/cardano-api/src/Cardano/Api.hs index 6b720e3877..c168cc0cc9 100644 --- a/cardano-api/src/Cardano/Api.hs +++ b/cardano-api/src/Cardano/Api.hs @@ -926,7 +926,6 @@ module Cardano.Api , chainPointToSlotNo , chainPointToHeaderHash , makeChainTip - , parseFilePath , writeSecrets -- * Convenience functions @@ -949,9 +948,6 @@ module Cardano.Api , notScriptLockedTxIns , textShow - -- ** CLI option parsing - , bounded - -- ** Query expressions , queryAccountState , queryChainBlockNo