aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-01-02 18:19:19 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-01-02 18:19:19 +0000
commit1e0c8e21cfe028200db4313d0a5dde07ee0f45bc (patch)
tree51629404d336ef869a107cb5ef7a6abdc4348e37
parent3f4d06d015659b7a1580739c28846e31075d8723 (diff)
downloadpandoc-1e0c8e21cfe028200db4313d0a5dde07ee0f45bc.tar.gz
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
-rw-r--r--src/pandoc.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs
index 9f402ede8..6cecfeace 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -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