mirror of
https://github.com/evennia/evennia.git
synced 2026-03-19 06:16:31 +01:00
393 lines
No EOL
28 KiB
HTML
393 lines
No EOL
28 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||
|
||
<title>evennia.contrib.unixcommand — Evennia 0.9.5 documentation</title>
|
||
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
|
||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||
<script src="../_static/jquery.js"></script>
|
||
<script src="../_static/underscore.js"></script>
|
||
<script src="../_static/doctools.js"></script>
|
||
<script src="../_static/language_data.js"></script>
|
||
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||
<script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"processClass": "tex2jax_process|mathjax_process|math|output_area"}})</script>
|
||
<link rel="shortcut icon" href="../_static/favicon.ico"/>
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
</head><body>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
accesskey="I">index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 0.9.5</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.contrib.unixcommand</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section id="module-evennia.contrib.unixcommand">
|
||
<span id="evennia-contrib-unixcommand"></span><h1>evennia.contrib.unixcommand<a class="headerlink" href="#module-evennia.contrib.unixcommand" title="Permalink to this headline">¶</a></h1>
|
||
<p>Unix-like Command style parent</p>
|
||
<p>Evennia contribution, Vincent Le Geoff 2017</p>
|
||
<p>This module contains a command class that allows for unix-style command syntax in-game, using
|
||
–options, positional arguments and stuff like -n 10 etc similarly to a unix command. It might not
|
||
the best syntax for the average player but can be really useful for builders when they need to have
|
||
a single command do many things with many options. It uses the ArgumentParser from Python’s standard
|
||
library under the hood.</p>
|
||
<p>To use, inherit <strong>UnixCommand</strong> from this module from your own commands. You need
|
||
to override two methods:</p>
|
||
<ul class="simple">
|
||
<li><dl class="simple">
|
||
<dt>The <strong>init_parser</strong> method, which adds options to the parser. Note that you should normally</dt><dd><p><em>not</em> override the normal <strong>parse</strong> method when inheriting from <strong>UnixCommand</strong>.</p>
|
||
</dd>
|
||
</dl>
|
||
</li>
|
||
<li><p>The <strong>func</strong> method, called to execute the command once parsed (like any Command).</p></li>
|
||
</ul>
|
||
<p>Here’s a short example:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">CmdPlant</span><span class="p">(</span><span class="n">UnixCommand</span><span class="p">):</span>
|
||
|
||
<span class="sd">'''</span>
|
||
<span class="sd"> Plant a tree or plant.</span>
|
||
|
||
<span class="sd"> This command is used to plant something in the room you are in.</span>
|
||
|
||
<span class="sd"> Examples:</span>
|
||
<span class="sd"> plant orange -a 8</span>
|
||
<span class="sd"> plant strawberry --hidden</span>
|
||
<span class="sd"> plant potato --hidden --age 5</span>
|
||
|
||
<span class="sd"> '''</span>
|
||
|
||
<span class="n">key</span> <span class="o">=</span> <span class="s2">"plant"</span>
|
||
|
||
<span class="k">def</span> <span class="nf">init_parser</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||
<span class="s2">"Add the arguments to the parser."</span>
|
||
<span class="c1"># 'self.parser' inherits **argparse.ArgumentParser**</span>
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"key"</span><span class="p">,</span>
|
||
<span class="n">help</span><span class="o">=</span><span class="s2">"the key of the plant to be planted here"</span><span class="p">)</span>
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"-a"</span><span class="p">,</span> <span class="s2">"--age"</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">,</span>
|
||
<span class="n">default</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">help</span><span class="o">=</span><span class="s2">"the age of the plant to be planted"</span><span class="p">)</span>
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--hidden"</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">"store_true"</span><span class="p">,</span>
|
||
<span class="n">help</span><span class="o">=</span><span class="s2">"should the newly-planted plant be hidden to players?"</span><span class="p">)</span>
|
||
|
||
<span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||
<span class="s2">"func is called only if the parser succeeded."</span>
|
||
<span class="c1"># 'self.opts' contains the parsed options</span>
|
||
<span class="n">key</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">opts</span><span class="o">.</span><span class="n">key</span>
|
||
<span class="n">age</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">opts</span><span class="o">.</span><span class="n">age</span>
|
||
<span class="n">hidden</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">opts</span><span class="o">.</span><span class="n">hidden</span>
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">"Going to plant '</span><span class="si">{}</span><span class="s2">', age=</span><span class="si">{}</span><span class="s2">, hidden=</span><span class="si">{}</span><span class="s2">."</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
|
||
<span class="n">key</span><span class="p">,</span> <span class="n">age</span><span class="p">,</span> <span class="n">hidden</span><span class="p">))</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>To see the full power of argparse and the types of supported options, visit
|
||
[the documentation of argparse](<a class="reference external" href="https://docs.python.org/2/library/argparse.html">https://docs.python.org/2/library/argparse.html</a>).</p>
|
||
<dl class="py exception">
|
||
<dt id="evennia.contrib.unixcommand.ParseError">
|
||
<em class="property">exception </em><code class="sig-prename descclassname">evennia.contrib.unixcommand.</code><code class="sig-name descname">ParseError</code><a class="reference internal" href="../_modules/evennia/contrib/unixcommand.html#ParseError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.unixcommand.ParseError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
|
||
<p>An error occurred during parsing.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommandParser">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.unixcommand.</code><code class="sig-name descname">UnixCommandParser</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">prog</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">''</span></em>, <em class="sig-param"><span class="n">epilog</span><span class="o">=</span><span class="default_value">''</span></em>, <em class="sig-param"><span class="n">command</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/unixcommand.html#UnixCommandParser"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommandParser" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">argparse.ArgumentParser</span></code></p>
|
||
<p>A modifier command parser for unix commands.</p>
|
||
<p>This parser is used to replace <strong>argparse.ArgumentParser</strong>. It
|
||
is aware of the command calling it, and can more easily report to
|
||
the caller. Some features (like the “brutal exit” of the original
|
||
parser) are disabled or replaced. This parser is used by UnixCommand
|
||
and creating one directly isn’t recommended nor necessary. Even
|
||
adding a sub-command will use this replaced parser automatically.</p>
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommandParser.__init__">
|
||
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">prog</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">''</span></em>, <em class="sig-param"><span class="n">epilog</span><span class="o">=</span><span class="default_value">''</span></em>, <em class="sig-param"><span class="n">command</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/unixcommand.html#UnixCommandParser.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommandParser.__init__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Build a UnixCommandParser with a link to the command using it.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>prog</strong> (<em>str</em>) – the program name (usually the command key).</p></li>
|
||
<li><p><strong>description</strong> (<em>str</em>) – a very brief line to show in the usage text.</p></li>
|
||
<li><p><strong>epilog</strong> (<em>str</em>) – the epilog to show below options.</p></li>
|
||
<li><p><strong>command</strong> (<a class="reference internal" href="evennia.commands.command.html#evennia.commands.command.Command" title="evennia.commands.command.Command"><em>Command</em></a>) – the command calling the parser.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><strong>keyword arguments are directly sent to</strong> (<em>Additional</em>) – </p></li>
|
||
<li><p><strong>You will find them on the</strong> (<em>argparse.ArgumentParser.</em>) – </p></li>
|
||
<li><p><strong>documentation</strong><strong>]</strong><strong>(</strong><strong>https</strong> (<em>[</em><em>parser's</em>) – //docs.python.org/2/library/argparse.html).</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>It’s doubtful you would need to create this parser manually.
|
||
The <strong>UnixCommand</strong> does that automatically. If you create
|
||
sub-commands, this class will be used.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommandParser.format_usage">
|
||
<code class="sig-name descname">format_usage</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/unixcommand.html#UnixCommandParser.format_usage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommandParser.format_usage" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return the usage line.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This method is present to return the raw-escaped usage line,
|
||
in order to avoid unintentional color codes.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommandParser.format_help">
|
||
<code class="sig-name descname">format_help</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/unixcommand.html#UnixCommandParser.format_help"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommandParser.format_help" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return the parser help, including its epilog.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This method is present to return the raw-escaped help,
|
||
in order to avoid unintentional color codes. Color codes
|
||
in the epilog (the command docstring) are supported.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommandParser.print_usage">
|
||
<code class="sig-name descname">print_usage</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">file</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/unixcommand.html#UnixCommandParser.print_usage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommandParser.print_usage" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Print the usage to the caller.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>file</strong> (<em>file-object</em>) – not used here, the caller is used.</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This method will override <strong>argparse.ArgumentParser</strong>’s in order
|
||
to not display the help on stdout or stderr, but to the
|
||
command’s caller.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommandParser.print_help">
|
||
<code class="sig-name descname">print_help</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">file</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/unixcommand.html#UnixCommandParser.print_help"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommandParser.print_help" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Print the help to the caller.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>file</strong> (<em>file-object</em>) – not used here, the caller is used.</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This method will override <strong>argparse.ArgumentParser</strong>’s in order
|
||
to not display the help on stdout or stderr, but to the
|
||
command’s caller.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.contrib.unixcommand.HelpAction">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.unixcommand.</code><code class="sig-name descname">HelpAction</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">option_strings</span></em>, <em class="sig-param"><span class="n">dest</span></em>, <em class="sig-param"><span class="n">nargs</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">const</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">type</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">choices</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">required</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="n">help</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metavar</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/unixcommand.html#HelpAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.unixcommand.HelpAction" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">argparse.Action</span></code></p>
|
||
<p>Override the -h/–help action in the default parser.</p>
|
||
<p>Using the default -h/–help will call the exit function in different
|
||
ways, preventing the entire help message to be provided. Hence
|
||
this override.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommand">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.unixcommand.</code><code class="sig-name descname">UnixCommand</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/unixcommand.html#UnixCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommand" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <a class="reference internal" href="evennia.commands.command.html#evennia.commands.command.Command" title="evennia.commands.command.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.command.Command</span></code></a></p>
|
||
<p>Unix-type commands, supporting short and long options.</p>
|
||
<p>This command syntax uses the Unix-style commands with short options
|
||
(-X) and long options (–something). The <strong>argparse</strong> module is
|
||
used to parse the command.</p>
|
||
<p>In order to use it, you should override two methods:
|
||
- <strong>init_parser</strong>: this method is called when the command is created.</p>
|
||
<blockquote>
|
||
<div><p>It can be used to set options in the parser. <strong>self.parser</strong>
|
||
contains the <strong>argparse.ArgumentParser</strong>, so you can add arguments
|
||
here.</p>
|
||
</div></blockquote>
|
||
<ul class="simple">
|
||
<li><p><strong>func</strong>: this method is called to execute the command, but after
|
||
the parser has checked the arguments given to it are valid.
|
||
You can access the namespace of valid arguments in <strong>self.opts</strong>
|
||
at this point.</p></li>
|
||
</ul>
|
||
<p>The help of UnixCommands is derived from the docstring, in a
|
||
slightly different way than usual: the first line of the docstring
|
||
is used to represent the program description (the very short
|
||
line at the top of the help message). The other lines below are
|
||
used as the program’s “epilog”, displayed below the options. It
|
||
means in your docstring, you don’t have to write the options.
|
||
They will be automatically provided by the parser and displayed
|
||
accordingly. The <strong>argparse</strong> module provides a default ‘-h’ or
|
||
‘–help’ option on the command. Typing <a href="#id1"><span class="problematic" id="id2">|</span></a>whelp commandname|n will
|
||
display the same as <a href="#id3"><span class="problematic" id="id4">|</span></a>wcommandname -h|n, though this behavior can
|
||
be changed.</p>
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommand.__init__">
|
||
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/unixcommand.html#UnixCommand.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommand.__init__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The lockhandler works the same as for objects.
|
||
optional kwargs will be set as properties on the Command at runtime,
|
||
overloading evential same-named class properties.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommand.init_parser">
|
||
<code class="sig-name descname">init_parser</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/unixcommand.html#UnixCommand.init_parser"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommand.init_parser" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Configure the argument parser, adding in options.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This method is to be overridden in order to add options
|
||
to the argument parser. Use <strong>self.parser</strong>, which contains
|
||
the <strong>argparse.ArgumentParser</strong>. You can, for instance,
|
||
use its <strong>add_argument</strong> method.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommand.func">
|
||
<code class="sig-name descname">func</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/unixcommand.html#UnixCommand.func"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommand.func" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Override to handle the command execution.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommand.get_help">
|
||
<code class="sig-name descname">get_help</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">caller</span></em>, <em class="sig-param"><span class="n">cmdset</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/unixcommand.html#UnixCommand.get_help"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommand.get_help" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return the help message for this command and this caller.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>caller</strong> (<em>Object</em><em> or </em><em>Player</em>) – the caller asking for help on the command.</p></li>
|
||
<li><p><strong>cmdset</strong> (<a class="reference internal" href="evennia.commands.cmdset.html#evennia.commands.cmdset.CmdSet" title="evennia.commands.cmdset.CmdSet"><em>CmdSet</em></a>) – the command set (if you need additional commands).</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><em>docstring (str)</em> – the help text to provide the caller for this command.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommand.parse">
|
||
<code class="sig-name descname">parse</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/unixcommand.html#UnixCommand.parse"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommand.parse" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Process arguments provided in <strong>self.args</strong>.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>You should not override this method. Consider overriding
|
||
<strong>init_parser</strong> instead.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommand.aliases">
|
||
<code class="sig-name descname">aliases</code><em class="property"> = []</em><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommand.aliases" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommand.help_category">
|
||
<code class="sig-name descname">help_category</code><em class="property"> = 'general'</em><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommand.help_category" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommand.key">
|
||
<code class="sig-name descname">key</code><em class="property"> = 'command'</em><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommand.key" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.unixcommand.UnixCommand.lock_storage">
|
||
<code class="sig-name descname">lock_storage</code><em class="property"> = 'cmd:all();'</em><a class="headerlink" href="#evennia.contrib.unixcommand.UnixCommand.lock_storage" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
|
||
|
||
<div class="clearer"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<p class="logo"><a href="../index.html">
|
||
<img class="logo" src="../_static/evennia_logo.png" alt="Logo"/>
|
||
</a></p>
|
||
<div id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="../search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>$('#searchbox').show(0);</script>
|
||
<div role="note" aria-label="source link">
|
||
<!--h3>This Page</h3-->
|
||
<ul class="this-page-menu">
|
||
<li><a href="../_sources/api/evennia.contrib.unixcommand.md.txt"
|
||
rel="nofollow">Show Page Source</a></li>
|
||
</ul>
|
||
</div><h3>Links</h3>
|
||
<ul>
|
||
<li><a href="https://www.evennia.com">Home page</a> </li>
|
||
<li><a href="https://github.com/evennia/evennia">Evennia Github</a> </li>
|
||
<li><a href="http://games.evennia.com">Game Index</a> </li>
|
||
<li><a href="http://webchat.freenode.net/?channels=evennia&uio=MT1mYWxzZSY5PXRydWUmMTE9MTk1JjEyPXRydWUbb">IRC</a> -
|
||
<a href="https://discord.gg/NecFePw">Discord</a> -
|
||
<a href="https://groups.google.com/forum/#%21forum/evennia">Forums</a>
|
||
</li>
|
||
<li><a href="http://evennia.blogspot.com/">Evennia Dev blog</a> </li>
|
||
</ul>
|
||
<h3>Versions</h3>
|
||
<ul>
|
||
<li><a href="../../1.0-dev/index.html">1.0-dev (develop branch)</a></li>
|
||
<li><a href="evennia.contrib.unixcommand.html">0.9.5 (v0.9.5 branch)</a></li>
|
||
</ul>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
>index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 0.9.5</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.contrib.unixcommand</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2020, The Evennia developer community.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
|
||
</div>
|
||
</body>
|
||
</html> |