emacs.d/clones/lisp/www.cliki.net/optparser.html
2022-10-07 15:47:14 +02:00

77 lines
No EOL
3.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>CLiki: optparser</title>
<link rel="alternate" type="application/atom+xml" title="ATOM feed of edits to current article"
href="https://www.cliki.net/site/feed/article.atom?title=optparser">
<link rel="stylesheet" href="static/css/style.css">
<link rel="stylesheet" href="static/css/colorize.css">
</head>
<body>
<span class="hidden">CLiki - optparser</span>
<div id="content"><div id="content-area"><div id="article-title">optparser</div><div id="article"><a href="http://web.archive.org/web/20170920102126/http://fraggod.net/prj/lisp_optparser/">optparser</a> is a Unix <a href="command-line&#32;options&#32;parser.html" class="category">command-line options parser</a> for simple shell scripts, geared towards ease-of-use and unambiguity.<p>Inspired by python <a href="https://docs.python.org/3/library/optparse.html">optparse</a> module.<p><h2>Example usage (SBCL)</h2><p><pre>
#!/usr/bin/sbcl --script
(load &quot;/path/to/asdf-init.lisp&quot;)
(asdf:operate &#039;asdf:load-op &#039;optparser)
(optparser:argv-let
(argz
(concurrency (&quot;c&quot; &quot;concurrency&quot; :value t))
(verbose(&quot;v&quot; &quot;verbose&quot;)))
*posix-argv*
(format t
&quot;Arguments: ~s~%Optional values:~% verbose: ~s~% concurrency: ~s~%&quot;
argz verbose concurrency))
~% ./optparser-test.cl somepath1 --verbose somepath2 --concurrency 30
Arguments: (&quot;/usr/bin/sbcl&quot; &quot;somepath1&quot; &quot;somepath2&quot;)
Optional values:
verbose: T
concurrency: &quot;30&quot;
~% ./optparser-test.cl -vc 10 somepath
Arguments: (&quot;/usr/bin/sbcl&quot; &quot;somepath&quot;)
Optional values:
verbose: T
concurrency: &quot;10&quot;
</pre><p><i>Note that <b>*posix-argv*</b> var is SBCL-specific</i></div></div>
<div id="footer" class="buttonbar"><ul><li><a href="optparser.html">Current version</a></li>
<li><a href="https://www.cliki.net/site/history?article=optparser">History</a></li>
<li><a href="https://www.cliki.net/site/backlinks?article=optparser">Backlinks</a></li><li><a href="https://www.cliki.net/site/edit-article?title=optparser&amp;from-revision=3807749987">Edit</a></li><li><a href="https://www.cliki.net/site/edit-article?create=t">Create</a></li></ul></div>
</div>
<div id="header-buttons" class="buttonbar">
<ul>
<li><a href="https://www.cliki.net/">Home</a></li>
<li><a href="https://www.cliki.net/site/recent-changes">Recent Changes</a></li>
<li><a href="CLiki.html">About</a></li>
<li><a href="Text&#32;Formatting.html">Text Formatting</a></li>
<li><a href="https://www.cliki.net/site/tools">Tools</a></li>
</ul>
<div id="search">
<form action="https://www.cliki.net/site/search">
<label for="search_query" class="hidden">Search CLiki</label>
<input type="text" name="query" id="search_query" value="" />
<input type="submit" value="search" />
</form>
</div>
</div>
<div id="pageheader">
<div id="header">
<span id="logo">CLiki</span>
<span id="slogan">the common lisp wiki</span>
<div id="login"><form method="post" action="https://www.cliki.net/site/login">
<label for="login_name" class="hidden">Account name</label>
<input type="text" name="name" id="login_name" class="login_input" />
<label for= "login_password" class="hidden">Password</label>
<input type="password" name="password" id="login_password" class="login_input" />
<input type="submit" name="login" value="login" id="login_submit" /><br />
<div id="register"><a href="https://www.cliki.net/site/register">register</a></div>
<input type="submit" name="reset-pw" value="reset password" id="reset_pw" />
</form>
</div>
</div>
</div>
</body></html>