cmdr
Artifact [3c070fb5a7]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.

Artifact 3c070fb5a77e596ca4821f46be3c9f78509c80ed:



<html><head>
<title>cmdr::validate::common - Cmdr, a framework for command line parsing and dispatch</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file 'cmdr_vcommon.man' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2013-2016 Andreas Kupries   -- Copyright &copy; 2013-2016 Documentation, Andreas Kupries
   -->
<! -- CVS: $Id$ cmdr::validate::common.n
   -->
<body><div class="doctools">
<hr> [
   <a href="../../../../../../home">Home</a>
| <a href="../../toc.html">Main Table Of Contents</a>
| <a href="../toc.html">Table Of Contents</a>
| <a href="../../index.html">Keyword Index</a>
 ] <hr>
<h1 class="title">cmdr::validate::common(n) 1.2 doc &quot;Cmdr, a framework for command line parsing and dispatch&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>cmdr::validate::common - Cmdr - Utilities for Validation Types</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">API</a></li>
<li class="section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="section"><a href="#keywords">Keywords</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="requirements">
<li>package require <b class="pkgname">cmdr::validate::common</b></li>
</ul>
<ul class="syntax">
<li><a href="#1"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail</b> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-unknown-thing</b> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></li>
<li><a href="#3"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-unknown-thing-msg</b> <i class="arg">msg</i> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-unknown-simple</b> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></li>
<li><a href="#5"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-unknown-simple-msg</b> <i class="arg">msg</i> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></li>
<li><a href="#6"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-known-thing</b> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></li>
<li><a href="#7"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-known-thing-msg</b> <i class="arg">msg</i> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></li>
<li><a href="#8"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-known-simple</b> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></li>
<li><a href="#9"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-known-simple-msg</b> <i class="arg">msg</i> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></li>
<li><a href="#10"><b class="cmd">::cmdr::validate::common</b> <b class="method">complete-enum</b> <i class="arg">choices</i> <i class="arg">nocase</i> <i class="arg">buffer</i></a></li>
<li><a href="#11"><b class="cmd">::cmdr::validate::common</b> <b class="method">complete-substr</b> <i class="arg">choices</i> <i class="arg">nocase</i> <i class="arg">buffer</i></a></li>
<li><a href="#12"><b class="cmd">::cmdr::validate::common</b> <b class="method">complete-glob</b> <i class="arg">filter</i> <i class="arg">buffer</i></a></li>
<li><a href="#13"><b class="cmd">::cmdr::validate::common</b> <b class="method">ok-directory</b> <i class="arg">path</i></a></li>
<li><a href="#14"><b class="cmd">::cmdr::validate::common</b> <b class="method">lead-in</b> <i class="arg">text</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>Welcome to the Cmdr project, written by Andreas Kupries.</p>
<p>For availability please read <i class="term"><a href="cmdr_howto_get_sources.html">Cmdr - How To Get The Sources</a></i>.</p>
<p>This package publicly exports three commands for use in the
implementation of validation types.
The standard validation types defined in package
<b class="package"><a href="cmdr_validate.html">cmdr::validate</a></b> make use of these commands.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">API</a></h2>
<dl class="definitions">
<dt><a name="1"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail</b> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></dt>
<dd><p>When invoked this command throws an error indicating a validation type
failure. The arguments provide the information used to construct both
error message and code.</p>
<p>The generated string has the form:</p>
<pre class="example">
    Expected $type for $p.type &quot;$x&quot;$context, got &quot;$x&quot;
</pre>
<dl class="arguments">
<dt><b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> <i class="arg">p</i></dt>
<dd><p>The <b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> instance whose validation failed.
The error message will contain this parameter's type and label
(flag in case of an option).</p></dd>
<dt>list <i class="arg">code</i></dt>
<dd><p>A list of additional elements for the error code to throw.
Should detail the internal name of the validation type triggering the
error.</p></dd>
<dt>string <i class="arg">type</i></dt>
<dd><p>A string holding a human-readable name for the validation type
triggering the error. (Conversely to the <i class="arg">code</i>, which is for
machine-readability, i.e. trapping)</p></dd>
<dt>string <i class="arg">x</i></dt>
<dd><p>The string value which failed the validation.</p></dd>
<dt>string <i class="arg">context</i></dt>
<dd><p>Additional context to show in the message.
Defaults to the empty string.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-unknown-thing</b> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></dt>
<dd><p>When invoked this command throws an error indicating a validation type
failure. The arguments provide the information used to construct both
error message and code.</p>
<p>The generated string has the form:</p>
<pre class="example">
    Found a problem with $p.type &quot;$p.the-name&quot;:
    A(n) $type named &quot;$x&quot; does not exist$context.
     Please use a different value.
