<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.commands.</code><codeclass="sig-name descname">CommandArgs</code><aclass="headerlink"href="#royalnet.commands.CommandArgs"title="Permalink to this definition">¶</a></dt>
<dd><p>An interface to access the arguments of a command with ease.</p>
<codeclass="sig-name descname">__getitem__</code><spanclass="sig-paren">(</span><emclass="sig-param">item</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.commands.CommandArgs.__getitem__"title="Permalink to this definition">¶</a></dt>
<dd><p>Arguments can be accessed with an array notation, such as <codeclass="docutils literal notranslate"><spanclass="pre">args[0]</span></code>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Raises</dt>
<ddclass="field-odd"><p><aclass="reference internal"href="error.html#royalnet.error.InvalidInputError"title="royalnet.error.InvalidInputError"><strong>royalnet.error.InvalidInputError</strong></a>– if the requested argument does not exist.</p>
<codeclass="sig-name descname">__weakref__</code><aclass="headerlink"href="#royalnet.commands.CommandArgs.__weakref__"title="Permalink to this definition">¶</a></dt>
<dd><p>list of weak references to the object (if defined)</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.commands.CommandArgs.joined">
<codeclass="sig-name descname">joined</code><spanclass="sig-paren">(</span><emclass="sig-param">*</em>, <emclass="sig-param">require_at_least=0</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.commands.CommandArgs.joined"title="Permalink to this definition">¶</a></dt>
<dd><p>Get the arguments as a space-joined string.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>require_at_least</strong>– the minimum amount of arguments required, will raise <aclass="reference internal"href="error.html#royalnet.error.InvalidInputError"title="royalnet.error.InvalidInputError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">royalnet.error.InvalidInputError</span></code></a> if the requirement is not fullfilled.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><aclass="reference internal"href="error.html#royalnet.error.InvalidInputError"title="royalnet.error.InvalidInputError"><strong>royalnet.error.InvalidInputError</strong></a>– if there are less than <codeclass="docutils literal notranslate"><spanclass="pre">require_at_least</span></code> arguments.</p>
<codeclass="sig-name descname">match</code><spanclass="sig-paren">(</span><emclass="sig-param">pattern: Union[str, Pattern]</em><spanclass="sig-paren">)</span>→ Sequence[AnyStr]<aclass="headerlink"href="#royalnet.commands.CommandArgs.match"title="Permalink to this definition">¶</a></dt>
<dd><p>Match the <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">royalnet.utils.commandargs.joined()</span></code> to a regex pattern.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>pattern</strong>– The regex pattern to be passed to <aclass="reference external"href="https://docs.python.org/3.7/library/re.html#re.match"title="(in Python v3.7)"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">re.match()</span></code></a>.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><aclass="reference internal"href="error.html#royalnet.error.InvalidInputError"title="royalnet.error.InvalidInputError"><strong>royalnet.error.InvalidInputError</strong></a>– if the pattern doesn’t match.</p>
</dd>
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The matched groups, as returned by <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">re.Match.groups()</span></code>.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.commands.CommandArgs.optional">
<codeclass="sig-name descname">optional</code><spanclass="sig-paren">(</span><emclass="sig-param">index: int</em>, <emclass="sig-param">default=None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.commands.CommandArgs.optional"title="Permalink to this definition">¶</a></dt>
<dd><p>Get the argument at a specific index, but don’t raise an error if nothing is found, instead returning the <codeclass="docutils literal notranslate"><spanclass="pre">default</span></code> value.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>index</strong>– The index of the argument you want to retrieve.</p></li>
<li><p><strong>default</strong>– The value returned if the argument is missing.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>Either the argument or the <codeclass="docutils literal notranslate"><spanclass="pre">default</span></code> value, defaulting to <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.