Dhall-haskell: dhall: provide flag -o, --output for writing to file

Created on 4 Oct 2019  路  4Comments  路  Source: dhall-lang/dhall-haskell

Related to #1303, I think --output flag is missing for dhall cli

$ dhall --version
1.26.1

$ dhall --help
Usage: dhall ([version] | [resolve] | [type] | [normalize] | [repl] | [diff] |
             [hash] | [lint] | [format] | [freeze] | [encode] | [decode] |
             [text] | [--file FILE] [--annotate] [--alpha] [--no-cache]
             [--version]) [--explain] [--plain] [--ascii] [--censor]
  Interpreter for the Dhall language

Available options:
  -h,--help                Show this help text
  --file FILE              Read expression from a file instead of standard input
  --annotate               Add a type annotation to the output
  --alpha                  伪-normalize expression
  --no-cache               Handle protected imports as if the cache was empty
  --version                Display version
  --explain                Explain error messages in more detail
  --plain                  Disable syntax highlighting
  --ascii                  Format code using only ASCII syntax
  --censor                 Hide source code in error messages

Available commands:
  version                  Display version
  resolve                  Resolve an expression's imports
  type                     Infer an expression's type
  normalize                Normalize an expression
  repl                     Interpret expressions in a REPL
  diff                     Render the difference between the normal form of two
                           expressions
  hash                     Compute semantic hashes for Dhall expressions
  lint                     Improve Dhall code by using newer language features
                           and removing dead code
  format                   Standard code formatter for the Dhall language
  freeze                   Add integrity checks to remote import statements of
                           an expression
  encode                   Encode a Dhall expression to binary
  decode                   Decode a Dhall expression from binary
  text                     Render a Dhall expression that evaluates to a Text
                           literal
Hacktoberfest enhancement

Most helpful comment

@sjakobi If no one working on this yet, I'll try it.

All 4 comments

Seems reasonable. I think this should be fairly easy to implement in analogy to #1304.

The main entry point for the CLI is here:

https://github.com/dhall-lang/dhall-haskell/blob/613a44d512819820ac2df803ebb050751c387825/dhall/src/Dhall/Main.hs#L650-L654

The options for the default command (dhall) are defined here:

https://github.com/dhall-lang/dhall-haskell/blob/613a44d512819820ac2df803ebb050751c387825/dhall/src/Dhall/Main.hs#L90-L96

@sjakobi If no one working on this yet, I'll try it.

@Rizary Great! :)

If any questions come up, feel free to ask right here!

1399 fixed this. Thanks @Rizary! :)

Was this page helpful?
0 / 5 - 0 ratings