Skip to content

Commit cc2ef46

Browse files
committed
Changes to Haskell files (to be cleaned up)
1 parent 9cc8975 commit cc2ef46

File tree

7 files changed

+41
-108
lines changed

7 files changed

+41
-108
lines changed

cardano-cli/cardano-cli.cabal

-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ library
136136
Cardano.CLI.Orphans
137137
Cardano.CLI.Parser
138138
Cardano.CLI.Read
139-
Cardano.CLI.Render
140139
Cardano.CLI.Run
141140
Cardano.CLI.Run.Address
142141
Cardano.CLI.Run.Address.Info

cardano-cli/src/Cardano/CLI/Compatible/Run.hs

+10-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import Cardano.Api
1313
import Cardano.CLI.Compatible.Commands
1414
import Cardano.CLI.Compatible.Governance
1515
import Cardano.CLI.Compatible.Transaction
16-
import Cardano.CLI.Render
1716
import Cardano.CLI.Types.Errors.CmdError
1817

1918
import Data.Text (Text)
@@ -24,8 +23,17 @@ data CompatibleCmdError
2423

2524
renderCompatibleCmdError :: Text -> CompatibleCmdError -> Doc ann
2625
renderCompatibleCmdError cmdText = \case
27-
CompatibleTransactionError e -> renderAnyCmdError cmdText prettyError e
26+
CompatibleTransactionError e -> renderAnyCmdError prettyError e
2827
CompatibleGovernanceError e -> renderCmdError cmdText e
28+
where
29+
renderAnyCmdError :: (a -> Doc ann) -> a -> Doc ann
30+
renderAnyCmdError renderer shelCliCmdErr =
31+
mconcat
32+
[ "Command failed: "
33+
, pretty cmdText
34+
, " Error: "
35+
, renderer shelCliCmdErr
36+
]
2937

3038
runAnyCompatibleCommand :: AnyCompatibleCommand -> ExceptT CompatibleCmdError IO ()
3139
runAnyCompatibleCommand (AnyCompatibleCommand cmd) = runCompatibleCommand cmd

cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs

+21-22
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import Cardano.CLI.Types.Common
2121
import Data.Foldable
2222
import Options.Applicative hiding (help, str)
2323
import qualified Options.Applicative as Opt
24-
import qualified Options.Applicative.Help as H
2524
import Prettyprinter (line)
2625

2726
{- HLINT ignore "Use <$>" -}
@@ -49,13 +48,13 @@ pTransactionCmds era' envCli =
4948
[ pretty @String "Build a transaction (low-level, inconvenient)"
5049
, line
5150
, line
52-
, H.yellow $
53-
mconcat
54-
[ "Please note "
55-
, H.underline "the order"
56-
, " of some cmd options is crucial. If used incorrectly may produce "
57-
, "undesired tx body. See nested [] notation above for details."
58-
]
51+
, -- H.yellow $
52+
mconcat
53+
[ "Please note "
54+
, {- H.underline -} "the order"
55+
, " of some cmd options is crucial. If used incorrectly may produce "
56+
, "undesired tx body. See nested [] notation above for details."
57+
]
5958
]
6059
, pTransactionBuildCmd era' envCli
6160
, forShelleyBasedEraInEon era' Nothing (`pTransactionBuildEstimateCmd` envCli)
@@ -157,13 +156,13 @@ pTransactionBuildCmd sbe envCli = do
157156
[ pretty @String "Build a balanced transaction (automatically calculates fees)"
158157
, line
159158
, line
160-
, H.yellow $
161-
mconcat
162-
[ "Please note "
163-
, H.underline "the order"
164-
, " of some cmd options is crucial. If used incorrectly may produce "
165-
, "undesired tx body. See nested [] notation above for details."
166-
]
159+
, -- H.yellow $
160+
mconcat
161+
[ "Please note "
162+
, {- H.underline -} "the order"
163+
, " of some cmd options is crucial. If used incorrectly may produce "
164+
, "undesired tx body. See nested [] notation above for details."
165+
]
167166
]
168167
where
169168
pCmd era' = do
@@ -216,13 +215,13 @@ pTransactionBuildEstimateCmd eon' _envCli = do
216215
"Build a balanced transaction without access to a live node (automatically estimates fees)"
217216
, line
218217
, line
219-
, H.yellow $
220-
mconcat
221-
[ "Please note "
222-
, H.underline "the order"
223-
, " of some cmd options is crucial. If used incorrectly may produce "
224-
, "undesired tx body. See nested [] notation above for details."
225-
]
218+
, -- H.yellow $
219+
mconcat
220+
[ "Please note "
221+
, {- H.underline -} "the order"
222+
, " of some cmd options is crucial. If used incorrectly may produce "
223+
, "undesired tx body. See nested [] notation above for details."
224+
]
226225
]
227226
where
228227
pCmd :: Exp.Era era -> Parser (TransactionCmds era)

