diff --git a/bench/cardano-topology/cardano-topology.cabal b/bench/cardano-topology/cardano-topology.cabal index 4de055fa26c..9d3a4883134 100644 --- a/bench/cardano-topology/cardano-topology.cabal +++ b/bench/cardano-topology/cardano-topology.cabal @@ -34,6 +34,6 @@ executable cardano-topology , bytestring , containers , graphviz - , optparse-applicative-fork + , optparse-applicative , split , text diff --git a/bench/locli/locli.cabal b/bench/locli/locli.cabal index bffad087b8e..49b47659c26 100644 --- a/bench/locli/locli.cabal +++ b/bench/locli/locli.cabal @@ -52,7 +52,7 @@ library , gnuplot , Histogram , iohk-monitoring - , optparse-applicative-fork + , optparse-applicative , optparse-generic , ouroboros-network , process @@ -94,7 +94,7 @@ executable locli build-depends: base , cardano-prelude , locli - , optparse-applicative-fork + , optparse-applicative , text , text-short , transformers diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index 90fb1aaa0d4..a63e791e84d 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -86,7 +86,7 @@ library , ixset-typed , network , network-mux - , optparse-applicative-fork + , optparse-applicative , ouroboros-consensus , ouroboros-consensus-byron , ouroboros-consensus-cardano @@ -139,7 +139,7 @@ test-suite tx-generator-test build-depends: base >=4.12 && <5 , hedgehog , heredoc - , optparse-applicative-fork + , optparse-applicative , tasty , tasty-hedgehog , tasty-hunit diff --git a/cabal.project b/cabal.project index b4e05cf4543..c8881a1442c 100644 --- a/cabal.project +++ b/cabal.project @@ -114,12 +114,19 @@ package cardano-ledger-alonzo-test -- --------------------------- 8< -------------------------- -- Please do not put any `source-repository-package` clause above this line. +-- Using a fork until our patches can be merged upstream +source-repository-package + type: git + location: https://github.com/input-output-hk/criterion + tag: fb2e7be532db96255d203f86360230cae37130f3 + --sha256: 14r9zkfa8zslky3969gaq27gi7yi9rlqv0h1iq7zam9l15z53vhr + -- Using a fork until our patches can be merged upstream source-repository-package type: git location: https://github.com/input-output-hk/optparse-applicative - tag: 7497a29cb998721a9068d5725d49461f2bba0e7a - --sha256: 1gvsrg925vynwgqwplgjmp53vj953qyh3wbdf34pw21c8r47w35r + tag: 84bcc6f18992a441886589a117249bfface8630e + --sha256: 09pr7m9gjsk8889m9d3mj75p69viv1acnrq63dgb11jl5gnnsblr source-repository-package type: git diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index b29e20d933b..ea7409d6a55 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -125,7 +125,7 @@ library , formatting , iproute , network - , optparse-applicative-fork + , optparse-applicative , ouroboros-consensus , ouroboros-consensus-byron , ouroboros-consensus-cardano @@ -158,7 +158,7 @@ executable cardano-cli build-depends: cardano-cli , cardano-crypto-class , cardano-prelude - , optparse-applicative-fork + , optparse-applicative , transformers-except test-suite cardano-cli-test diff --git a/cardano-cli/src/Cardano/CLI/Render.hs b/cardano-cli/src/Cardano/CLI/Render.hs index 08d2e62a80b..c18a2d1404c 100644 --- a/cardano-cli/src/Cardano/CLI/Render.hs +++ b/cardano-cli/src/Cardano/CLI/Render.hs @@ -6,7 +6,7 @@ import Cardano.Prelude import Data.Function (id) import Options.Applicative import Options.Applicative.Help.Ann -import Options.Applicative.Help.Types (helpText) +import Options.Applicative.Help.Types (helpText, renderHelp) import Prelude (String) import Prettyprinter import Prettyprinter.Render.Util.SimpleDocTree @@ -26,7 +26,12 @@ cliHelpTraceEnabled = IO.unsafePerformIO $ do -- tools can be used to inspect tracing that aids in describing the structure of the output -- document. customRenderHelp :: Int -> ParserHelp -> String -customRenderHelp cols +customRenderHelp = if cliHelpTraceEnabled + then customRenderHelpAsHtml + else customRenderHelpAsAnsi + +customRenderHelpAsHtml :: Int -> ParserHelp -> String +customRenderHelpAsHtml cols = T.unpack . wrapper . renderSimplyDecorated id renderElement @@ -34,11 +39,12 @@ customRenderHelp cols . layoutSmart (LayoutOptions (AvailablePerLine cols 1.0)) . helpText where - renderElement = if cliHelpTraceEnabled - then \ann x -> case ann of + renderElement :: Ann -> Text -> Text + renderElement ann x = if cliHelpTraceEnabled + then case ann of AnnTrace _ name -> "" <> x <> "" AnnStyle _ -> x - else flip const + else x wrapper = if cliHelpTraceEnabled then id . ("\n" <>) @@ -48,3 +54,6 @@ customRenderHelp cols . (<> "\n") . (<> "\n") else id + +customRenderHelpAsAnsi :: Int -> ParserHelp -> String +customRenderHelpAsAnsi = renderHelp diff --git a/cardano-cli/src/Cardano/CLI/Shelley/Parsers.hs b/cardano-cli/src/Cardano/CLI/Shelley/Parsers.hs index e0a2652fb1a..af5648154c2 100644 --- a/cardano-cli/src/Cardano/CLI/Shelley/Parsers.hs +++ b/cardano-cli/src/Cardano/CLI/Shelley/Parsers.hs @@ -48,6 +48,7 @@ import qualified Data.Aeson as Aeson import qualified Data.Aeson.Parser as Aeson.Parser import qualified Data.Attoparsec.ByteString.Char8 as Atto import qualified Options.Applicative as Opt +import qualified Options.Applicative.Help as H import qualified Text.Parsec as Parsec import qualified Text.Parsec.Error as Parsec import qualified Text.Parsec.Language as Parsec @@ -558,17 +559,27 @@ pTransaction :: Parser TransactionCmd pTransaction = asum [ subParser "build-raw" - $ Opt.info pTransactionBuildRaw $ Opt.progDescDoc $ Just $ - pretty @String "Build a transaction (low-level, inconvenient)" - <> line <> line - <> "Please note the order of some cmd options is crucial. If used incorrectly may produce " - <> "undesired tx body. See nested [] notation above for details." + $ Opt.info pTransactionBuildRaw $ Opt.progDescDoc $ Just $ mconcat + [ pretty @String "Build a transaction (low-level, inconvenient)" + , line + , line + , H.yellow $ mconcat + [ "Please note the order of some cmd options is crucial. If used incorrectly may produce " + , "undesired tx body. See nested [] notation above for details." + ] + ] , subParser "build" - $ Opt.info pTransactionBuild $ Opt.progDescDoc $ Just $ - pretty @String "Build a balanced transaction (automatically calculates fees)" - <> line <> line - <> "Please note the order of some cmd options is crucial. If used incorrectly may produce " - <> "undesired tx body. See nested [] notation above for details." + $ Opt.info pTransactionBuild $ Opt.progDescDoc $ Just $ mconcat + [ pretty @String "Build a balanced transaction (automatically calculates fees)" + , line + , line + , H.yellow $ mconcat + [ "Please note " + , H.underline "the order" + , " of some cmd options is crucial. If used incorrectly may produce " + , "undesired tx body. See nested [] notation above for details." + ] + ] , subParser "sign" (Opt.info pTransactionSign $ Opt.progDesc "Sign a transaction") , subParser "witness" diff --git a/cardano-node-chairman/cardano-node-chairman.cabal b/cardano-node-chairman/cardano-node-chairman.cabal index 9c343654be3..a8589bda3de 100644 --- a/cardano-node-chairman/cardano-node-chairman.cabal +++ b/cardano-node-chairman/cardano-node-chairman.cabal @@ -48,7 +48,7 @@ executable cardano-node-chairman , contra-tracer , io-classes , network-mux - , optparse-applicative-fork + , optparse-applicative , ouroboros-consensus , ouroboros-network , ouroboros-network-framework diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index da59e1e40ee..5b566e0353d 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -129,7 +129,7 @@ library , network , network-mux , nothunks - , optparse-applicative-fork + , optparse-applicative , ouroboros-consensus , ouroboros-consensus-byron , ouroboros-consensus-cardano @@ -167,7 +167,7 @@ executable cardano-node build-depends: cardano-config , cardano-node , cardano-prelude - , optparse-applicative-fork + , optparse-applicative , text test-suite cardano-node-test diff --git a/cardano-submit-api/cardano-submit-api.cabal b/cardano-submit-api/cardano-submit-api.cabal index 9e9412a5831..67d913a165a 100644 --- a/cardano-submit-api/cardano-submit-api.cabal +++ b/cardano-submit-api/cardano-submit-api.cabal @@ -31,7 +31,7 @@ common http-media { build-depends: http-media common iohk-monitoring { build-depends: iohk-monitoring >= 0.1.10.1 } common mtl { build-depends: mtl >= 2.2.2 } common network { build-depends: network >= 3.1.2.1 } -common optparse-applicative-fork { build-depends: optparse-applicative-fork >= 0.16.1.0 } +common optparse-applicative { build-depends: optparse-applicative >= 0.16.1.0 } common ouroboros-consensus-cardano { build-depends: ouroboros-consensus-cardano >= 0.1.0.0 } common ouroboros-network { build-depends: ouroboros-network >= 0.1.0.0 } common prometheus { build-depends: prometheus >= 2.2.2 } @@ -78,7 +78,7 @@ library , iohk-monitoring , mtl , network - , optparse-applicative-fork + , optparse-applicative , ouroboros-consensus-cardano , ouroboros-network , prometheus @@ -111,7 +111,7 @@ library executable cardano-submit-api import: base, project-config , cardano-submit-api - , optparse-applicative-fork + , optparse-applicative main-is: Main.hs hs-source-dirs: app ghc-options: -threaded -rtsopts "-with-rtsopts=-T -I0" diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index b45c4a37d3e..3e503e4c8fc 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -74,7 +74,7 @@ executable cardano-testnet , cardano-testnet , hedgehog , hedgehog-extras - , optparse-applicative-fork + , optparse-applicative , resourcet , stm , text diff --git a/out.html b/out.html new file mode 100644 index 00000000000..639ccdc05b9 --- /dev/null +++ b/out.html @@ -0,0 +1,60 @@ + + +
+Missing: 
+  (--tx-in TX-IN
+    --tx-in-script-file FILE
+    (--tx-in-datum-file FILE | --tx-in-datum-value JSON VALUE)
+    --tx-in-execution-units (INT, INT))
+  --out-file FILE
+
+Usage: cardano-cli transaction build-raw 
+            [ --byron-era
+            | --shelley-era
+            | --allegra-era
+            | --mary-era
+            | --alonzo-era
+            ]
+            (--tx-in TX-IN
+              [--tx-in-script-file FILE
+                [(--tx-in-datum-file FILE | --tx-in-datum-value JSON VALUE)
+                  ( --tx-in-redeemer-file FILE
+                  | --tx-in-redeemer-value JSON VALUE
+                  )
+                  --tx-in-execution-units (INT, INT)]])
+            [--tx-in-collateral TX-IN]
+            [--tx-out ADDRESS VALUE [--tx-out-datum-hash HASH]]
+            [--mint VALUE
+              (--mint-script-file FILE
+                [(--mint-redeemer-file FILE | --mint-redeemer-value JSON VALUE)
+                  --mint-execution-units (INT, INT)])]
+            [--invalid-before SLOT]
+            [--invalid-hereafter SLOT]
+            [--fee LOVELACE]
+            [--certificate-file CERTIFICATEFILE
+              [--certificate-script-file FILE
+                [
+                  ( --certificate-redeemer-file FILE
+                  | --certificate-redeemer-value JSON VALUE
+                  )
+                  --certificate-execution-units (INT, INT)]]]
+            [--withdrawal WITHDRAWAL
+              [--withdrawal-script-file FILE
+                [
+                  ( --withdrawal-redeemer-file FILE
+                  | --withdrawal-redeemer-value JSON VALUE
+                  )
+                  --withdrawal-execution-units (INT, INT)]]]
+            [--json-metadata-no-schema | --json-metadata-detailed-schema]
+            [--auxiliary-script-file FILE]
+            [--metadata-json-file FILE | --metadata-cbor-file FILE]
+            [--genesis FILE | --protocol-params-file FILE]
+            [--update-proposal-file FILE]
+            --out-file FILE
+
+  Build a transaction (low-level, inconvenient)
+
+  Please note the order of some cmd options is crucial. If used incorrectly may produce undesired tx body. See nested [] notation above for details.
+
+ +