git.iko.soy/typeable/pandoc
on master help sign in
pandoc.hs: warn of deprecated options after --dump-args has exited.
1e0c8e2fiddlosopher
src/pandoc.hs+9−5
@@ -412,9 +412,6 @@ options =
412 , Option "C" ["custom-header"]
412 , Option "C" ["custom-header"]
413 (ReqArg
413 (ReqArg
414 (\arg opt -> do
414 (\arg opt -> do
415− hPutStrLn stderr $
416− "Warning: The -C/--custom-header is deprecated.\n" ++
417− "Please transition to using --template instead."
418 text <- readFile arg
415 text <- readFile arg
419 let newVars = ("legacy-header", text) : optVariables opt
416 let newVars = ("legacy-header", text) : optVariables opt
420 return opt { optVariables = newVars
417 return opt { optVariables = newVars
@@ -561,8 +558,8 @@ main = do
561
558
562 unless (null errors) $
559 unless (null errors) $
563 do name <- getProgName
560 do name <- getProgName
564− mapM_ (\e -> hPutStrLn stderr e) errors
561+ mapM_ (\e -> hPutStr stderr (name ++ ": ") >> hPutStr stderr e) errors
565− hPutStr stderr (usageMessage name options)
562+ hPutStrLn stderr $ "Try " ++ name ++ " --help for more information."
566 exitWith $ ExitFailure 2
563 exitWith $ ExitFailure 2
567
564
568 let defaultOpts' = if compatMode
565 let defaultOpts' = if compatMode
@@ -613,6 +610,13 @@ main = do
613 mapM_ (\arg -> hPutStrLn stdout arg) args
610 mapM_ (\arg -> hPutStrLn stdout arg) args
614 exitWith ExitSuccess
611 exitWith ExitSuccess
615
612
613+ -- warn about deprecated options
614+ case lookup "legacy-header" variables of
615+ Just _ -> hPutStrLn stderr $
616+ "Warning: The -C/--custom-header is deprecated.\n" ++
617+ "Please transition to using --template instead."
618+ Nothing -> return ()
619+
616 let sources = if ignoreArgs then [] else args
620 let sources = if ignoreArgs then [] else args
617
621
618 -- assign reader and writer based on options and filenames
622 -- assign reader and writer based on options and filenames