title: Function that gets slice of strings and extracts them as arguments to shell command in Rust
body: <p>I'm trying to automate some installs using <code>std::process::Command</code>. For example, I want to write a &quot;wrapper&quot; function for Ubuntu's <code>apt-get install</code>. This command can take some optional flags like <code>--no-install-recommends</code> etc. How can I use these options if I pass them as a slice to the function? So I would like to have something like that:</p>
  <pre class="lang-rust prettyprint-override"><code>fn apt_install(package_name: &amp;str, options: &amp;[&amp;str]) {
      let mut c = Command::new(&quot;apt-get&quot;)
          .arg(&quot;install&quot;)
          // Flags here, as many as specified in 'options' argument
          .spawn()
          .expect(format!(&quot;Failed to install {}&quot;, package_name).as_str());
      c.wait().unwrap();
  }
  </code></pre>