Skip to content

Commit

Permalink
Add tip about referencing env vars for args in powershell (nat-n#173) c…
Browse files Browse the repository at this point in the history
  • Loading branch information
kzrnm committed Nov 4, 2023
1 parent 1cca1a8 commit 7b22ab9
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 9 deletions.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
Binary file modified .doctrees/guides/args_guide.doctree
Binary file not shown.
Binary file modified .doctrees/tasks/task_types/switch.doctree
Binary file not shown.
3 changes: 3 additions & 0 deletions _sources/guides/args_guide.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ The resulting task can be run like:
poe passby --planet mars
.. TIP::
For PowerShell tasks, the variable needs to be referenced as an environment variable in the shell code, e.g., :code:`$env:planet`.

Arguments for script tasks
~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
8 changes: 4 additions & 4 deletions _sources/tasks/task_types/switch.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ This can be used to define a task that runs a different subtask depending on whi
[tool.poe.tasks.build]
control.expr = "sys.platform"
[[tool.poe.tasks.platform_dependent.switch]]
[[tool.poe.tasks.build.switch]]
case = "win32"
cmd = "windows_build"
[[tool.poe.tasks.platform_dependent.switch]]
[[tool.poe.tasks.build.switch]]
cmd = "posix_build"
In the above example the control task is an :doc:`expression <expr>` that checks the value of ``sys.platform``, and if running on windows it'll execute :toml:`windows_build`, otherwise it'll fall back to the default case (i.e. the switch item with no case option defined) and execute :toml:`posix_build`.
Expand Down Expand Up @@ -42,7 +42,7 @@ array of values like so:

.. code-block:: toml
[[tool.poe.tasks.platform_dependent.switch]]
[[tool.poe.tasks.build.switch]]
case = ["linux", "darwin"]
cmd = "build"
Expand All @@ -59,7 +59,7 @@ the switch task to pass and simply do nothing by providing the 'default' option
control.expr = "sys.platform"
default = "pass"
[[tool.poe.tasks.platform_dependent.switch]]
[[tool.poe.tasks.build-on-windows.switch]]
case = "win32"
cmd = "build"
Expand Down
4 changes: 4 additions & 0 deletions guides/args_guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@ <h2>Arguments for cmd and shell tasks<a class="headerlink" href="#arguments-for-
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>poe<span class="w"> </span>passby<span class="w"> </span>--planet<span class="w"> </span>mars
</pre></div>
</div>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>For PowerShell tasks, the variable needs to be referenced as an environment variable in the shell code, e.g., <code class="code docutils literal notranslate"><span class="pre">$env:planet</span></code>.</p>
</div>
</section>
<section id="arguments-for-script-tasks">
<h2>Arguments for script tasks<a class="headerlink" href="#arguments-for-script-tasks" title="Permalink to this heading">#</a></h2>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions tasks/task_types/switch.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,11 @@ <h1><code class="docutils literal notranslate"><span class="pre">switch</span></
<div class="highlight-toml notranslate"><div class="highlight"><pre><span></span><span class="k">[tool.poe.tasks.build]</span>
<span class="n">control</span><span class="p">.</span><span class="n">expr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;sys.platform&quot;</span>

<span class="w"> </span><span class="k">[[tool.poe.tasks.platform_dependent.switch]]</span>
<span class="w"> </span><span class="k">[[tool.poe.tasks.build.switch]]</span>
<span class="w"> </span><span class="n">case</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;win32&quot;</span>
<span class="w"> </span><span class="n">cmd</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;windows_build&quot;</span>

<span class="w"> </span><span class="k">[[tool.poe.tasks.platform_dependent.switch]]</span>
<span class="w"> </span><span class="k">[[tool.poe.tasks.build.switch]]</span>
<span class="w"> </span><span class="n">cmd</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;posix_build&quot;</span>
</pre></div>
</div>
Expand All @@ -269,7 +269,7 @@ <h2>Available task options<a class="headerlink" href="#available-task-options" t
<h2>Multiple values per case<a class="headerlink" href="#multiple-values-per-case" title="Permalink to this heading">#</a></h2>
<p>It is also possible to define multiple values for a single case option by providing a
array of values like so:</p>
<div class="highlight-toml notranslate"><div class="highlight"><pre><span></span><span class="k">[[tool.poe.tasks.platform_dependent.switch]]</span>
<div class="highlight-toml notranslate"><div class="highlight"><pre><span></span><span class="k">[[tool.poe.tasks.build.switch]]</span>
<span class="n">case</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="s">&quot;linux&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;darwin&quot;</span><span class="p">]</span>
<span class="n">cmd</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;build&quot;</span>
</pre></div>
Expand All @@ -284,7 +284,7 @@ <h2>Don’t fail if there’s no match<a class="headerlink" href="#don-t-fail-if
<span class="n">control</span><span class="p">.</span><span class="n">expr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;sys.platform&quot;</span>
<span class="n">default</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;pass&quot;</span>

<span class="w"> </span><span class="k">[[tool.poe.tasks.platform_dependent.switch]]</span>
<span class="w"> </span><span class="k">[[tool.poe.tasks.build-on-windows.switch]]</span>
<span class="w"> </span><span class="n">case</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;win32&quot;</span>
<span class="w"> </span><span class="n">cmd</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;build&quot;</span>
</pre></div>
Expand Down

0 comments on commit 7b22ab9

Please sign in to comment.