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
This commit is contained in:
fiddlosopher
2010-01-02 18:19:19 +00:00
parent 3f4d06d015
commit 1e0c8e21cf
+9 -5
View File
@@ -412,9 +412,6 @@ options =
, Option "C" ["custom-header"]
(ReqArg
(\arg opt -> do
hPutStrLn stderr $
"Warning: The -C/--custom-header is deprecated.\n" ++
"Please transition to using --template instead."
text <- readFile arg
let newVars = ("legacy-header", text) : optVariables opt
return opt { optVariables = newVars
@@ -561,8 +558,8 @@ main = do
unless (null errors) $
do name <- getProgName
mapM_ (\e -> hPutStrLn stderr e) errors
hPutStr stderr (usageMessage name options)
mapM_ (\e -> hPutStr stderr (name ++ ": ") >> hPutStr stderr e) errors
hPutStrLn stderr $ "Try " ++ name ++ " --help for more information."
exitWith $ ExitFailure 2
let defaultOpts' = if compatMode
@@ -613,6 +610,13 @@ main = do
mapM_ (\arg -> hPutStrLn stdout arg) args
exitWith ExitSuccess
-- warn about deprecated options
case lookup "legacy-header" variables of
Just _ -> hPutStrLn stderr $
"Warning: The -C/--custom-header is deprecated.\n" ++
"Please transition to using --template instead."
Nothing -> return ()
let sources = if ignoreArgs then [] else args
-- assign reader and writer based on options and filenames