Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jun 10, 2024
1 parent b4cdef5 commit e5f07bf
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 51 deletions.
66 changes: 21 additions & 45 deletions dev/_modules/xonsh/commands_cache.html

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions dev/_sources/platform-issues.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,28 @@ You can add aliases to your ``~/.xonshrc`` to have it always
available when xonsh starts.


Working Directory on PATH
^^^^^^^^^^^^^^^^^^^^^^^^^

Windows users, particularly those coming from the ``cmd.exe`` shell,
might be accustomed to being able to run executables from the current
directory by simply typing the program name.

Since version 0.16, ``xonsh`` follows the more secure and modern
approach of not including the current working directory in the search
path, similar to Powershell and popular Unix shells. To invoke commands
in the current directory on any platform, include the current directory
explicitly:

.. code-block:: xonshcon
>>> ./my-program
Although not recommended, to restore the behavior found in the
``cmd.exe`` shell, simply append ``.`` to the ``PATH``:

.. code-block:: xonshcon
>>> $PATH.append('.')
Add that to ``~/.xonshrc`` to enable that as the default behavior.
8 changes: 5 additions & 3 deletions dev/api/_autosummary/helpers/xonsh.commands_cache.html
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,11 @@
<dl class="py method">
<dt class="sig sig-object py" id="xonsh.commands_cache.CommandsCache.get_possible_names">
<span class="sig-name descname"><span class="pre">get_possible_names</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/xonsh/commands_cache.html#CommandsCache.get_possible_names"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#xonsh.commands_cache.CommandsCache.get_possible_names" title="Link to this definition"></a></dt>
<dd><p>Generates the possible <cite>PATHEXT</cite> extension variants of a given executable
name on Windows as a list, conserving the ordering in <cite>PATHEXT</cite>.
Returns a list as <cite>name</cite> being the only item in it on other platforms.</p>
<dd><p>Expand name to all possible variants based on <cite>PATHEXT</cite>.</p>
<p>PATHEXT is a Windows convention containing extensions to be
considered when searching for an executable file.</p>
<p>Conserves order of any extensions found and gives precedence
to the bare name.</p>
</dd></dl>

<dl class="py method">
Expand Down
4 changes: 2 additions & 2 deletions dev/envvars.html
Original file line number Diff line number Diff line change
Expand Up @@ -734,15 +734,15 @@ <h1>Environment Variables<a class="headerlink" href="#environment-variables" tit
<span id="id5"></span><h3>$HOSTNAME<a class="headerlink" href="#hostname" title="Link to this heading"></a></h3>
<p>Automatically set to the name of the current host.</p>
<p><strong>configurable:</strong> True</p>
<p><strong>default:</strong> &lt;function GeneralSetting.&lt;lambda&gt; at 0x7f74794353f0&gt;</p>
<p><strong>default:</strong> &lt;function GeneralSetting.&lt;lambda&gt; at 0x7fd3aa5453f0&gt;</p>
<p><strong>store_as_str:</strong> False</p>
<hr class="docutils" />
</section>
<section id="hosttype">
<span id="id6"></span><h3>$HOSTTYPE<a class="headerlink" href="#hosttype" title="Link to this heading"></a></h3>
<p>Automatically set to a string that fully describes the system type on which xonsh is executing.</p>
<p><strong>configurable:</strong> True</p>
<p><strong>default:</strong> &lt;function GeneralSetting.&lt;lambda&gt; at 0x7f7479435480&gt;</p>
<p><strong>default:</strong> &lt;function GeneralSetting.&lt;lambda&gt; at 0x7fd3aa545480&gt;</p>
<p><strong>store_as_str:</strong> False</p>
<hr class="docutils" />
</section>
Expand Down
21 changes: 21 additions & 0 deletions dev/platform-issues.html
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,26 @@ <h3>Name space conflicts<a class="headerlink" href="#name-space-conflicts" title
<p>You can add aliases to your <code class="docutils literal notranslate"><span class="pre">~/.xonshrc</span></code> to have it always
available when xonsh starts.</p>
</section>
<section id="working-directory-on-path">
<h3>Working Directory on PATH<a class="headerlink" href="#working-directory-on-path" title="Link to this heading"></a></h3>
<p>Windows users, particularly those coming from the <code class="docutils literal notranslate"><span class="pre">cmd.exe</span></code> shell,
might be accustomed to being able to run executables from the current
directory by simply typing the program name.</p>
<p>Since version 0.16, <code class="docutils literal notranslate"><span class="pre">xonsh</span></code> follows the more secure and modern
approach of not including the current working directory in the search
path, similar to Powershell and popular Unix shells. To invoke commands
in the current directory on any platform, include the current directory
explicitly:</p>
<div class="highlight-xonshcon notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="o">./</span><span class="n">my</span><span class="o">-</span><span class="n">program</span>
</pre></div>
</div>
<p>Although not recommended, to restore the behavior found in the
<code class="docutils literal notranslate"><span class="pre">cmd.exe</span></code> shell, simply append <code class="docutils literal notranslate"><span class="pre">.</span></code> to the <code class="docutils literal notranslate"><span class="pre">PATH</span></code>:</p>
<div class="highlight-xonshcon notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nv">$PATH</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">&#39;.&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>Add that to <code class="docutils literal notranslate"><span class="pre">~/.xonshrc</span></code> to enable that as the default behavior.</p>
</section>
</section>
</section>

Expand Down Expand Up @@ -679,6 +699,7 @@ <h3>Name space conflicts<a class="headerlink" href="#name-space-conflicts" title
<li><a class="reference internal" href="#nice-colors">Nice colors</a></li>
<li><a class="reference internal" href="#avoid-locking-the-working-directory">Avoid locking the working directory</a></li>
<li><a class="reference internal" href="#name-space-conflicts">Name space conflicts</a></li>
<li><a class="reference internal" href="#working-directory-on-path">Working Directory on PATH</a></li>
</ul>
</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion dev/searchindex.js

Large diffs are not rendered by default.

0 comments on commit e5f07bf

Please sign in to comment.