This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<p>Initial sponsored by <aclass="reference external"href="https://nlnet.nl/discovery">Search and Discovery Fund</a> of <aclass="reference external"href="https://nlnet.nl/">NLnet Foundation</a>.</p>
</aside>
<pid="module-searx.engines.command">With <em>command engines</em> administrators can run engines to integrate arbitrary
shell commands.</p>
<divclass="admonition attention">
<pclass="admonition-title">Attention</p>
<p>When creating and enabling a <codeclass="docutils literal notranslate"><spanclass="pre">command</span></code> engine on a public instance, you
must be careful to avoid leaking private data.</p>
</div>
<p>The easiest solution is to limit the access by setting <codeclass="docutils literal notranslate"><spanclass="pre">tokens</span></code> as described
in section <aclass="reference internal"href="../../../admin/settings/settings_engine.html#private-engines"><spanclass="std std-ref">Private Engines (tokens)</span></a>. The engine base is flexible. Only your
imagination can limit the power of this engine (and maybe security concerns).</p>
<sectionid="configuration">
<h2><aclass="toc-backref"href="#id1"role="doc-backlink">Configuration</a><aclass="headerlink"href="#configuration"title="Link to this heading">¶</a></h2>
<p>The following options are available:</p>
<dl>
<dt><codeclass="docutils literal notranslate"><spanclass="pre">command</span></code>:</dt><dd><p>A comma separated list of the elements of the command. A special token
<codeclass="docutils literal notranslate"><spanclass="pre">{{QUERY}}</span></code> tells where to put the search terms of the user. Example:</p>
<dt><codeclass="docutils literal notranslate"><spanclass="pre">delimiter</span></code>:</dt><dd><p>A mapping containing a delimiter <codeclass="docutils literal notranslate"><spanclass="pre">char</span></code> and the <em>titles</em> of each element in
<dt><codeclass="docutils literal notranslate"><spanclass="pre">parse_regex</span></code>:</dt><dd><p>A dict containing the regular expressions for each result key.</p>
<dt><codeclass="docutils literal notranslate"><spanclass="pre">path</span></code>:</dt><dd><p>Checks if the user provided path is inside the working directory. If not,
the query is not executed.</p>
</dd>
<dt><codeclass="docutils literal notranslate"><spanclass="pre">enum</span></code>:</dt><dd><p>Is a list of allowed search terms. If the user submits something which is
not included in the list, the query returns an error.</p>
</dd>
</dl>
</div></blockquote>
<dlclass="simple">
<dt><codeclass="docutils literal notranslate"><spanclass="pre">query_enum</span></code>:</dt><dd><p>A list containing allowed search terms if <codeclass="docutils literal notranslate"><spanclass="pre">query_type</span></code> is set to <codeclass="docutils literal notranslate"><spanclass="pre">enum</span></code>.</p>
</dd>
<dt><codeclass="docutils literal notranslate"><spanclass="pre">working_dir</span></code>:</dt><dd><p>The directory where the command has to be executed. Default: <codeclass="docutils literal notranslate"><spanclass="pre">./</span></code>.</p>
</dd>
<dt><codeclass="docutils literal notranslate"><spanclass="pre">result_separator</span></code>:</dt><dd><p>The character that separates results. Default: <codeclass="docutils literal notranslate"><spanclass="pre">\n</span></code>.</p>
</dd>
</dl>
</section>
<sectionid="example">
<h2><aclass="toc-backref"href="#id2"role="doc-backlink">Example</a><aclass="headerlink"href="#example"title="Link to this heading">¶</a></h2>
<p>The example engine below can be used to find files with a specific name in the
<h2><aclass="toc-backref"href="#id3"role="doc-backlink">Implementations</a><aclass="headerlink"href="#implementations"title="Link to this heading">¶</a></h2>
<spanclass="sig-prename descclassname"><spanclass="pre">searx.engines.command.</span></span><spanclass="sig-name descname"><spanclass="pre">check_parsing_options</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">engine_settings</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/searx/engines/command.html#check_parsing_options"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#searx.engines.command.check_parsing_options"title="Link to this definition">¶</a></dt>
<dd><p>Checks if delimiter based parsing or regex parsing is configured correctly</p>