Skip to content

Commit

Permalink
Add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
juancarlospaco committed Nov 19, 2022
1 parent 154f182 commit 86b2aaf
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ <h1 class="title">src/cliche</h1>
<span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">strutils</span>
<span class="Comment"># Use https://nim-lang.github.io/Nim/os.html#commandLineParams</span>
<span class="Keyword">block</span><span class="Punctuation">:</span>
<span class="Keyword">type</span> <span class="Identifier">Food</span> <span class="Operator">=</span> <span class="Keyword">enum</span> <span class="Identifier">PIZZA</span><span class="Punctuation">,</span> <span class="Identifier">TACO</span> <span class="Comment"># Enum from CLI.</span>
<span class="Comment"># let real = commandLineParams()</span>
<span class="Keyword">let</span> <span class="Identifier">fake</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">&quot;--a=1&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--v_1=9.9&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--v2=1&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--v3=2&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--v4=X&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--v5=t&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--v6=z&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--v7=true&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--help&quot;</span><span class="Punctuation">]</span>
<span class="Identifier">fake</span><span class="Operator">.</span><span class="Identifier">getOpt</span> <span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Operator">.</span><span class="Identifier">high</span><span class="Punctuation">,</span> <span class="Identifier">v_1</span><span class="Punctuation">:</span> <span class="FloatNumber">3.14</span><span class="Punctuation">,</span> <span class="Identifier">v2</span><span class="Punctuation">:</span> <span class="DecNumber">9'</span><span class="Identifier">u64</span><span class="Punctuation">,</span> <span class="Identifier">v3</span><span class="Punctuation">:</span> <span class="Operator">-</span><span class="DecNumber">9'i64</span><span class="Punctuation">,</span> <span class="Identifier">v4</span><span class="Punctuation">:</span> <span class="StringLit">&quot;a&quot;</span><span class="Punctuation">,</span> <span class="Identifier">v5</span><span class="Punctuation">:</span> <span class="CharLit">'4'</span><span class="Punctuation">,</span> <span class="Identifier">v6</span><span class="Punctuation">:</span> <span class="RawData">cstring&quot;b&quot;</span><span class="Punctuation">,</span> <span class="Identifier">v7</span><span class="Punctuation">:</span> <span class="Identifier">false</span><span class="Punctuation">,</span> <span class="Identifier">missing</span><span class="Punctuation">:</span> <span class="DecNumber">42</span><span class="Punctuation">)</span>
<span class="Keyword">let</span> <span class="Identifier">fake</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">&quot;--a=1&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--v_1=9.9&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--v2=1&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--v3=2&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--v4=X&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--v5=t&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--v6=z&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--v7=true&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--food=PIZZA&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--help&quot;</span><span class="Punctuation">]</span>
<span class="Identifier">fake</span><span class="Operator">.</span><span class="Identifier">getOpt</span> <span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Operator">.</span><span class="Identifier">high</span><span class="Punctuation">,</span> <span class="Identifier">v_1</span><span class="Punctuation">:</span> <span class="FloatNumber">3.14</span><span class="Punctuation">,</span> <span class="Identifier">v2</span><span class="Punctuation">:</span> <span class="DecNumber">9'</span><span class="Identifier">u64</span><span class="Punctuation">,</span> <span class="Identifier">v3</span><span class="Punctuation">:</span> <span class="Operator">-</span><span class="DecNumber">9'i64</span><span class="Punctuation">,</span> <span class="Identifier">v4</span><span class="Punctuation">:</span> <span class="StringLit">&quot;a&quot;</span><span class="Punctuation">,</span> <span class="Identifier">v5</span><span class="Punctuation">:</span> <span class="CharLit">'4'</span><span class="Punctuation">,</span> <span class="Identifier">v6</span><span class="Punctuation">:</span> <span class="RawData">cstring&quot;b&quot;</span><span class="Punctuation">,</span> <span class="Identifier">v7</span><span class="Punctuation">:</span> <span class="Identifier">false</span><span class="Punctuation">,</span> <span class="Identifier">missing</span><span class="Punctuation">:</span> <span class="DecNumber">42</span><span class="Punctuation">,</span> <span class="Identifier">food</span><span class="Punctuation">:</span> <span class="Identifier">TACO</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="DecNumber">1</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v_1</span> <span class="Operator">==</span> <span class="FloatNumber">9.9</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v2</span> <span class="Operator">==</span> <span class="DecNumber">1'</span><span class="Identifier">u64</span>
Expand All @@ -88,11 +89,8 @@ <h1 class="title">src/cliche</h1>
<span class="Identifier">doAssert</span> <span class="Identifier">v5</span> <span class="Operator">==</span> <span class="CharLit">'t'</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v6</span> <span class="Operator">==</span> <span class="RawData">cstring&quot;z&quot;</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v7</span> <span class="Operator">==</span> <span class="Identifier">true</span>
<span class="Identifier">doAssert</span> <span class="Identifier">missing</span> <span class="Operator">==</span> <span class="DecNumber">42</span> <span class="Comment">## missing is not in fake, fallback to default value 42.</span>
<span class="Keyword">block</span><span class="Punctuation">:</span>
<span class="Keyword">type</span> <span class="Identifier">Food</span> <span class="Operator">=</span> <span class="Keyword">enum</span> <span class="Identifier">PIZZA</span><span class="Punctuation">,</span> <span class="Identifier">TACO</span> <span class="Comment"># Enum from CLI.</span>
<span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">&quot;--food=PIZZA&quot;</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">getOpt</span> <span class="Punctuation">(</span><span class="Identifier">food</span><span class="Punctuation">:</span> <span class="Identifier">TACO</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">food</span> <span class="Keyword">is</span> <span class="Identifier">Food</span> <span class="Keyword">and</span> <span class="Identifier">food</span> <span class="Operator">==</span> <span class="Identifier">PIZZA</span>
<span class="Identifier">doAssert</span> <span class="Identifier">missing</span> <span class="Operator">==</span> <span class="DecNumber">42</span> <span class="Comment"># missing is not in fake, fallback to default value 42.</span>
<span class="Identifier">doAssert</span> <span class="Identifier">food</span> <span class="Keyword">is</span> <span class="Identifier">Food</span> <span class="Keyword">and</span> <span class="Identifier">food</span> <span class="Operator">==</span> <span class="Identifier">PIZZA</span> <span class="Comment"># food is Food.PIZZA</span>
<span class="Keyword">block</span><span class="Punctuation">:</span>
<span class="Keyword">let</span> <span class="Identifier">fake</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">&quot;--a=false&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--b=5&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--c=1&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--d=2.0&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--e=3&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;--f=128&quot;</span><span class="Punctuation">]</span>
<span class="Identifier">fake</span><span class="Operator">.</span><span class="Identifier">getOpt</span> <span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">:</span> <span class="Identifier">true</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">:</span> <span class="FloatNumber">9.</span><span class="Identifier">Positive</span><span class="Punctuation">,</span> <span class="Identifier">c</span><span class="Punctuation">:</span> <span class="FloatNumber">5.</span><span class="Identifier">cint</span><span class="Punctuation">,</span> <span class="Identifier">d</span><span class="Punctuation">:</span> <span class="FloatNumber">0.0</span><span class="Operator">.</span><span class="Identifier">float32</span><span class="Punctuation">,</span> <span class="Identifier">e</span><span class="Punctuation">:</span> <span class="FloatNumber">0.</span><span class="Identifier">Natural</span><span class="Punctuation">,</span> <span class="Identifier">f</span><span class="Punctuation">:</span> <span class="FloatNumber">255.</span><span class="Identifier">byte</span><span class="Punctuation">)</span>
Expand Down Expand Up @@ -140,7 +138,7 @@ <h1><a class="toc-backref" href="#17">Macros</a></h1>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2022-11-19 14:13:29 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2022-11-19 15:09:31 UTC</small>
</div>
</div>
</div>
Expand Down

0 comments on commit 86b2aaf

Please sign in to comment.