git.iko.soy/typeable/pandoc
on master help sign in
Changed usage message so that it is more compact (and slightly

less informative). It's important that it be able to fit on one screen. git-svn-id: https://pandoc.googlecode.com/svn/trunk@351 788f1e2b-df1e-0410-8736-df70ead52e1b

commit68122303c0f39d0ef23338d401898d4300cdd95f authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSun 31 Dec 2006, 01:12 (20 years ago) parentcf53a18
1 file changed+32−34
src/Main.hs+32−34
src/Main.hs+32−34
@@ -144,75 +144,73 @@ options =
144144 (ReqArg
145145 (\arg opt -> return opt { optReader = map toLower arg })
146146 "FORMAT")
147− ("Input format (" ++ (joinWithSep ", " (map fst readers)) ++
148− ")")
147+ "" -- ("(" ++ (joinWithSep ", " (map fst readers)) ++ ")")
149148
150149 , Option "tw" ["to","write"]
151150 (ReqArg
152151 (\arg opt -> return opt { optWriter = map toLower arg })
153152 "FORMAT")
154− ("Output format (" ++ (joinWithSep ", " (map fst writers)) ++
155− ")")
153+ "" -- ("(" ++ (joinWithSep ", " (map fst writers)) ++ ")")
156154
157155 , Option "s" ["standalone"]
158156 (NoArg
159157 (\opt -> return opt { optStandalone = True }))
160− "Include needed header and footer on output"
158+ "" -- "Include needed header and footer on output"
161159
162160 , Option "o" ["output"]
163161 (ReqArg
164162 (\arg opt -> return opt { optOutputFile = arg })
165163 "FILENAME")
166− "Name of output file"
164+ "" -- "Name of output file"
167165
168166 , Option "p" ["preserve-tabs"]
169167 (NoArg
170168 (\opt -> return opt { optPreserveTabs = True }))
171− "Preserve tabs instead of converting to spaces"
169+ "" -- "Preserve tabs instead of converting to spaces"
172170
173171 , Option "" ["tab-stop"]
174172 (ReqArg
175173 (\arg opt -> return opt { optTabStop = (read arg) } )
176174 "TABSTOP")
177− "Tab stop (default 4)"
175+ "" -- "Tab stop (default 4)"
178176
179177 , Option "" ["strict"]
180178 (NoArg
181179 (\opt -> return opt { optStrict = True } ))
182− "Use strict markdown syntax with no extensions"
180+ "" -- "Use strict markdown syntax with no extensions"
183181
184182 , Option "R" ["parse-raw"]
185183 (NoArg
186184 (\opt -> return opt { optParseRaw = True }))
187− "Parse untranslatable HTML codes and LaTeX environments as raw"
185+ "" -- "Parse untranslatable HTML codes and LaTeX environments as raw"
188186
189187 , Option "S" ["smart"]
190188 (NoArg
191189 (\opt -> return opt { optSmart = True }))
192− "Use smart quotes, dashes, and ellipses in HTML output"
190+ "" -- "Use smart quotes, dashes, and ellipses in HTML output"
193191
194192 , Option "m" ["asciimathml"]
195193 (NoArg
196194 (\opt -> return opt { optASCIIMathML = True,
197195 optStandalone = True }))
198− "Use ASCIIMathML script in html output"
196+ "" -- "Use ASCIIMathML script in html output"
199197
200198 , Option "i" ["incremental"]
201199 (NoArg
202200 (\opt -> return opt { optIncremental = True }))
203− "Make list items display incrementally in S5"
201+ "" -- "Make list items display incrementally in S5"
204202
205203 , Option "N" ["number-sections"]
206204 (NoArg
207205 (\opt -> return opt { optNumberSections = True }))
208− "Number sections in LaTeX"
206+ "" -- "Number sections in LaTeX"
209207
210208 , Option "c" ["css"]
211209 (ReqArg
212210 (\arg opt -> return opt { optCSS = arg,
213211 optStandalone = True })
214212 "CSS")
215− "Link to CSS style sheet"
213+ "" -- "Link to CSS style sheet"
216214
217215 , Option "H" ["include-in-header"]
218216 (ReqArg
@@ -221,7 +219,7 @@ options =
221219 return opt { optIncludeInHeader = text,
222220 optStandalone = True })
223221 "FILENAME")
224− "File to include at end of header (implies -s)"
222+ "" -- "File to include at end of header (implies -s)"
225223
226224 , Option "B" ["include-before-body"]
227225 (ReqArg
@@ -229,7 +227,7 @@ options =
229227 text <- readFile arg
230228 return opt { optIncludeBeforeBody = text })
231229 "FILENAME")
232− "File to include before document body"
230+ "" -- "File to include before document body"
233231
234232 , Option "A" ["include-after-body"]
235233 (ReqArg
@@ -237,7 +235,7 @@ options =
237235 text <- readFile arg
238236 return opt { optIncludeAfterBody = text })
239237 "FILENAME")
240− "File to include after document body"
238+ "" -- "File to include after document body"
241239
242240 , Option "C" ["custom-header"]
243241 (ReqArg
@@ -246,14 +244,14 @@ options =
246244 return opt { optCustomHeader = text,
247245 optStandalone = True })
248246 "FILENAME")
249− "File to use for custom header (implies -s)"
247+ "" -- "File to use for custom header (implies -s)"
250248
251249 , Option "T" ["title-prefix"]
252250 (ReqArg
253251 (\arg opt -> return opt { optTitlePrefix = arg,
254252 optStandalone = True })
255253 "STRING")
256− "String to prefix to HTML window title"
254+ "" -- "String to prefix to HTML window title"
257255
258256 , Option "D" ["print-default-header"]
259257 (ReqArg
@@ -264,12 +262,12 @@ options =
264262 hPutStr stdout header
265263 exitWith ExitSuccess)
266264 "FORMAT")
267− "Print default header for FORMAT"
265+ "" -- "Print default header for FORMAT"
268266
269267 , Option "d" ["debug"]
270268 (NoArg
271269 (\opt -> return opt { optDebug = True }))
272− "Print debug messages to stderr, output to stdout"
270+ "" -- "Print debug messages to stderr, output to stdout"
273271
274272 , Option "v" ["version"]
275273 (NoArg
@@ -278,24 +276,25 @@ options =
278276 hPutStrLn stderr (prg ++ " " ++ version ++
279277 copyrightMessage)
280278 exitWith $ ExitFailure 2))
281− "Print version"
279+ "" -- "Print version"
282280
283281 , Option "h" ["help"]
284282 (NoArg
285283 (\_ -> do
286284 prg <- getProgName
287− hPutStr stderr (reformatUsageInfo $
288− usageInfo (prg ++ " [OPTIONS] [FILES]") options)
285+ hPutStr stderr (usageMessage prg options)
289286 exitWith $ ExitFailure 2))
290− "Show help"
287+ "" -- "Show help"
291288 ]
292289
293−-- Reformat usage message so it doesn't wrap illegibly
294−reformatUsageInfo :: String -> String
295−reformatUsageInfo = gsub " *--" " --" .
296− gsub "(-[A-Za-z0-9]) *--" "\\1, --" .
297− gsub " *([^- ])" "\n\t\\1"
298−
290+-- Returns usage message
291+usageMessage :: String -> [OptDescr (Opt -> IO Opt)] -> String
292+usageMessage programName options = usageInfo
293+ (programName ++ " [OPTIONS] [FILES]" ++ "\nInput formats: " ++
294+ joinWithSep ", " (map fst readers) ++ "\nOutput formats: " ++
295+ joinWithSep ", " (map fst writers) ++ "\nOptions:")
296+ options
297+
299298-- Determine default reader based on source file extensions
300299defaultReaderName :: [String] -> String
301300defaultReaderName [] = "markdown"
@@ -343,8 +342,7 @@ main = do
343342 then do
344343 name <- getProgName
345344 mapM (\e -> hPutStrLn stderr e) errors
346− hPutStrLn stderr (reformatUsageInfo $
347− usageInfo (name ++ " [OPTIONS] [FILES]") options)
345+ hPutStr stderr (usageMessage name options)
348346 exitWith $ ExitFailure 2
349347 else
350348 return ()