cardano-cli/src/Cardano/CLI/Options.hs

+1-4
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ import Cardano.CLI.Options.Key
2323
import Cardano.CLI.Options.Node
2424
import Cardano.CLI.Options.Ping (parsePingCmd)
2525
import Cardano.CLI.Parser
26-
import Cardano.CLI.Render (customRenderHelp)
2726
import Cardano.CLI.Run (ClientCommand (..))
2827

2928
import Data.Foldable
3029
import Options.Applicative
3130
import qualified Options.Applicative as Opt
32-
import qualified Prettyprinter as PP
3331

3432
opts :: EnvCli -> ParserInfo ClientCommand
3533
opts envCli =
@@ -49,8 +47,7 @@ pref =
4947
Opt.prefs $
5048
mconcat
5149
[ showHelpOnEmpty
52-
, helpEmbedBriefDesc PP.align
53-
, helpRenderHelp customRenderHelp
50+
, Opt.briefHangPoint maxBound
5451
]
5552

5653
addressCmdsTopLevel :: EnvCli -> Parser ClientCommand

cardano-cli/src/Cardano/CLI/Render.hs

-75
This file was deleted.

cardano-cli/src/Cardano/CLI/Run.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import Cardano.CLI.EraBased.Run
2323
import Cardano.CLI.EraBased.Run.Query
2424
import Cardano.CLI.Legacy.Commands
2525
import Cardano.CLI.Legacy.Run (runLegacyCmds)
26-
import Cardano.CLI.Render (customRenderHelp)
2726
import Cardano.CLI.Run.Address
2827
import Cardano.CLI.Run.Debug
2928
import Cardano.CLI.Run.Hash (runHashCmds)
@@ -47,6 +46,7 @@ import qualified Data.Text as Text
4746
import qualified Data.Text.IO as Text
4847
import Data.Version (showVersion)
4948
import Options.Applicative.Help.Core
49+
import Options.Applicative.Help.Types (renderHelp)
5050
import Options.Applicative.Types (OptReader (..), Option (..), Parser (..),
5151
ParserInfo (..), ParserPrefs (..))
5252
import System.Info (arch, compilerName, compilerVersion, os)
@@ -145,7 +145,7 @@ runDisplayVersion = do
145145

146146
helpAll :: ParserPrefs -> String -> [String] -> ParserInfo a -> IO ()
147147
helpAll pprefs progn rnames parserInfo = do
148-
IO.putStrLn $ customRenderHelp 80 (usage_help parserInfo)
148+
IO.putStrLn $ renderHelp 80 (usage_help parserInfo)
149149
IO.putStrLn ""
150150
go (infoParser parserInfo)
151151
where

cardano-cli/src/Cardano/CLI/Types/Errors/CmdError.hs

+7-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ where
88

99
import Cardano.Api
1010

11-
import Cardano.CLI.Render
1211
import Cardano.CLI.Types.Errors.AddressCmdError
1312
import Cardano.CLI.Types.Errors.DelegationError
1413
import Cardano.CLI.Types.Errors.GenesisCmdError
@@ -66,4 +65,10 @@ renderCmdError cmdText = \case
6665
CmdTransactionError e -> renderError renderTxCmdError e
6766
where
6867
renderError :: (a -> Doc ann) -> a -> Doc ann
69-
renderError = renderAnyCmdError cmdText
68+
renderError renderer shelCliCmdErr =
69+
mconcat
70+
[ "Command failed: "
71+
, pretty cmdText
72+
, " Error: "
73+
, renderer shelCliCmdErr
74+
]

0 commit comments

Comments
 (0)