mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-20 18:10:07 +00:00
96 lines
3.7 KiB
HTML
96 lines
3.7 KiB
HTML
POKI_PUT_TOC_HERE
|
|
|
|
<p/>
|
|
<button style="font-weight:bold;color:maroon;border:0" onclick="bodyToggler.expandAll();" href="javascript:;">Expand all sections</button>
|
|
<button style="font-weight:bold;color:maroon;border:0" onclick="bodyToggler.collapseAll();" href="javascript:;">Collapse all sections</button>
|
|
|
|
<h1>How to use .mlrrc</h1>
|
|
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="bodyToggler.toggle('body_section_toggle_how');" href="javascript:;">Toggle section visibility</button>
|
|
<div id="body_section_toggle_how" style="display: block">
|
|
|
|
<p>Suppose you always use CSV files. Then instead of always having to type
|
|
<tt>--csv</tt> as in </p>
|
|
|
|
POKI_CARDIFY(mlr --csv cut -x -f extra mydata.csv)HERE
|
|
|
|
POKI_CARDIFY(mlr --csv sort -n id mydata.csv)HERE
|
|
|
|
<p>and so on, you can instead put the following into your <tt>$HOME/.mlrrc</tt>:</p>
|
|
|
|
POKI_CARDIFY(--csv)HERE
|
|
|
|
<p>Then you can just type things like</p>
|
|
|
|
POKI_CARDIFY(mlr cut -x -f extra mydata.csv)HERE
|
|
|
|
POKI_CARDIFY(mlr sort -n id mydata.csv)HERE
|
|
|
|
<p>and the <tt>--csv</tt> part will automatically be understood. (If you do
|
|
want to process, say, a JSON file then <tt>mlr --json ...</tt> at the command
|
|
line will override the default from your <tt>.mlrrc</tt>.)</p>
|
|
|
|
</div>
|
|
|
|
|
|
<h1>What you can put in your .mlrrc</h1>
|
|
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="bodyToggler.toggle('body_section_toggle_what');" href="javascript:;">Toggle section visibility</button>
|
|
<div id="body_section_toggle_what" style="display: block">
|
|
|
|
<ul>
|
|
|
|
<li>You can include any command-line flags, except the "terminal" ones such
|
|
as <tt>--help</tt>. </li>
|
|
|
|
<li>The formatting rule is you need to put one flag beginning with
|
|
<tt>--</tt> per line: for example, <tt>--csv</tt> on one line and
|
|
<tt>--nr-progress-mod 1000</tt> on a separate line. </li>
|
|
|
|
<li>Since every line starts with a <tt>--</tt> option, you can leave off the
|
|
initial <tt>--</tt> if you want. For example, <tt>ojson</tt> is the same as
|
|
<tt>--ojson</tt>, and <tt>nr-progress-mod 1000</tt> is the same as
|
|
<tt>--nr-progress-mod 1000</tt>.
|
|
|
|
<li>Comments are from a <tt>#</tt> to the end of the line.</li>
|
|
|
|
<li>Empty lines are ignored -- including lines which are empty after comments are removed.</li>
|
|
|
|
</ul>
|
|
|
|
<p>Here is an example <tt>.mlrrc file</tt>:
|
|
|
|
POKI_INCLUDE_ESCAPED(sample_mlrrc)HERE
|
|
|
|
</div>
|
|
|
|
<h1>Where to put your .mlrrc</h1>
|
|
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="bodyToggler.toggle('body_section_toggle_where');" href="javascript:;">Toggle section visibility</button>
|
|
<div id="body_section_toggle_where" style="display: block">
|
|
|
|
<ul>
|
|
|
|
<li>If the environment variable <tt>MLRRC</tt> is set:</li>
|
|
|
|
<ul>
|
|
<li>If its value is <tt>__none__</tt> then no <tt>.mlrrc</tt> files are processed.
|
|
(This is nice for things like regression testing.)</li>
|
|
<li>Otherwise, its value (as a filename) is loaded and processed. If there
|
|
are syntax errors, they abort <tt>mlr</tt> with a usage message (as if
|
|
you had mistyped something on the command line). If the file can't be loaded at
|
|
all, though, it is silently skipped.</li>
|
|
<li>Any <tt>.mlrrc</tt> in your home directory or current directory is ignored whenever
|
|
<tt>MLRRC</tt> is set in the environment.
|
|
<li>Example line in your shell’s rc file: <tt>export MLRRC=/path/to/my/mlrrc</tt>
|
|
</ul>
|
|
|
|
<li>Otherwise:
|
|
|
|
<ul>
|
|
<li>If <tt>$HOME/.mlrrc</tt> exists, it’s processed as above.</li>
|
|
<li>If <tt>./.mlrrc</tt> exists, it’s then also processed as above.</li>
|
|
<li>The idea is you can have all your settings in your <tt>$HOME/.mlrrc</tt>,
|
|
then override maybe one or two for your current directory if you like.</li>
|
|
</ul>
|
|
|
|
</ul>
|
|
|
|
</div>
|