From 606d99834a416ebf8247981fd6bd2762fa6f0990 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 22 Nov 2023 19:25:37 -1000 Subject: [PATCH] fix: -o/--outputfile with a .json or .sql extension now selects those formats --- hledger/Hledger/Cli/CliOptions.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hledger/Hledger/Cli/CliOptions.hs b/hledger/Hledger/Cli/CliOptions.hs index f13bc10de..11bc1bb02 100644 --- a/hledger/Hledger/Cli/CliOptions.hs +++ b/hledger/Hledger/Cli/CliOptions.hs @@ -639,8 +639,10 @@ outputFileFromOpts opts = do defaultOutputFormat :: String defaultOutputFormat = "txt" +-- | All the output formats known by any command, for outputFormatFromOpts. +-- To automatically infer it from -o/--output-file, it needs to be listed here. outputFormats :: [String] -outputFormats = [defaultOutputFormat, "csv", "tsv", "html"] +outputFormats = [defaultOutputFormat, "csv", "json", "html", "sql", "tsv"] -- | Get the output format from the --output-format option, -- otherwise from a recognised file extension in the --output-file option,