git.iko.soy/typeable/pandoc
on master help sign in
pandoc.hs: warn of deprecated options after --dump-args has exited.

Otherwise we mess up the wrappers that look at the output of --dump-args. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1779 788f1e2b-df1e-0410-8736-df70ead52e1b

commit1e0c8e21cfe028200db4313d0a5dde07ee0f45bc authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSat 2 Jan 2010, 18:19 (17 years ago) parent3f4d06d
1 file changed+9−5
src/pandoc.hs+9−5
src/pandoc.hs+9−5
@@ -412,9 +412,6 @@ options =
412412 , Option "C" ["custom-header"]
413413 (ReqArg
414414 (\arg opt -> do
415− hPutStrLn stderr $
416− "Warning: The -C/--custom-header is deprecated.\n" ++
417− "Please transition to using --template instead."
418415 text <- readFile arg
419416 let newVars = ("legacy-header", text) : optVariables opt
420417 return opt { optVariables = newVars
@@ -561,8 +558,8 @@ main = do
561558
562559 unless (null errors) $
563560 do name <- getProgName
564− mapM_ (\e -> hPutStrLn stderr e) errors
565− hPutStr stderr (usageMessage name options)
561+ mapM_ (\e -> hPutStr stderr (name ++ ": ") >> hPutStr stderr e) errors
562+ hPutStrLn stderr $ "Try " ++ name ++ " --help for more information."
566563 exitWith $ ExitFailure 2
567564
568565 let defaultOpts' = if compatMode
@@ -613,6 +610,13 @@ main = do
613610 mapM_ (\arg -> hPutStrLn stdout arg) args
614611 exitWith ExitSuccess
615612
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+
616620 let sources = if ignoreArgs then [] else args
617621
618622 -- assign reader and writer based on options and filenames