</pre>
<dl class="arguments">
<dt><b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> <i class="arg">p</i></dt>
<dd><p>The <b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> instance whose validation failed.
The error message will contain this parameter's type and label
(flag in case of an option).</p></dd>
<dt>list <i class="arg">code</i></dt>
<dd><p>A list of additional elements for the error code to throw.
Should detail the internal name of the validation type triggering the
error.</p></dd>
<dt>string <i class="arg">type</i></dt>
<dd><p>A string holding a human-readable name for the validation type
triggering the error. (Conversely to the <i class="arg">code</i>, which is for
machine-readability, i.e. trapping)</p></dd>
<dt>string <i class="arg">x</i></dt>
<dd><p>The string value which failed the validation.</p></dd>
<dt>string <i class="arg">context</i></dt>
<dd><p>Additional context to show in the message.
Defaults to the empty string.</p></dd>
</dl></dd>
<dt><a name="3"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-unknown-thing-msg</b> <i class="arg">msg</i> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></dt>
<dd><p>A variant of <b class="method">fail-unknown-thing</b> which takes an additional
user-specified message text as the first argument.</p>
<p>When invoked this command throws an error indicating a validation type
failure. The arguments provide the information used to construct both
error message and code.</p>
<p>The generated string has the form:</p>
<pre class="example">
    Found a problem with $p.type &quot;$p.the-name&quot;:
    A(n) $type named &quot;$x&quot; does not exist$context.
     $msg.
</pre>
<dl class="arguments">
<dt>string <i class="arg">msg</i></dt>
<dd><p>A custom message to put into the generated error message.
See the example above.</p></dd>
<dt><b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> <i class="arg">p</i></dt>
<dd><p>The <b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> instance whose validation failed.
The error message will contain this parameter's type and label
(flag in case of an option).</p></dd>
<dt>list <i class="arg">code</i></dt>
<dd><p>A list of additional elements for the error code to throw.
Should detail the internal name of the validation type triggering the
error.</p></dd>
<dt>string <i class="arg">type</i></dt>
<dd><p>A string holding a human-readable name for the validation type
triggering the error. (Conversely to the <i class="arg">code</i>, which is for
machine-readability, i.e. trapping)</p></dd>
<dt>string <i class="arg">x</i></dt>
<dd><p>The string value which failed the validation.</p></dd>
<dt>string <i class="arg">context</i></dt>
<dd><p>Additional context to show in the message.
Defaults to the empty string.</p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-unknown-simple</b> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></dt>
<dd><p>When invoked this command throws an error indicating a validation type
failure. The arguments provide the information used to construct both
error message and code.</p>
<p>The generated string has the form:</p>
<pre class="example">
    $type &quot;$x&quot; does not exist$context.
     Please use a different value.
</pre>
<dl class="arguments">
<dt><b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> <i class="arg">p</i></dt>
<dd><p>The <b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> instance whose validation failed.
The error message will contain this parameter's type and label
(flag in case of an option).</p></dd>
<dt>list <i class="arg">code</i></dt>
<dd><p>A list of additional elements for the error code to throw.
Should detail the internal name of the validation type triggering the
error.</p></dd>
<dt>string <i class="arg">type</i></dt>
<dd><p>A string holding a human-readable name for the validation type
triggering the error. (Conversely to the <i class="arg">code</i>, which is for
machine-readability, i.e. trapping)</p></dd>
<dt>string <i class="arg">x</i></dt>
<dd><p>The string value which failed the validation.</p></dd>
<dt>string <i class="arg">context</i></dt>
<dd><p>Additional context to show in the message.
Defaults to the empty string.</p></dd>
</dl></dd>
<dt><a name="5"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-unknown-simple-msg</b> <i class="arg">msg</i> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></dt>
<dd><p>A variant of <b class="method">fail-unknown-simple</b> which takes an additional
user-specified message text as the first argument.</p>
<p>When invoked this command throws an error indicating a validation type
failure. The arguments provide the information used to construct both
error message and code.</p>
<p>The generated string has the form:</p>
<pre class="example">
    $type &quot;$x&quot; does not exist$context.
     $msg.
