aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-10-10 10:12:05 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-10-10 10:12:05 -0700
commit558b91801af2654c25a89cd7ddc3937bcc58ac2f (patch)
tree915d2cbf6ec28a633b006d99cff6b385400a5ea9
parenta3cd74c29be02dde0d65e0dcf79bccc8d41952ed (diff)
downloadpandoc-558b91801af2654c25a89cd7ddc3937bcc58ac2f.tar.gz
Reorder options in `--help`.
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs116
1 files changed, 58 insertions, 58 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index a7b20a6e3..bbbbbeb7c 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -118,34 +118,7 @@ findFile (f:fs) = do
-- in response to a command-line option.
options :: [OptDescr (Opt -> IO Opt)]
options =
- [ Option "" ["defaults"]
- (ReqArg
- (\arg opt -> runIOorExplode $ do
- setVerbosity $ optVerbosity opt
- let fp = if null (takeExtension arg)
- then addExtension arg "yaml"
- else arg
- dataDirs <- liftIO defaultUserDataDirs
- let fps = case optDataDir opt of
- Nothing -> (fp : map (</> ("defaults" </> fp))
- dataDirs)
- Just dd -> [fp, dd </> "defaults" </> fp]
- fp' <- fromMaybe fp <$> findFile fps
- inp <- readFileLazy fp'
- let defaults = YA.encode1 opt
- case YA.decode1 (defaults <> inp) of
- Right (newopts :: Opt) -> return newopts
- Left (errpos, errmsg) -> throwError $
- PandocParseError $
- "Error parsing " ++ fp' ++
- " (line " ++ show (Y.posLine errpos) ++
- " column " ++ show (Y.posColumn errpos) ++
- ")\n" ++ errmsg
- )
- "FILE")
- ""
-
- , Option "fr" ["from","read"]
+ [ Option "fr" ["from","read"]
(ReqArg
(\arg opt -> return opt { optFrom =
Just (map toLower arg) })
@@ -165,31 +138,6 @@ options =
"FILE")
"" -- "Name of output file"
- , Option "" ["wrap"]
- (ReqArg
- (\arg opt ->
- case arg of
- "auto" -> return opt{ optWrapText = WrapAuto }
- "none" -> return opt{ optWrapText = WrapNone }
- "preserve" -> return opt{ optWrapText = WrapPreserve }
- _ -> E.throwIO $ PandocOptionError
- "--wrap must be auto, none, or preserve")
- "auto|none|preserve")
- "" -- "Option for wrapping text in output"
-
- , Option "s" ["standalone"]
- (NoArg
- (\opt -> return opt { optStandalone = True }))
- "" -- "Include needed header and footer on output"
-
- , Option "" ["template"]
- (ReqArg
- (\arg opt ->
- return opt{ optTemplate = Just (normalizePath arg),
- optStandalone = True })
- "FILE")
- "" -- "Use custom template"
-
, Option "" ["data-dir"]
(ReqArg
(\arg opt -> return opt { optDataDir =
@@ -213,6 +161,51 @@ options =
"FILE")
""
+ , Option "" ["defaults"]
+ (ReqArg
+ (\arg opt -> runIOorExplode $ do
+ setVerbosity $ optVerbosity opt
+ let fp = if null (takeExtension arg)
+ then addExtension arg "yaml"
+ else arg
+ dataDirs <- liftIO defaultUserDataDirs
+ let fps = case optDataDir opt of
+ Nothing -> (fp : map (</> ("defaults" </> fp))
+ dataDirs)
+ Just dd -> [fp, dd </> "defaults" </> fp]
+ fp' <- fromMaybe fp <$> findFile fps
+ inp <- readFileLazy fp'
+ let defaults = YA.encode1 opt
+ case YA.decode1 (defaults <> inp) of
+ Right (newopts :: Opt) -> return newopts
+ Left (errpos, errmsg) -> throwError $
+ PandocParseError $
+ "Error parsing " ++ fp' ++
+ " (line " ++ show (Y.posLine errpos) ++
+ " column " ++ show (Y.posColumn errpos) ++
+ ")\n" ++ errmsg
+ )
+ "FILE")
+ ""
+
+ , Option "" ["file-scope"]
+ (NoArg
+ (\opt -> return opt { optFileScope = True }))
+ "" -- "Parse input files before combining"
+
+ , Option "s" ["standalone"]
+ (NoArg
+ (\opt -> return opt { optStandalone = True }))
+ "" -- "Include needed header and footer on output"
+
+ , Option "" ["template"]
+ (ReqArg
+ (\arg opt ->
+ return opt{ optTemplate = Just (normalizePath arg),
+ optStandalone = True })
+ "FILE")
+ "" -- "Use custom template"
+
, Option "V" ["variable"]
(ReqArg
(\arg opt -> do
@@ -222,6 +215,18 @@ options =
"KEY[:VALUE]")
""
+ , Option "" ["wrap"]
+ (ReqArg
+ (\arg opt ->
+ case arg of
+ "auto" -> return opt{ optWrapText = WrapAuto }
+ "none" -> return opt{ optWrapText = WrapNone }
+ "preserve" -> return opt{ optWrapText = WrapPreserve }
+ _ -> E.throwIO $ PandocOptionError
+ "--wrap must be auto, none, or preserve")
+ "auto|none|preserve")
+ "" -- "Option for wrapping text in output"
+
, Option "" ["ascii"]
(NoArg
(\opt -> return opt { optAscii = True }))
@@ -431,11 +436,6 @@ options =
"NAME:VALUE")
""
- , Option "" ["file-scope"]
- (NoArg
- (\opt -> return opt { optFileScope = True }))
- "" -- "Parse input files before combining"
-
, Option "" ["abbreviations"]
(ReqArg
(\arg opt -> return opt { optAbbreviations = Just arg })