aboutsummaryrefslogtreecommitdiff
path: root/pandoc-cli
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-07-19 10:56:35 -0700
committerJohn MacFarlane <[email protected]>2023-07-19 11:56:58 -0700
commitbec5429e4f7180af135cabc2dc79b82a406a357d (patch)
tree6d15a1e8c31931a57347881818b895ce2ad00b79 /pandoc-cli
parent5b2128512df61085c4a0ae364030482f21626dc6 (diff)
Fix regression on short boolean arguments.
In 3.1.5 boolean arguments were allowed an optional argument (true|false). This created a regression for uses of fused short arguments, e.g. `-somyfile.html`, which was equivalent to `-s -omyfile.html`, but now raised an error because pandoc attempted to parse `o` as a boolean `true` or `false`. This change adds a preprocessing step on the raw arguments before they are sent to the option parser. In this preprocessing step, `-somyfile.html` would be split into two arguments, `-s` and `-omyfile.html`. The splitting happens when a short boolean option is followed by another short option. Closes #8956.
Diffstat (limited to 'pandoc-cli')
-rw-r--r--pandoc-cli/src/pandoc.hs3
1 files changed, 1 insertions, 2 deletions
diff --git a/pandoc-cli/src/pandoc.hs b/pandoc-cli/src/pandoc.hs
index 9be595c48..6f99781ef 100644
--- a/pandoc-cli/src/pandoc.hs
+++ b/pandoc-cli/src/pandoc.hs
@@ -18,7 +18,6 @@ import System.Environment (getArgs, getProgName)
import Text.Pandoc.App ( convertWithOpts, defaultOpts, options
, parseOptionsFromArgs, handleOptInfo )
import Text.Pandoc.Error (handleError)
-import qualified Text.Pandoc.UTF8 as UTF8
import System.Exit (exitSuccess)
import Data.Monoid (Any(..))
import Control.Monad (when)
@@ -48,7 +47,7 @@ versionSuffix = ""
main :: IO ()
main = E.handle (handleError . Left) $ do
prg <- getProgName
- rawArgs <- map UTF8.decodeArg <$> getArgs
+ rawArgs <- getArgs
let hasVersion = getAny $ foldMap
(\s -> Any (s == "-v" || s == "--version"))
(takeWhile (/= "--") rawArgs)