</pre>
<dl class="arguments">
<dt>string <i class="arg">msg</i></dt>
<dd><p>A custom message to put into the generated error message.
See the example above.</p></dd>
<dt><b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> <i class="arg">p</i></dt>
<dd><p>The <b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> instance whose validation failed.
The error message will contain this parameter's type and label
(flag in case of an option).</p></dd>
<dt>list <i class="arg">code</i></dt>
<dd><p>A list of additional elements for the error code to throw.
Should detail the internal name of the validation type triggering the
error.</p></dd>
<dt>string <i class="arg">type</i></dt>
<dd><p>A string holding a human-readable name for the validation type
triggering the error. (Conversely to the <i class="arg">code</i>, which is for
machine-readability, i.e. trapping)</p></dd>
<dt>string <i class="arg">x</i></dt>
<dd><p>The string value which failed the validation.</p></dd>
<dt>string <i class="arg">context</i></dt>
<dd><p>Additional context to show in the message.
Defaults to the empty string.</p></dd>
</dl></dd>
<dt><a name="6"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-known-thing</b> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></dt>
<dd><p>When invoked this command throws an error indicating a validation type
failure. The arguments provide the information used to construct both
error message and code.</p>
<p>The generated string has the form:</p>
<pre class="example">
    Found a problem with $p.type &quot;$p.the-name&quot;:
    A(n) $type named &quot;$x&quot; already exists$context.
     Please use a different name.
</pre>
<dl class="arguments">
<dt><b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> <i class="arg">p</i></dt>
<dd><p>The <b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> instance whose validation failed.
The error message will contain this parameter's type and label
(flag in case of an option).</p></dd>
<dt>list <i class="arg">code</i></dt>
<dd><p>A list of additional elements for the error code to throw.
Should detail the internal name of the validation type triggering the
error.</p></dd>
<dt>string <i class="arg">type</i></dt>
<dd><p>A string holding a human-readable name for the validation type
triggering the error. (Conversely to the <i class="arg">code</i>, which is for
machine-readability, i.e. trapping)</p></dd>
<dt>string <i class="arg">x</i></dt>
<dd><p>The string value which failed the validation.</p></dd>
<dt>string <i class="arg">context</i></dt>
<dd><p>Additional context to show in the message.
Defaults to the empty string.</p></dd>
</dl></dd>
<dt><a name="7"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-known-thing-msg</b> <i class="arg">msg</i> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></dt>
<dd><p>A variant of <b class="method">fail-known-thing</b> which takes an additional
user-specified message text as the first argument.</p>
<p>When invoked this command throws an error indicating a validation type
failure. The arguments provide the information used to construct both
error message and code.</p>
<p>The generated string has the form:</p>
<pre class="example">
    Found a problem with $p.type &quot;$p.the-name&quot;:
    A(n) $type named &quot;$x&quot; already exists$context.
     $msg.
</pre>
<dl class="arguments">
<dt>string <i class="arg">msg</i></dt>
<dd><p>A custom message to put into the generated error message.
See the example above.</p></dd>
<dt><b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> <i class="arg">p</i></dt>
<dd><p>The <b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> instance whose validation failed.
The error message will contain this parameter's type and label
(flag in case of an option).</p></dd>
<dt>list <i class="arg">code</i></dt>
<dd><p>A list of additional elements for the error code to throw.
Should detail the internal name of the validation type triggering the
error.</p></dd>
<dt>string <i class="arg">type</i></dt>
<dd><p>A string holding a human-readable name for the validation type
triggering the error. (Conversely to the <i class="arg">code</i>, which is for
machine-readability, i.e. trapping)</p></dd>
<dt>string <i class="arg">x</i></dt>
<dd><p>The string value which failed the validation.</p></dd>
<dt>string <i class="arg">context</i></dt>
<dd><p>Additional context to show in the message.
Defaults to the empty string.</p></dd>
</dl></dd>
<dt><a name="8"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-known-simple</b> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></dt>
<dd><p>When invoked this command throws an error indicating a validation type
failure. The arguments provide the information used to construct both
error message and code.</p>
<p>The generated string has the form:</p>
<pre class="example">
    $type named &quot;$x&quot; already exists$context.
     Please use a different name.
