plutus-ledger-api-1.66.0.0: Interface to the Plutus ledger for the Cardano ledger.
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusCore.Executable.Parsers

Description

Common option parsers for executables

Synopsis

Documentation

inputParser Input Source #

Parser for an input stream. If none is specified, default to stdin for ease of use in pipeline.

outputParser Output Source #

Parser for an output stream. If none is specified, default to stdout for ease of use in pipeline.

showByTableShow a ⇒ [(String, a)] → a → String Source #

formatFromExtensionStringFilePathMaybe Format Source #

Guess the format from a file name's extension, given the extension that denotes this language's own textual format (.uplc for UPLC, .plc for PLC). Returns Nothing for an unrecognised extension, in which case callers fall back to Textual.

extensionHelpString → [(String, Maybe String, Format)] → String Source #

Describe, for the --if/--of help text, which extensions are deduced to which format for this language's textualExt, restricted to the formats in the given table (an extension whose format isn't in table is omitted, since it falls back to textual instead).

extensionDeductionSentenceStringString Source #

The shared wording every language's --if/--of "default:" help text is built from, wrapped around that language's own ext -> format list.

formatOptionHelpStringStringStringString Source #

Build the full --if/--of help text for a format option: kind (e.g. Input or Output), the list of allowed values, and a note on how the default is chosen. Kept as two separate sentences, so the note (e.g. "deduced from the file extension") doesn't read as if it's parenthetically attached to the last format in the list (e.g. blueprint).

supportedFormats ∷ [(String, Maybe String, Format)] → [Format] Source #

The formats named in a format table.

deduceInputFormat ∷ (FilePathMaybe fmt) → fmt → Maybe fmt → Input → fmt Source #

Generic extension-based format deduction, shared by every language's input-format resolver: an explicit --if always wins; otherwise look up the input file's extension with fromExt, falling back to deflt for stdin or an extension fromExt doesn't recognise.

deduceOutputFormat ∷ (FilePathMaybe fmt) → fmt → Maybe fmt → Output → fmt Source #

The output-format counterpart of deduceInputFormat: an explicit --of always wins; otherwise look up the output file's extension with fromExt, falling back to deflt for stdout, the silent sink, or an unrecognised extension.

resolveInputFormatString → [Format] → Maybe FormatInputFormat Source #

Work out which input format to use, deducing from the input file's extension (using textualExt as this language's own textual extension) restricted to supported (eg .hex isn't deduced for the plc command, which only handles textual and Flat).

resolveOutputFormatString → [Format] → Maybe FormatOutputFormat Source #

The output-format counterpart of resolveInputFormat.

supportedFormatFromExtensionString → [Format] → FilePathMaybe Format Source #

formatFromExtension, restricted to the formats in supported.

inputformatOptionalParser (Maybe Format) Source #

The --if/--input-format option without a default, so we can tell whether the user supplied it and deduce the format from the file extension if not.

inputWithFormatParser (Input, Format) Source #

An input stream together with its format, deducing the format from the file extension when --if is not given. See resolveInputFormat.

filesWithFormatsParser [(FilePath, Format)] Source #

Like inputWithFormat but for commands taking a list of input files: each file is paired with the format to read it with. When --if is given it forces that format for every file; otherwise each file's format is deduced independently from its own extension.

outputformatOptionalParser (Maybe Format) Source #

The --of/--output-format option without a default, so we can tell whether the user supplied it and deduce the format from the -o file extension if not.

outputWithFormatParser (Output, Format) Source #

An output stream together with its format, deducing the format from the file extension when --of is not given. See resolveOutputFormat.

plcInputFormatOptionalParser (Maybe Format) Source #

The --if option for plc, without a default so the format can be deduced from the file extension when it isn't given.

plcOutputFormatOptionalParser (Maybe Format) Source #

The --of option for plc, without a default so the format can be deduced from the file extension when it isn't given.

pirFormatFromExtensionFilePathMaybe PirFormat Source #

Guess the PIR format from a file name's extension. Returns Nothing for an unrecognised extension, in which case callers fall back to TextualPir.

resolvePirInputFormatMaybe PirFormatInputPirFormat Source #

Work out which PIR format to use. An explicit --if/--of always wins; otherwise the format is deduced from the file's extension, falling back to TextualPir for stdin/stdout or an unrecognised extension.

pPirInputFormatOptionalParser (Maybe PirFormat) Source #

The --if option for pir, without a default so the format can be deduced from the file extension when it isn't given.

pPirOutputFormatOptionalParser (Maybe PirFormat) Source #

The --of option for pir, without a default so the format can be deduced from the file extension when it isn't given.

pPirInputWithFormatParser (Input, PirFormat) Source #

An input stream together with its PIR format, deducing the format from the file extension when --if is not given. See resolvePirInputFormat.

pPirOutputWithFormatParser (Output, PirFormat) Source #

An output stream together with its PIR format, deducing the format from the file extension when --of is not given. See resolvePirOutputFormat.