Skip to content

Commit

Permalink
Fix up build
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Jul 21, 2021
1 parent e8555c5 commit 1b3ab31
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 77 deletions.
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
[submodule "optparse-applicative"]
path = optparse-applicative
url = git@github.com:input-output-hk/optparse-applicative.git
[submodule "criterion"]
path = criterion
url = git@github.com:input-output-hk/criterion.git
14 changes: 12 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ packages:
nix/workbench/cardano-topology
bench/tx-generator
nix/workbench/locli
optparse-applicative
criterion

package cardano-api
ghc-options: -Werror
Expand Down Expand Up @@ -109,6 +107,18 @@ package cardano-ledger-alonzo-test
-- --------------------------- 8< --------------------------
-- Please do not put any `source-repository-package` clause above this line.

source-repository-package
type: git
location: https://github.com/input-output-hk/optparse-applicative
tag: ca02c8e0f54a8f1853e7a1c1f770153833cae988
--sha256: 0l0b1g2y73z18azqck53y0k3269sb1ga591v7yv9w356xx0n6hi9

source-repository-package
type: git
location: https://github.com/input-output-hk/criterion
tag: fb2e7be532db96255d203f86360230cae37130f3
--sha256: 14r9zkfa8zslky3969gaq27gi7yi9rlqv0h1iq7zam9l15z53vhr

source-repository-package
type: git
location: https://github.com/input-output-hk/hedgehog-extras
Expand Down
2 changes: 0 additions & 2 deletions cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ library
Cardano.CLI.Mary.RenderValue
Cardano.CLI.Mary.ValueParser

Cardano.CLI.Render

Cardano.CLI.TopHandler

other-modules: Paths_cardano_cli
Expand Down
32 changes: 25 additions & 7 deletions cardano-cli/src/Cardano/CLI/Parsers.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}

module Cardano.CLI.Parsers
Expand All @@ -19,6 +20,8 @@ import Prettyprinter.Render.Util.SimpleDocTree

import qualified Data.Text as T
import qualified Options.Applicative as Opt
import qualified System.Environment as IO
import qualified System.IO.Unsafe as IO

command' :: String -> String -> Parser a -> Mod CommandFields a
command' c descr p =
Expand All @@ -41,20 +44,35 @@ pref = Opt.prefs $ mempty
<> helpHangUsageOverflow 10
<> helpRenderHelp customRenderHelp

cliHelpTraceEnabled :: Bool
cliHelpTraceEnabled = IO.unsafePerformIO $ do
mValue <- IO.lookupEnv "CLI_HELP_TRACE"
return $ mValue == Just "1"
{-# NOINLINE cliHelpTraceEnabled #-}

-- | Convert a help text to 'String'.
customRenderHelp :: Int -> ParserHelp -> String
customRenderHelp cols
= T.unpack
. ("<html>\n" <>)
. ("<body>\n" <>)
. ("<pre>\n" <>)
. (<> "\n</html>")
. (<> "\n</body>")
. (<> "\n</pre>")
. renderSimplyDecorated id (\(AnnTrace _ name) x -> "<span name=" <> show name <> ">" <> x <> "</span>")
. wrapper
. renderSimplyDecorated id renderElement
. treeForm
. layoutSmart (LayoutOptions (AvailablePerLine cols 1.0))
. helpText
where
renderElement = if cliHelpTraceEnabled
then \(AnnTrace _ name) x -> "<span name=" <> show name <> ">" <> x <> "</span>"
else flip const
wrapper = if cliHelpTraceEnabled
then id
. ("<html>\n" <>)
. ("<body>\n" <>)
. ("<pre>\n" <>)
. (<> "\n</html>")
. (<> "\n</body>")
. (<> "\n</pre>")
else id


parseClientCommand :: Parser ClientCommand
parseClientCommand =
Expand Down
58 changes: 0 additions & 58 deletions cardano-cli/src/Cardano/CLI/Render.hs

This file was deleted.

1 change: 0 additions & 1 deletion criterion
Submodule criterion deleted from fb2e7b
1 change: 0 additions & 1 deletion optparse-applicative
Submodule optparse-applicative deleted from ca02c8

0 comments on commit 1b3ab31

Please sign in to comment.