</pre>
<dl class="arguments">
<dt><b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> <i class="arg">p</i></dt>
<dd><p>The <b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> instance whose validation failed.
The error message will contain this parameter's type and label
(flag in case of an option).</p></dd>
<dt>list <i class="arg">code</i></dt>
<dd><p>A list of additional elements for the error code to throw.
Should detail the internal name of the validation type triggering the
error.</p></dd>
<dt>string <i class="arg">type</i></dt>
<dd><p>A string holding a human-readable name for the validation type
triggering the error. (Conversely to the <i class="arg">code</i>, which is for
machine-readability, i.e. trapping)</p></dd>
<dt>string <i class="arg">x</i></dt>
<dd><p>The string value which failed the validation.</p></dd>
<dt>string <i class="arg">context</i></dt>
<dd><p>Additional context to show in the message.
Defaults to the empty string.</p></dd>
</dl></dd>
<dt><a name="9"><b class="cmd">::cmdr::validate::common</b> <b class="method">fail-known-simple-msg</b> <i class="arg">msg</i> <i class="arg">p</i> <i class="arg">code</i> <i class="arg">type</i> <i class="arg">x</i> <span class="opt">?<i class="arg">context</i>?</span></a></dt>
<dd><p>A variant of <b class="method">fail-known-simple</b> which takes an additional
user-specified message text as the first argument.</p>
<p>When invoked this command throws an error indicating a validation type
failure. The arguments provide the information used to construct both
error message and code.</p>
<p>The generated string has the form:</p>
<pre class="example">
    $type named &quot;$x&quot; already exists$context.
     $msg.
