13 lines
10 KiB
HTML
13 lines
10 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>System.Console.GetOpt.Utils</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
|
window.onload = function () {pageLoad();setSynopsis("mini_System-Console-GetOpt-Utils.html");};
|
|
//]]>
|
|
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">MissingH-1.3.0.1: Large utility library</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>Copyright (C) 2005-2011 John Goerzen</td></tr><tr><th>License</th><td>BSD3</td></tr><tr><th>Maintainer</th><td>John Goerzen <jgoerzen@complete.org></td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Portability</th><td>portable</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">System.Console.GetOpt.Utils</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Written by John Goerzen, jgoerzen@complete.org</p><p>Utilities for command-line parsing, including wrappers around
|
|
the standard System.Console.GetOpt module.</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:parseCmdLine">parseCmdLine</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-Console-GetOpt.html#t:ArgOrder">ArgOrder</a> a -> [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-Console-GetOpt.html#t:OptDescr">OptDescr</a> a] -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> ([a], [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>])</li><li class="src short"><a href="#v:validateCmdLine">validateCmdLine</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-Console-GetOpt.html#t:ArgOrder">ArgOrder</a> a -> [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-Console-GetOpt.html#t:OptDescr">OptDescr</a> a] -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> (([a], [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]) -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>) -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> ([a], [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>])</li><li class="src short"><span class="keyword">type</span> <a href="#t:StdOption">StdOption</a> = (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</li><li class="src short"><a href="#v:stdRequired">stdRequired</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="System-Console-GetOpt-Utils.html#t:StdOption">StdOption</a></li><li class="src short"><a href="#v:stdOptional">stdOptional</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="System-Console-GetOpt-Utils.html#t:StdOption">StdOption</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a name="v:parseCmdLine" class="def">parseCmdLine</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-Console-GetOpt.html#t:ArgOrder">ArgOrder</a> a -> [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-Console-GetOpt.html#t:OptDescr">OptDescr</a> a] -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> ([a], [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>])</p><div class="doc"><p>Simple command line parser -- a basic wrapper around the system's
|
|
default getOpt. See the System.Console.GetOpt manual for a description of the
|
|
first two parameters.</p><p>The third parameter is a usage information header.</p><p>The return value consists of the list of parsed flags and a list of
|
|
non-option arguments. </p></div></div><div class="top"><p class="src"><a name="v:validateCmdLine" class="def">validateCmdLine</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-Console-GetOpt.html#t:ArgOrder">ArgOrder</a> a -> [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-Console-GetOpt.html#t:OptDescr">OptDescr</a> a] -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> (([a], [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]) -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>) -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> ([a], [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>])</p><div class="doc"><p>Similar to <code><a href="System-Console-GetOpt-Utils.html#v:parseCmdLine">parseCmdLine</a></code>, but takes an additional function that validates
|
|
the post-parse command-line arguments. This is useful, for example, in
|
|
situations where there are two arguments that are mutually-exclusive and only
|
|
one may legitimately be given at a time.</p><p>The return value of the function indicates whether or not it detected an
|
|
error condition. If it returns Nothing, there is no error. If it returns
|
|
Just String, there was an error, described by the String.</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:StdOption" class="def">StdOption</a> = (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</p><div class="doc"><p>A type to standardize some common uses of GetOpt.</p><p>The first component of the tuple is the long name of the option.</p><p>The second component is empty if there is no arg, or has the arg otherwise. </p></div></div><div class="top"><p class="src"><a name="v:stdRequired" class="def">stdRequired</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Name of arg</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="System-Console-GetOpt-Utils.html#t:StdOption">StdOption</a></td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Handle a required argument. </p></div></div><div class="top"><p class="src"><a name="v:stdOptional" class="def">stdOptional</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Name of arg</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="System-Console-GetOpt-Utils.html#t:StdOption">StdOption</a></td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Handle an optional argument. </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.0</p></div></body></html> |