-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fee3de6
commit aeb8f5a
Showing
19 changed files
with
424 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
## CHANGELOG | ||
|
||
### v0.6.1 | ||
### v0.6.1 (2020-02-08) | ||
|
||
* New run_or_exit function and run_script_or_exit macro #10 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="List of all items in this crate"><meta name="keywords" content="rust, rustlang, rust-lang"><title>List of all items in this crate</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../run_script/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span> | ||
</span> | ||
<span class='in-band'>List of all items</span></h1><h3 id='Structs'>Structs</h3><ul class='structs docblock'><li><a href='types/struct.ScriptError.html'>types::ScriptError</a></li><li><a href='types/struct.ScriptOptions.html'>types::ScriptOptions</a></li></ul><h3 id='Enums'>Enums</h3><ul class='enums docblock'><li><a href='types/enum.ErrorInfo.html'>types::ErrorInfo</a></li><li><a href='types/enum.IoOptions.html'>types::IoOptions</a></li></ul><h3 id='Macros'>Macros</h3><ul class='macros docblock'><li><a href='macro.run_script.html'>run_script</a></li><li><a href='macro.spawn_script.html'>spawn_script</a></li></ul><h3 id='Functions'>Functions</h3><ul class='functions docblock'><li><a href='fn.run.html'>run</a></li><li><a href='fn.spawn.html'>spawn</a></li></ul><h3 id='Typedefs'>Typedefs</h3><ul class='typedefs docblock'><li><a href='type.IoOptions.html'>IoOptions</a></li><li><a href='type.ScriptError.html'>ScriptError</a></li><li><a href='type.ScriptOptions.html'>ScriptOptions</a></li></ul></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "run_script";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> | ||
<span class='in-band'>List of all items</span></h1><h3 id='Structs'>Structs</h3><ul class='structs docblock'><li><a href='types/struct.ScriptError.html'>types::ScriptError</a></li><li><a href='types/struct.ScriptOptions.html'>types::ScriptOptions</a></li></ul><h3 id='Enums'>Enums</h3><ul class='enums docblock'><li><a href='types/enum.ErrorInfo.html'>types::ErrorInfo</a></li><li><a href='types/enum.IoOptions.html'>types::IoOptions</a></li></ul><h3 id='Macros'>Macros</h3><ul class='macros docblock'><li><a href='macro.run_script.html'>run_script</a></li><li><a href='macro.run_script_or_exit.html'>run_script_or_exit</a></li><li><a href='macro.spawn_script.html'>spawn_script</a></li></ul><h3 id='Functions'>Functions</h3><ul class='functions docblock'><li><a href='fn.run.html'>run</a></li><li><a href='fn.run_or_exit.html'>run_or_exit</a></li><li><a href='fn.spawn.html'>spawn</a></li></ul><h3 id='Typedefs'>Typedefs</h3><ul class='typedefs docblock'><li><a href='type.IoOptions.html'>IoOptions</a></li><li><a href='type.ScriptError.html'>ScriptError</a></li><li><a href='type.ScriptOptions.html'>ScriptOptions</a></li></ul></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "run_script";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `run_or_exit` fn in crate `run_script`."><meta name="keywords" content="rust, rustlang, rust-lang, run_or_exit"><title>run_script::run_or_exit - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../run_script/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='index.html'>run_script</a></p><script>window.sidebarCurrent = {name: 'run_or_exit', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/run_script/lib.rs.html#363-365' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='index.html'>run_script</a>::<wbr><a class="fn" href=''>run_or_exit</a></span></h1><pre class='rust fn'>pub fn run_or_exit(<br> script: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br> args: &<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, <br> options: &<a class="type" href="../run_script/type.ScriptOptions.html" title="type run_script::ScriptOptions">ScriptOptions</a><br>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></pre><div class='docblock'><p>Invokes the provided script content and returns the invocation output. | ||
In case of invocation error or error exit code, this function will exit the main process.</p> | ||
<h1 id="arguments" class="section-header"><a href="#arguments">Arguments</a></h1> | ||
<ul> | ||
<li><code>script</code> - The script content</li> | ||
<li><code>args</code> - The script command line arguments</li> | ||
<li><code>options</code> - Options provided to the script runner</li> | ||
</ul> | ||
<h1 id="example" class="section-header"><a href="#example">Example</a></h1> | ||
<div class="example-wrap"><pre class="rust rust-example-rendered"> | ||
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">run_script</span>; | ||
|
||
<span class="kw">use</span> <span class="ident">run_script</span>::<span class="ident">ScriptOptions</span>; | ||
|
||
<span class="kw">fn</span> <span class="ident">main</span>() { | ||
<span class="kw">let</span> <span class="ident">options</span> <span class="op">=</span> <span class="ident">ScriptOptions</span>::<span class="ident">new</span>(); | ||
|
||
<span class="kw">let</span> <span class="ident">args</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[]; | ||
|
||
<span class="kw">let</span> (<span class="ident">output</span>, <span class="ident">error</span>) <span class="op">=</span> <span class="ident">run_script</span>::<span class="ident">run_or_exit</span>( | ||
<span class="string">r#" | ||
echo "Hello World" | ||
"#</span>, | ||
<span class="kw-2">&</span><span class="ident">args</span>, | ||
<span class="kw-2">&</span><span class="ident">options</span> | ||
); | ||
|
||
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"Output: {}"</span>, <span class="ident">output</span>); | ||
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"Error: {}"</span>, <span class="ident">error</span>); | ||
}</pre></div> | ||
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "run_script";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |
Oops, something went wrong.