Execline: Difference between revisions

Ehmry (talk | contribs)
blocks section
Ehmry (talk | contribs)
add "See also" section
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
== execlineb ==
== execlineb ==


[https://skarnet.org/software/execline/execlineb.html execlineb] is the interpreter for execline scripts. It reads a file, produces a command-line, and executes into that command line. <code>execlineb</code> manages the environment of the command that it executes and optionaly substitutes the arguments a script receives into the command-line. <code>execlineb</code> also handles the quoting of strings using <code>""</code> and blocks using <code>{}</code>. Blocks are described later in this article.
[https://skarnet.org/software/execline/execlineb.html execlineb] is the interpreter for execline scripts. It reads a file, produces a command-line, and executes into that command line. <code>execlineb</code> manages the environment of the command that it executes and optionally substitutes the arguments a script receives into the command-line. <code>execlineb</code> also handles the quoting of strings using <code>""</code> and blocks using <code>{}</code>. Blocks are described later in this article.


== Wrappers ==
== Wrappers ==
Line 52: Line 52:


pkgs.execline.passthru.writeScript "wrap-cowsay" "-s0" ''
pkgs.execline.passthru.writeScript "wrap-cowsay" "-s0" ''
   pipeline -w { ${pkgs.lib.getExe pkgs.cowsay} }
   pipeline -w { ${pkgs.lib.getExe pkgs.cowsay} "-r" }
   $@
   $@
''
''
Line 71: Line 71:
then the expression
then the expression
<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
args: lib.escapeShellArgs (quoteExecline [ "pipeline" "-w" [ (lib.getExe pkgs.cowsay) ] ] ++ args)
args: lib.escapeShellArgs (quoteExecline [ "pipeline" "-w" [ (lib.getExe pkgs.cowsay) "-r" ] ] ++ args)
</syntaxHighlight>
</syntaxHighlight>
would produce the command-line executed by <code>execlineb</code> in the previous "wrap-cowsay" example when given the same arguments.
would produce the command-line executed by <code>execlineb</code> in the previous "wrap-cowsay" example when given the same arguments.
== See also ==
execline scripts can be found in the following repositories:
* [https://spectrum-os.org/git/spectrum/ Spectrum]
* [https://github.com/search?q=repo%3Aaanderse%2Ffinix%20execline&type=code Finix]


[[Category:Cookbook]]
[[Category:Cookbook]]