<%
title = 'command line'
description = 'Command line parameters for starting mountebank'
%>

<% include ../_header %>

<h1>Configuring mountebank</h1>

<p>The basic command line structure is:</p>

<pre><code>mb [command=start] [options...]</code></pre>

<h2>mountebank commands</h2>

<p>As mountebank has grown in functionality, the number of commands and options
has increased significantly. The links below attempt to simplify that configuration
based on the core mountebank commands.</p>

<section class='accordion'>
  <div>
    <a class='section-toggler' id='start' name='start' href='#start'>mb start</a>
    <section>
      <% include cli/start %>
    </section>
  </div>
  <div>
    <a class='section-toggler' id='stop' name='stop' href='#stop'>mb stop</a>
    <section>
      <% include cli/stop %>
    </section>
  </div>
  <div>
    <a class='section-toggler' id='restart' name='restart' href='#restart'>mb restart</a>
    <section>
      <% include cli/restart %>
    </section>
  </div>
  <div>
    <a class='section-toggler' id='save' name='save' href='#save'>mb save</a>
    <section>
      <% include cli/save %>
    </section>
  </div>
  <div>
    <a class='section-toggler' id='replay' name='replay' href='#replay'>mb replay</a>
    <section>
      <% include cli/replay %>
    </section>
  </div>
  <div>
    <a class='section-toggler' id='help' name='help' href='#help'>mb help</a>
    <section>
      <% include cli/help %>
    </section>
  </div>
</section>

<h2>Saving test data: config files and formatters</h2>

<p>Note that <code>mb</code> is not persistent by default. Absent the <code>datadir</code> option,
stopping and restarting <code>mb</code> will lose all stubs and all requests. The following two
<code>mb</code> commands work in tandem to allow you to save and reload test data:</p>

<pre><code>mb save --savefile mb.json --formatter path/to/module
mb restart --configfile mb.json --formatter path/to/module</code></pre>

<p>The <code>configfile</code> sends a <a href='/docs/api/overview#change-stubs'><code>PUT</code> command</a>
to <code>/imposters</code>. View the <a href='/docs/api/contracts?type=imposters'>JSON contract</a>
to see what the contents should look like.</p>

<p>The <code>formatter</code> is optional. If specified, it gives you total control over the format of
the test data saved to disk, which allows you to split the content in separate files or convert
to a format used by other service virtualization tools. The links below describe the default
formatter for configuration files as well as how to define a custom formatter.</p>

<section class='accordion'>
    <div>
        <a class='section-toggler' id='config-files' name='config-files' href='#config-files'>Default config file parsing</a>
        <section>
            <% include cli/configFiles %>
        </section>
    </div>
    <div>
        <a class='section-toggler' id='custom-formatters' name='custom-formatters' href='#custom-formatters'>Custom formatters</a>
        <section>
            <% include cli/customFormatters %>
        </section>
    </div>
</section>

<% include ../_footer %>