</pre>
<dl class="arguments">
<dt>string <i class="arg">msg</i></dt>
<dd><p>A custom message to put into the generated error message.
See the example above.</p></dd>
<dt><b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> <i class="arg">p</i></dt>
<dd><p>The <b class="package"><a href="cmdr_parameter.html">cmdr::parameter</a></b> instance whose validation failed.
The error message will contain this parameter's type and label
(flag in case of an option).</p></dd>
<dt>list <i class="arg">code</i></dt>
<dd><p>A list of additional elements for the error code to throw.
Should detail the internal name of the validation type triggering the
error.</p></dd>
<dt>string <i class="arg">type</i></dt>
<dd><p>A string holding a human-readable name for the validation type
triggering the error. (Conversely to the <i class="arg">code</i>, which is for
machine-readability, i.e. trapping)</p></dd>
<dt>string <i class="arg">x</i></dt>
<dd><p>The string value which failed the validation.</p></dd>
<dt>string <i class="arg">context</i></dt>
<dd><p>Additional context to show in the message.
Defaults to the empty string.</p></dd>
</dl></dd>
<dt><a name="10"><b class="cmd">::cmdr::validate::common</b> <b class="method">complete-enum</b> <i class="arg">choices</i> <i class="arg">nocase</i> <i class="arg">buffer</i></a></dt>
<dd><p>When invoked this command returns a list of strings containing just
the elements of <i class="arg">choices</i> the value of <i class="arg">buffer</i> is a prefix
of. When <i class="arg">nocase</i> is set the command will ignore letter case and
treat the string in <i class="arg">buffer</i> as all-lowercase.</p>
<dl class="arguments">
<dt>list <i class="arg">choices</i></dt>
<dd><p>The list of values which can complete the data in <i class="arg">buffer</i>.</p></dd>
<dt>boolean <i class="arg">nocase</i></dt>
<dd><p>A boolean flag specifying if the completion is done ignoring
letter-case (<b class="const">true</b>, <b class="const">nocase</b>), or not (<b class="const">false</b>)).</p></dd>
<dt>string <i class="arg">buffer</i></dt>
<dd><p>The string to complete via the list of <i class="arg">choices</i>.</p></dd>
</dl></dd>
<dt><a name="11"><b class="cmd">::cmdr::validate::common</b> <b class="method">complete-substr</b> <i class="arg">choices</i> <i class="arg">nocase</i> <i class="arg">buffer</i></a></dt>
<dd><p>When invoked this command returns a list of strings containing just
the elements of <i class="arg">choices</i> the value of <i class="arg">buffer</i> is a substring
of. When <i class="arg">nocase</i> is set the command will ignore letter case and
treat the string in <i class="arg">buffer</i> as all-lowercase.</p>
<dl class="arguments">
<dt>list <i class="arg">choices</i></dt>
<dd><p>The list of values which can complete the data in <i class="arg">buffer</i>.</p></dd>
<dt>boolean <i class="arg">nocase</i></dt>
<dd><p>A boolean flag specifying if the completion is done ignoring
letter-case (<b class="const">true</b>, <b class="const">nocase</b>), or not (<b class="const">false</b>)).</p></dd>
<dt>string <i class="arg">buffer</i></dt>
<dd><p>The string to complete via the list of <i class="arg">choices</i>.</p></dd>
</dl></dd>
<dt><a name="12"><b class="cmd">::cmdr::validate::common</b> <b class="method">complete-glob</b> <i class="arg">filter</i> <i class="arg">buffer</i></a></dt>
<dd><p>When invoked this command returns a list of strings, the paths in the
filesystem the value of <i class="arg">buffer</i> is a prefix of, and not rejected
by the <i class="arg">filter</i> command (prefix).</p>
<p>Note that when the value of <i class="arg">buffer</i> is a relative path the
current working directory is used to locate matches.</p>
<dl class="arguments">
<dt>cmd-prefix <i class="arg">filter</i></dt>
<dd><p>A command prefix taking a single argument, the candidate path, and
returning a boolean value indicating (non-)acceptance of the path. A
result of <b class="const">true</b> accepts the candidate, <b class="const">false</b> rejects
it.</p></dd>
<dt>string <i class="arg">buffer</i></dt>
<dd><p>The string, a partial path, to complete.</p></dd>
</dl></dd>
<dt><a name="13"><b class="cmd">::cmdr::validate::common</b> <b class="method">ok-directory</b> <i class="arg">path</i></a></dt>
<dd><p>When invoked this command checks if the specified <i class="arg">path</i> is
suitable as a directory and returns the boolean value <b class="const">true</b> if
so, and <b class="const">false</b> else.</p>
<p>for the <i class="arg">path</i> to be suitable the following conditions must hold:</p>
<ol class="enumerated">
<li><p>If the <i class="arg">path</i> exists:</p>
<ol class="enumerated">
<li><p>The path has to refer to a directory.</p></li>
<li><p>The referenced directory must be writable.</p></li>
</ol>
</li>
<li><p>Else:</p>
<ol class="enumerated">
<li><p>The parent path has to pass <b class="cmd">ok-directory</b>.</p></li>
<li><p>The above recursion stops at the root directory, and then fails.</p></li>
</ol>
</li>
</ol>
<dl class="arguments">
<dt>string <i class="arg">path</i></dt>
<dd><p>The path to check.</p></dd>
</dl></dd>
<dt><a name="14"><b class="cmd">::cmdr::validate::common</b> <b class="method">lead-in</b> <i class="arg">text</i></a></dt>
<dd><p>A utility command supporting the construction of error messages. Given the
<i class="arg">text</i> the command returns a modified text with a proper prefix of
either <b class="const">A</b> or <b class="const">An</b>.</p>
<p>The basic heuristics is to use <b class="const">An</b> if <i class="arg">text</i> begins with
a vocal, and <b class="const">A</b> otherwise. This heuristic is bypassed if the the
<i class="arg">text</i> already has a prefix of <b class="const">An</b> or <b class="const">A</b> separated by a
space from the remainder of the string. In that case the <i class="arg">text</i> is
returned as-is.</p>
<p>This command is used by <b class="cmd">fail</b>, <b class="cmd">fail-known-thing</b> and
<b class="cmd">fail-unknown-thing</b> provided by this package. All apply it to their
<i class="arg">type</i> argument.</p>
<dl class="arguments">
<dt>string <i class="arg">text</i></dt>
<dd><p>The string to prefix with a leading <b class="const">A</b> or <b class="const">An</b>.</p></dd>
</dl></dd>
</dl>
</div>
<div id="section3" class="section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>Both the package(s) and this documentation will undoubtedly contain
bugs and other problems.
Please report such at
<a href="https:/core.tcl.tk/akupries/cmdr">Cmdr Tickets</a>.</p>
<p>Please also report any ideas you may have for enhancements of
either package(s) and/or documentation.</p>
</div>
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../index.html#key4">arguments</a>, <a href="../../index.html#key5">command hierarchy</a>, <a href="../../index.html#key9">command line completion</a>, <a href="../../index.html#key11">command line handling</a>, <a href="../../index.html#key13">command tree</a>, <a href="../../index.html#key0">editing command line</a>, <a href="../../index.html#key8">help for command line</a>, <a href="../../index.html#key6">hierarchy of commands</a>, <a href="../../index.html#key3">interactive command shell</a>, <a href="../../index.html#key1">optional arguments</a>, <a href="../../index.html#key2">options</a>, <a href="../../index.html#key12">parameters</a>, <a href="../../index.html#key10">processing command line</a>, <a href="../../index.html#key7">tree of commands</a></p>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2013-2016 Andreas Kupries<br>
Copyright &copy; 2013-2016 Documentation, Andreas Kupries</p>
</div>
</div></body></html>