From 1e0c8e21cfe028200db4313d0a5dde07ee0f45bc Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 2 Jan 2010 18:19:19 +0000 Subject: 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 --- src/pandoc.hs | 14 +++++++++----- 1 file 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 -- cgit v1.2.3