rbcli 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/Gemfile.lock +19 -5
  4. data/docs/404.html +9 -9
  5. data/docs/advanced/automatic_updates/index.html +30 -30
  6. data/docs/advanced/command_types/index.html +78 -78
  7. data/docs/advanced/distributed_state_locking/index.html +30 -30
  8. data/docs/advanced/hooks/index.html +42 -42
  9. data/docs/advanced/index.html +27 -27
  10. data/docs/advanced/index.xml +12 -50
  11. data/docs/advanced/interactive_commands/index.html +35 -35
  12. data/docs/advanced/logging/index.html +36 -36
  13. data/docs/advanced/remote_execution/index.html +51 -51
  14. data/docs/advanced/state_storage/index.html +34 -34
  15. data/docs/advanced/user_config_files/index.html +30 -30
  16. data/docs/categories/index.html +27 -27
  17. data/docs/categories/index.xml +3 -2
  18. data/docs/development/changelog/index.html +91 -60
  19. data/docs/development/code_of_conduct/index.html +27 -27
  20. data/docs/development/contributing/index.html +40 -40
  21. data/docs/development/index.html +27 -27
  22. data/docs/development/index.xml +6 -16
  23. data/docs/development/license/index.html +26 -26
  24. data/docs/index.html +26 -26
  25. data/docs/index.json +15 -15
  26. data/docs/index.xml +20 -90
  27. data/docs/quick_reference/index.html +54 -54
  28. data/docs/quick_reference/index.xml +3 -2
  29. data/docs/sitemap.xml +0 -1
  30. data/docs/tags/index.html +27 -27
  31. data/docs/tags/index.xml +3 -2
  32. data/docs/tutorial/10-getting_started/index.html +33 -33
  33. data/docs/tutorial/20-project_layout/index.html +55 -55
  34. data/docs/tutorial/30-your_first_command/index.html +90 -90
  35. data/docs/tutorial/40-options_parameters_and_arguments/index.html +167 -167
  36. data/docs/tutorial/50-publishing/index.html +30 -30
  37. data/docs/tutorial/index.html +27 -27
  38. data/docs/tutorial/index.xml +8 -28
  39. data/docs/whoami/index.html +28 -28
  40. data/docs/whoami/index.xml +3 -2
  41. data/docs-src/.hugo_build.lock +0 -0
  42. data/docs-src/content/development/changelog.md +20 -0
  43. data/docs-src/makesite.sh +4 -4
  44. data/lib/rbcli/engine/command.rb +1 -1
  45. data/lib/rbcli/engine/parser.rb +9 -7
  46. data/lib/rbcli/util/optimist.rb +1063 -0
  47. data/lib/rbcli/version.rb +1 -1
  48. data/lib/rbcli-tool/util.rb +1 -1
  49. data/rbcli.gemspec +7 -3
  50. data/skeletons/micro/executable +6 -1
  51. data/skeletons/mini/executable +6 -1
  52. data/skeletons/project/untitled.gemspec +4 -4
  53. metadata +9 -8
  54. data/lib/rbcli/util/trollop.rb +0 -1050
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <meta name="generator" content="Hugo 0.88.1" />
6
+ <meta name="generator" content="Hugo 0.125.1">
7
7
  <meta name="description" content="">
8
8
 
9
9
 
@@ -12,21 +12,21 @@
12
12
  <title>Getting Started :: RBCli Documentation</title>
13
13
 
14
14
 
15
- <link href="/rbcli/css/nucleus.css?1634703589" rel="stylesheet">
16
- <link href="/rbcli/css/fontawesome-all.min.css?1634703589" rel="stylesheet">
17
- <link href="/rbcli/css/hybrid.css?1634703589" rel="stylesheet">
18
- <link href="/rbcli/css/featherlight.min.css?1634703589" rel="stylesheet">
19
- <link href="/rbcli/css/perfect-scrollbar.min.css?1634703589" rel="stylesheet">
20
- <link href="/rbcli/css/auto-complete.css?1634703589" rel="stylesheet">
21
- <link href="/rbcli/css/atom-one-dark-reasonable.css?1634703589" rel="stylesheet">
22
- <link href="/rbcli/css/theme.css?1634703589" rel="stylesheet">
23
- <link href="/rbcli/css/hugo-theme.css?1634703589" rel="stylesheet">
15
+ <link href="/rbcli/css/nucleus.css?1713907739" rel="stylesheet">
16
+ <link href="/rbcli/css/fontawesome-all.min.css?1713907739" rel="stylesheet">
17
+ <link href="/rbcli/css/hybrid.css?1713907739" rel="stylesheet">
18
+ <link href="/rbcli/css/featherlight.min.css?1713907739" rel="stylesheet">
19
+ <link href="/rbcli/css/perfect-scrollbar.min.css?1713907739" rel="stylesheet">
20
+ <link href="/rbcli/css/auto-complete.css?1713907739" rel="stylesheet">
21
+ <link href="/rbcli/css/atom-one-dark-reasonable.css?1713907739" rel="stylesheet">
22
+ <link href="/rbcli/css/theme.css?1713907739" rel="stylesheet">
23
+ <link href="/rbcli/css/hugo-theme.css?1713907739" rel="stylesheet">
24
24
 
25
- <link href="/rbcli/css/theme-blue.css?1634703589" rel="stylesheet">
25
+ <link href="/rbcli/css/theme-blue.css?1713907739" rel="stylesheet">
26
26
 
27
27
 
28
28
 
29
- <script src="/rbcli/js/jquery-3.3.1.min.js?1634703589"></script>
29
+ <script src="/rbcli/js/jquery-3.3.1.min.js?1713907739"></script>
30
30
 
31
31
  <style>
32
32
  :root #header + #content > #left > #rlblock_left{
@@ -55,14 +55,14 @@
55
55
  <span data-search-clear=""><i class="fas fa-times"></i></span>
56
56
  </div>
57
57
 
58
- <script type="text/javascript" src="/rbcli/js/lunr.min.js?1634703589"></script>
59
- <script type="text/javascript" src="/rbcli/js/auto-complete.js?1634703589"></script>
58
+ <script type="text/javascript" src="/rbcli/js/lunr.min.js?1713907739"></script>
59
+ <script type="text/javascript" src="/rbcli/js/auto-complete.js?1713907739"></script>
60
60
  <script type="text/javascript">
61
61
 
62
62
  var baseurl = "https:\/\/akhoury6.github.io\/rbcli\/";
63
63
 
64
64
  </script>
65
- <script type="text/javascript" src="/rbcli/js/search.js?1634703589"></script>
65
+ <script type="text/javascript" src="/rbcli/js/search.js?1713907739"></script>
66
66
 
67
67
 
68
68
  </div>
@@ -712,13 +712,13 @@
712
712
  <p>RBCli officially supports Ruby versions 2.5.0 and above. It may work on earlier releases even though we haven&rsquo;t tested them. If you do try it find any bugs that break compatibility, feel free to submit a github issue or pull request.</p>
713
713
  <h2 id="installation">Installation</h2>
714
714
  <p>RBCli is available on rubygems.org. You can add it to your application&rsquo;s <code>Gemfile</code> or <code>gemspec</code>, or install it manually by running:</p>
715
- <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">gem install rbcli
716
- </code></pre></div><p>Then, <code>cd</code> to the folder you&rsquo;d like to create your project under and run:</p>
717
- <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">rbcli init -n mytool -d <span style="color:#e6db74">&#34;A simple CLI tool&#34;</span>
718
- </code></pre></div><p>where <code>mytool</code> can be replaced with any other command name you&rsquo;d like. You should then see some output about generating a bunch of files. Once it finishes, run:</p>
719
- <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">cd mytool
720
- ls -ahl
721
- </code></pre></div><p>Congratulations! This is the beginning of your first project.</p>
715
+ <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>gem install rbcli
716
+ </span></span></code></pre></div><p>Then, <code>cd</code> to the folder you&rsquo;d like to create your project under and run:</p>
717
+ <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>rbcli init -n mytool -d <span style="color:#e6db74">&#34;A simple CLI tool&#34;</span>
718
+ </span></span></code></pre></div><p>where <code>mytool</code> can be replaced with any other command name you&rsquo;d like. You should then see some output about generating a bunch of files. Once it finishes, run:</p>
719
+ <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>cd mytool
720
+ </span></span><span style="display:flex;"><span>ls -ahl
721
+ </span></span></code></pre></div><p>Congratulations! This is the beginning of your first project.</p>
722
722
  <h2 id="next-steps">Next Steps</h2>
723
723
  <p>Next, you will learn about the layout of an RBCli project and how to code with it.</p>
724
724
 
@@ -1151,19 +1151,19 @@ ls -ahl
1151
1151
  <div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
1152
1152
  <div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
1153
1153
  </div>
1154
- <script src="/rbcli/js/clipboard.min.js?1634703589"></script>
1155
- <script src="/rbcli/js/perfect-scrollbar.min.js?1634703589"></script>
1156
- <script src="/rbcli/js/perfect-scrollbar.jquery.min.js?1634703589"></script>
1157
- <script src="/rbcli/js/jquery.sticky.js?1634703589"></script>
1158
- <script src="/rbcli/js/featherlight.min.js?1634703589"></script>
1159
- <script src="/rbcli/js/highlight.pack.js?1634703589"></script>
1154
+ <script src="/rbcli/js/clipboard.min.js?1713907739"></script>
1155
+ <script src="/rbcli/js/perfect-scrollbar.min.js?1713907739"></script>
1156
+ <script src="/rbcli/js/perfect-scrollbar.jquery.min.js?1713907739"></script>
1157
+ <script src="/rbcli/js/jquery.sticky.js?1713907739"></script>
1158
+ <script src="/rbcli/js/featherlight.min.js?1713907739"></script>
1159
+ <script src="/rbcli/js/highlight.pack.js?1713907739"></script>
1160
1160
  <script>hljs.initHighlightingOnLoad();</script>
1161
- <script src="/rbcli/js/modernizr.custom-3.6.0.js?1634703589"></script>
1162
- <script src="/rbcli/js/learn.js?1634703589"></script>
1163
- <script src="/rbcli/js/hugo-learn.js?1634703589"></script>
1161
+ <script src="/rbcli/js/modernizr.custom-3.6.0.js?1713907739"></script>
1162
+ <script src="/rbcli/js/learn.js?1713907739"></script>
1163
+ <script src="/rbcli/js/hugo-learn.js?1713907739"></script>
1164
1164
 
1165
- <link href="/rbcli/mermaid/mermaid.css?1634703589" rel="stylesheet" />
1166
- <script src="/rbcli/mermaid/mermaid.js?1634703589"></script>
1165
+ <link href="/rbcli/mermaid/mermaid.css?1713907739" rel="stylesheet" />
1166
+ <script src="/rbcli/mermaid/mermaid.js?1713907739"></script>
1167
1167
  <script>
1168
1168
  mermaid.initialize({ startOnLoad: true });
1169
1169
  </script>
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <meta name="generator" content="Hugo 0.88.1" />
6
+ <meta name="generator" content="Hugo 0.125.1">
7
7
  <meta name="description" content="">
8
8
 
9
9
 
@@ -12,21 +12,21 @@
12
12
  <title>The Project Layout :: RBCli Documentation</title>
13
13
 
14
14
 
15
- <link href="/rbcli/css/nucleus.css?1634703589" rel="stylesheet">
16
- <link href="/rbcli/css/fontawesome-all.min.css?1634703589" rel="stylesheet">
17
- <link href="/rbcli/css/hybrid.css?1634703589" rel="stylesheet">
18
- <link href="/rbcli/css/featherlight.min.css?1634703589" rel="stylesheet">
19
- <link href="/rbcli/css/perfect-scrollbar.min.css?1634703589" rel="stylesheet">
20
- <link href="/rbcli/css/auto-complete.css?1634703589" rel="stylesheet">
21
- <link href="/rbcli/css/atom-one-dark-reasonable.css?1634703589" rel="stylesheet">
22
- <link href="/rbcli/css/theme.css?1634703589" rel="stylesheet">
23
- <link href="/rbcli/css/hugo-theme.css?1634703589" rel="stylesheet">
15
+ <link href="/rbcli/css/nucleus.css?1713907739" rel="stylesheet">
16
+ <link href="/rbcli/css/fontawesome-all.min.css?1713907739" rel="stylesheet">
17
+ <link href="/rbcli/css/hybrid.css?1713907739" rel="stylesheet">
18
+ <link href="/rbcli/css/featherlight.min.css?1713907739" rel="stylesheet">
19
+ <link href="/rbcli/css/perfect-scrollbar.min.css?1713907739" rel="stylesheet">
20
+ <link href="/rbcli/css/auto-complete.css?1713907739" rel="stylesheet">
21
+ <link href="/rbcli/css/atom-one-dark-reasonable.css?1713907739" rel="stylesheet">
22
+ <link href="/rbcli/css/theme.css?1713907739" rel="stylesheet">
23
+ <link href="/rbcli/css/hugo-theme.css?1713907739" rel="stylesheet">
24
24
 
25
- <link href="/rbcli/css/theme-blue.css?1634703589" rel="stylesheet">
25
+ <link href="/rbcli/css/theme-blue.css?1713907739" rel="stylesheet">
26
26
 
27
27
 
28
28
 
29
- <script src="/rbcli/js/jquery-3.3.1.min.js?1634703589"></script>
29
+ <script src="/rbcli/js/jquery-3.3.1.min.js?1713907739"></script>
30
30
 
31
31
  <style>
32
32
  :root #header + #content > #left > #rlblock_left{
@@ -55,14 +55,14 @@
55
55
  <span data-search-clear=""><i class="fas fa-times"></i></span>
56
56
  </div>
57
57
 
58
- <script type="text/javascript" src="/rbcli/js/lunr.min.js?1634703589"></script>
59
- <script type="text/javascript" src="/rbcli/js/auto-complete.js?1634703589"></script>
58
+ <script type="text/javascript" src="/rbcli/js/lunr.min.js?1713907739"></script>
59
+ <script type="text/javascript" src="/rbcli/js/auto-complete.js?1713907739"></script>
60
60
  <script type="text/javascript">
61
61
 
62
62
  var baseurl = "https:\/\/akhoury6.github.io\/rbcli\/";
63
63
 
64
64
  </script>
65
- <script type="text/javascript" src="/rbcli/js/search.js?1634703589"></script>
65
+ <script type="text/javascript" src="/rbcli/js/search.js?1713907739"></script>
66
66
 
67
67
 
68
68
  </div>
@@ -722,41 +722,41 @@
722
722
  </ul>
723
723
  <h3 id="project-mode">Project Mode</h3>
724
724
  <p>If you&rsquo;ve been following along with the tutorial, you&rsquo;ve already seen Project Mode. An RBCli Project consists of several folders, each of which has a specific function. The RBCli framework handles loading and parsing the code automatically. To generate a standard, full-featured RBCli project, run:</p>
725
- <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">rbcli init -n mytool
726
- </code></pre></div><p>where <code>mytool</code> can be replaced with any other command name you&rsquo;d like. (We will continue using <code>mytool</code> in this tutorial though!)</p>
725
+ <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>rbcli init -n mytool
726
+ </span></span></code></pre></div><p>where <code>mytool</code> can be replaced with any other command name you&rsquo;d like. (We will continue using <code>mytool</code> in this tutorial though!)</p>
727
727
  <p>Inside the newly created <code>mytool</code> folder you will see a bunch of files and folders related to your project. We will go over the structure later.</p>
728
728
  <h3 id="mini--micro-modes">Mini &amp; Micro Modes</h3>
729
729
  <p>If you need to write a CLI tool but project mode feels a bit overkill for you &ndash; if you think a single-file script is all that is needed &ndash; that&rsquo;s where the Mini and Micro modes come in. Instead of generating a full directory tree, you get only a single file that contains most of the functionality of RBCli. To use it, run:</p>
730
- <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">rbcli init -n mytool -t mini
731
- <span style="color:#75715e"># or</span>
732
- rbcli init -n mytool -t micro
733
- </code></pre></div><p>The only difference between the two is that <code>mini</code> will show you all available options and some documentation to help you, while <code>micro</code> is for advanced users who just want the samllest file possible.</p>
730
+ <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>rbcli init -n mytool -t mini
731
+ </span></span><span style="display:flex;"><span><span style="color:#75715e"># or</span>
732
+ </span></span><span style="display:flex;"><span>rbcli init -n mytool -t micro
733
+ </span></span></code></pre></div><p>The only difference between the two is that <code>mini</code> will show you all available options and some documentation to help you, while <code>micro</code> is for advanced users who just want the samllest file possible.</p>
734
734
  <p>As far as documentation goes, every piece of code present in those files is identical to Project mode so it should be pretty easy to navigate.</p>
735
735
  <h2 id="project-mode-structure">Project Mode Structure</h2>
736
736
  <p>An RBCli project has the following structure:</p>
737
- <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">&lt;name&gt;/
738
- |--- application/
739
- | |--- commands/
740
- | | |--- scripts/
741
- | |--- options.rb
742
- |--- config/
743
- |--- exe/
744
- | |--- &lt;name&gt;
745
- |--- hooks/
746
- |--- lib/
747
- | |--- &lt;name&gt;/
748
- | |--- &lt;name&gt;.rb
749
- |--- spec/
750
- |--- userconf/
751
- |--- .gitignore
752
- |--- .rbcli
753
- |--- .rspec
754
- |--- CODE_OF_CONDUCT.md
755
- |--- Gemfile
756
- |--- README.md
757
- |--- Rakefile
758
- |--- &lt;name&gt;.gemspec
759
- </code></pre></div><h2 id="git-rubygems-and-rspec">Git, RubyGems, and rspec</h2>
737
+ <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>&lt;name&gt;/
738
+ </span></span><span style="display:flex;"><span>|--- application/
739
+ </span></span><span style="display:flex;"><span>| |--- commands/
740
+ </span></span><span style="display:flex;"><span>| | |--- scripts/
741
+ </span></span><span style="display:flex;"><span>| |--- options.rb
742
+ </span></span><span style="display:flex;"><span>|--- config/
743
+ </span></span><span style="display:flex;"><span>|--- exe/
744
+ </span></span><span style="display:flex;"><span>| |--- &lt;name&gt;
745
+ </span></span><span style="display:flex;"><span>|--- hooks/
746
+ </span></span><span style="display:flex;"><span>|--- lib/
747
+ </span></span><span style="display:flex;"><span>| |--- &lt;name&gt;/
748
+ </span></span><span style="display:flex;"><span>| |--- &lt;name&gt;.rb
749
+ </span></span><span style="display:flex;"><span>|--- spec/
750
+ </span></span><span style="display:flex;"><span>|--- userconf/
751
+ </span></span><span style="display:flex;"><span>|--- .gitignore
752
+ </span></span><span style="display:flex;"><span>|--- .rbcli
753
+ </span></span><span style="display:flex;"><span>|--- .rspec
754
+ </span></span><span style="display:flex;"><span>|--- CODE_OF_CONDUCT.md
755
+ </span></span><span style="display:flex;"><span>|--- Gemfile
756
+ </span></span><span style="display:flex;"><span>|--- README.md
757
+ </span></span><span style="display:flex;"><span>|--- Rakefile
758
+ </span></span><span style="display:flex;"><span>|--- &lt;name&gt;.gemspec
759
+ </span></span></code></pre></div><h2 id="git-rubygems-and-rspec">Git, RubyGems, and rspec</h2>
760
760
  <p>A few files aren&rsquo;t part of RBCli itself, but are provided for your convenience. If you&rsquo;re experienced in Ruby and Git you can skip over this.</p>
761
761
  <ul>
762
762
  <li><code>.gitignore</code>
@@ -1276,19 +1276,19 @@ rbcli init -n mytool -t micro
1276
1276
  <div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
1277
1277
  <div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
1278
1278
  </div>
1279
- <script src="/rbcli/js/clipboard.min.js?1634703589"></script>
1280
- <script src="/rbcli/js/perfect-scrollbar.min.js?1634703589"></script>
1281
- <script src="/rbcli/js/perfect-scrollbar.jquery.min.js?1634703589"></script>
1282
- <script src="/rbcli/js/jquery.sticky.js?1634703589"></script>
1283
- <script src="/rbcli/js/featherlight.min.js?1634703589"></script>
1284
- <script src="/rbcli/js/highlight.pack.js?1634703589"></script>
1279
+ <script src="/rbcli/js/clipboard.min.js?1713907739"></script>
1280
+ <script src="/rbcli/js/perfect-scrollbar.min.js?1713907739"></script>
1281
+ <script src="/rbcli/js/perfect-scrollbar.jquery.min.js?1713907739"></script>
1282
+ <script src="/rbcli/js/jquery.sticky.js?1713907739"></script>
1283
+ <script src="/rbcli/js/featherlight.min.js?1713907739"></script>
1284
+ <script src="/rbcli/js/highlight.pack.js?1713907739"></script>
1285
1285
  <script>hljs.initHighlightingOnLoad();</script>
1286
- <script src="/rbcli/js/modernizr.custom-3.6.0.js?1634703589"></script>
1287
- <script src="/rbcli/js/learn.js?1634703589"></script>
1288
- <script src="/rbcli/js/hugo-learn.js?1634703589"></script>
1286
+ <script src="/rbcli/js/modernizr.custom-3.6.0.js?1713907739"></script>
1287
+ <script src="/rbcli/js/learn.js?1713907739"></script>
1288
+ <script src="/rbcli/js/hugo-learn.js?1713907739"></script>
1289
1289
 
1290
- <link href="/rbcli/mermaid/mermaid.css?1634703589" rel="stylesheet" />
1291
- <script src="/rbcli/mermaid/mermaid.js?1634703589"></script>
1290
+ <link href="/rbcli/mermaid/mermaid.css?1713907739" rel="stylesheet" />
1291
+ <script src="/rbcli/mermaid/mermaid.js?1713907739"></script>
1292
1292
  <script>
1293
1293
  mermaid.initialize({ startOnLoad: true });
1294
1294
  </script>
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <meta name="generator" content="Hugo 0.88.1" />
6
+ <meta name="generator" content="Hugo 0.125.1">
7
7
  <meta name="description" content="">
8
8
 
9
9
 
@@ -12,21 +12,21 @@
12
12
  <title>Your First Command :: RBCli Documentation</title>
13
13
 
14
14
 
15
- <link href="/rbcli/css/nucleus.css?1634703589" rel="stylesheet">
16
- <link href="/rbcli/css/fontawesome-all.min.css?1634703589" rel="stylesheet">
17
- <link href="/rbcli/css/hybrid.css?1634703589" rel="stylesheet">
18
- <link href="/rbcli/css/featherlight.min.css?1634703589" rel="stylesheet">
19
- <link href="/rbcli/css/perfect-scrollbar.min.css?1634703589" rel="stylesheet">
20
- <link href="/rbcli/css/auto-complete.css?1634703589" rel="stylesheet">
21
- <link href="/rbcli/css/atom-one-dark-reasonable.css?1634703589" rel="stylesheet">
22
- <link href="/rbcli/css/theme.css?1634703589" rel="stylesheet">
23
- <link href="/rbcli/css/hugo-theme.css?1634703589" rel="stylesheet">
15
+ <link href="/rbcli/css/nucleus.css?1713907739" rel="stylesheet">
16
+ <link href="/rbcli/css/fontawesome-all.min.css?1713907739" rel="stylesheet">
17
+ <link href="/rbcli/css/hybrid.css?1713907739" rel="stylesheet">
18
+ <link href="/rbcli/css/featherlight.min.css?1713907739" rel="stylesheet">
19
+ <link href="/rbcli/css/perfect-scrollbar.min.css?1713907739" rel="stylesheet">
20
+ <link href="/rbcli/css/auto-complete.css?1713907739" rel="stylesheet">
21
+ <link href="/rbcli/css/atom-one-dark-reasonable.css?1713907739" rel="stylesheet">
22
+ <link href="/rbcli/css/theme.css?1713907739" rel="stylesheet">
23
+ <link href="/rbcli/css/hugo-theme.css?1713907739" rel="stylesheet">
24
24
 
25
- <link href="/rbcli/css/theme-blue.css?1634703589" rel="stylesheet">
25
+ <link href="/rbcli/css/theme-blue.css?1713907739" rel="stylesheet">
26
26
 
27
27
 
28
28
 
29
- <script src="/rbcli/js/jquery-3.3.1.min.js?1634703589"></script>
29
+ <script src="/rbcli/js/jquery-3.3.1.min.js?1713907739"></script>
30
30
 
31
31
  <style>
32
32
  :root #header + #content > #left > #rlblock_left{
@@ -55,14 +55,14 @@
55
55
  <span data-search-clear=""><i class="fas fa-times"></i></span>
56
56
  </div>
57
57
 
58
- <script type="text/javascript" src="/rbcli/js/lunr.min.js?1634703589"></script>
59
- <script type="text/javascript" src="/rbcli/js/auto-complete.js?1634703589"></script>
58
+ <script type="text/javascript" src="/rbcli/js/lunr.min.js?1713907739"></script>
59
+ <script type="text/javascript" src="/rbcli/js/auto-complete.js?1713907739"></script>
60
60
  <script type="text/javascript">
61
61
 
62
62
  var baseurl = "https:\/\/akhoury6.github.io\/rbcli\/";
63
63
 
64
64
  </script>
65
- <script type="text/javascript" src="/rbcli/js/search.js?1634703589"></script>
65
+ <script type="text/javascript" src="/rbcli/js/search.js?1713907739"></script>
66
66
 
67
67
 
68
68
  </div>
@@ -708,41 +708,41 @@
708
708
 
709
709
  <h2 id="creating-the-command">Creating the Command</h2>
710
710
  <p>Creating the command is straightforward:</p>
711
- <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">rbcli command --name<span style="color:#f92672">=</span>list
712
- <span style="color:#75715e">#or</span>
713
- rbcli command -n list
714
- </code></pre></div><p>And there you have it! Now you can try out your command by typing:</p>
715
- <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">./exe/mytool list
716
- </code></pre></div><p>Congrats! You should now see a generic output listing the values of several variables. We&rsquo;ll get into what they mean in a bit, but first, let&rsquo;s make the tool&rsquo;s execution a bit easier.</p>
711
+ <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>rbcli command --name<span style="color:#f92672">=</span>list
712
+ </span></span><span style="display:flex;"><span><span style="color:#75715e">#or</span>
713
+ </span></span><span style="display:flex;"><span>rbcli command -n list
714
+ </span></span></code></pre></div><p>And there you have it! Now you can try out your command by typing:</p>
715
+ <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>./exe/mytool list
716
+ </span></span></code></pre></div><p>Congrats! You should now see a generic output listing the values of several variables. We&rsquo;ll get into what they mean in a bit, but first, let&rsquo;s make the tool&rsquo;s execution a bit easier.</p>
717
717
  <p>Now that you know your way around a project, its time to create your first command! But before we do, let&rsquo;s make development just a little bit easier. Go to the base directory of the folder and type:</p>
718
- <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">alias mytool<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;</span><span style="color:#66d9ef">$(</span>pwd<span style="color:#66d9ef">)</span><span style="color:#e6db74">/exe/mytool&#34;</span>
719
- </code></pre></div><p>And now you&rsquo;ll be able to execute your application as if it was already installed as a gem, without worrying about the working path. You can see this in action by running your application again, but without the path:</p>
720
- <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">mytool list
721
- </code></pre></div><p>So, now let&rsquo;s take a more in-dpeth look at what the command code looks like.</p>
718
+ <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>alias mytool<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;</span><span style="color:#66d9ef">$(</span>pwd<span style="color:#66d9ef">)</span><span style="color:#e6db74">/exe/mytool&#34;</span>
719
+ </span></span></code></pre></div><p>And now you&rsquo;ll be able to execute your application as if it was already installed as a gem, without worrying about the working path. You can see this in action by running your application again, but without the path:</p>
720
+ <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>mytool list
721
+ </span></span></code></pre></div><p>So, now let&rsquo;s take a more in-dpeth look at what the command code looks like.</p>
722
722
  <h2 id="the-command-declaration">The Command Declaration</h2>
723
723
  <p>As mentioned in the previous section, you can find your commands listed under the <code>application/commands/</code> directory. Each command will appear as its own unique file with some base code to work from. Let&rsquo;s take a look at that code a little more in-depth:</p>
724
- <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-ruby" data-lang="ruby"><span style="color:#66d9ef">class</span> <span style="color:#a6e22e">List</span> <span style="color:#f92672">&lt;</span> <span style="color:#66d9ef">Rbcli</span><span style="color:#f92672">::</span><span style="color:#66d9ef">Command</span> <span style="color:#75715e"># Declare a new command by subclassing Rbcli::Command</span>
725
- description <span style="color:#e6db74">&#39;TODO: Description goes here&#39;</span> <span style="color:#75715e"># (Required) Short description for the global help</span>
726
- usage <span style="color:#e6db74">&lt;&lt;-EOF
727
- </span><span style="color:#e6db74"></span><span style="color:#e6db74">TODO</span>: <span style="color:#66d9ef">Usage</span> text goes here
728
- <span style="color:#66d9ef">EOF</span> <span style="color:#75715e"># (Required) Long description for the command-specific help</span>
729
- parameter <span style="color:#e6db74">:force</span>, <span style="color:#e6db74">&#39;Force testing&#39;</span>, <span style="color:#e6db74">type</span>: <span style="color:#e6db74">:boolean</span>, <span style="color:#e6db74">default</span>: <span style="color:#66d9ef">false</span>, <span style="color:#e6db74">required</span>: <span style="color:#66d9ef">false</span> <span style="color:#75715e"># (Optional, Multiple) Add a command-specific CLI parameter. Can be called multiple times</span>
730
-
731
- config_default <span style="color:#e6db74">:myopt2</span>, <span style="color:#e6db74">description</span>: <span style="color:#e6db74">&#39;My Option #2&#39;</span>, <span style="color:#e6db74">default</span>: <span style="color:#e6db74">&#39;Default Value Here&#39;</span> <span style="color:#75715e"># (Optional, Multiple) Specify an individual configuration parameter and set a default value. These will also be included in generated user config.</span>
732
- <span style="color:#75715e"># Alternatively, you can simply create a yaml file in the `default_user_configs` directory in your project that specifies the default values of all options</span>
733
-
734
- action <span style="color:#66d9ef">do</span> <span style="color:#f92672">|</span>params, args, global_opts, config<span style="color:#f92672">|</span> <span style="color:#75715e"># (Required) Block to execute if the command is called.</span>
735
- <span style="color:#66d9ef">Rbcli</span><span style="color:#f92672">::</span>log<span style="color:#f92672">.</span>info { <span style="color:#e6db74">&#39;These logs can go to STDERR, STDOUT, or a file&#39;</span> } <span style="color:#75715e"># Example log. Interface is identical to Ruby&#39;s logger</span>
736
- puts <span style="color:#e6db74">&#34;</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">Args:</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">#{</span>args<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span> <span style="color:#75715e"># Arguments that came after the command on the CLI (i.e.: `mytool test bar baz` will yield args=[&#39;bar&#39;, &#39;baz&#39;])</span>
737
- puts <span style="color:#e6db74">&#34;Params:</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">#{</span>params<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span> <span style="color:#75715e"># Parameters, as described through the option statements above</span>
738
- puts <span style="color:#e6db74">&#34;Global opts:</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">#{</span>global_opts<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span> <span style="color:#75715e"># Global Parameters, as descirbed in the Configurate section</span>
739
- puts <span style="color:#e6db74">&#34;Config:</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">#{</span>config<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span> <span style="color:#75715e"># Config file values</span>
740
- puts <span style="color:#e6db74">&#34;LocalState:</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">#{</span><span style="color:#66d9ef">Rbcli</span><span style="color:#f92672">.</span>local_state<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span> <span style="color:#75715e"># Local persistent state storage (when available) -- if unsure use Rbcli.local_state.nil?</span>
741
- puts <span style="color:#e6db74">&#34;RemoteState:</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">#{</span><span style="color:#66d9ef">Rbcli</span><span style="color:#f92672">.</span>remote_state<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span> <span style="color:#75715e"># Remote persistent state storage (when available) -- if unsure use Rbcli.remote_state.nil?</span>
742
- puts <span style="color:#e6db74">&#34;</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">Done!!!&#34;</span>
743
- <span style="color:#66d9ef">end</span>
744
- <span style="color:#66d9ef">end</span>
745
- </code></pre></div><p>Commands are declared to RBCli simply by subclassing them from <code>Rbcli::Command</code> as shown above. Then, you have a list of declarations that tell RBCli information about it. They are:</p>
724
+ <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-ruby" data-lang="ruby"><span style="display:flex;"><span><span style="color:#66d9ef">class</span> <span style="color:#a6e22e">List</span> <span style="color:#f92672">&lt;</span> <span style="color:#66d9ef">Rbcli</span><span style="color:#f92672">::</span><span style="color:#66d9ef">Command</span> <span style="color:#75715e"># Declare a new command by subclassing Rbcli::Command</span>
725
+ </span></span><span style="display:flex;"><span> description <span style="color:#e6db74">&#39;TODO: Description goes here&#39;</span> <span style="color:#75715e"># (Required) Short description for the global help</span>
726
+ </span></span><span style="display:flex;"><span> usage <span style="color:#e6db74">&lt;&lt;-EOF
727
+ </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"></span><span style="color:#e6db74">TODO</span>: <span style="color:#66d9ef">Usage</span> text goes here
728
+ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">EOF</span> <span style="color:#75715e"># (Required) Long description for the command-specific help</span>
729
+ </span></span><span style="display:flex;"><span> parameter <span style="color:#e6db74">:force</span>, <span style="color:#e6db74">&#39;Force testing&#39;</span>, <span style="color:#e6db74">type</span>: <span style="color:#e6db74">:boolean</span>, <span style="color:#e6db74">default</span>: <span style="color:#66d9ef">false</span>, <span style="color:#e6db74">required</span>: <span style="color:#66d9ef">false</span> <span style="color:#75715e"># (Optional, Multiple) Add a command-specific CLI parameter. Can be called multiple times</span>
730
+ </span></span><span style="display:flex;"><span>
731
+ </span></span><span style="display:flex;"><span> config_default <span style="color:#e6db74">:myopt2</span>, <span style="color:#e6db74">description</span>: <span style="color:#e6db74">&#39;My Option #2&#39;</span>, <span style="color:#e6db74">default</span>: <span style="color:#e6db74">&#39;Default Value Here&#39;</span> <span style="color:#75715e"># (Optional, Multiple) Specify an individual configuration parameter and set a default value. These will also be included in generated user config.</span>
732
+ </span></span><span style="display:flex;"><span> <span style="color:#75715e"># Alternatively, you can simply create a yaml file in the `default_user_configs` directory in your project that specifies the default values of all options</span>
733
+ </span></span><span style="display:flex;"><span>
734
+ </span></span><span style="display:flex;"><span> action <span style="color:#66d9ef">do</span> <span style="color:#f92672">|</span>params, args, global_opts, config<span style="color:#f92672">|</span> <span style="color:#75715e"># (Required) Block to execute if the command is called.</span>
735
+ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">Rbcli</span><span style="color:#f92672">::</span>log<span style="color:#f92672">.</span>info { <span style="color:#e6db74">&#39;These logs can go to STDERR, STDOUT, or a file&#39;</span> } <span style="color:#75715e"># Example log. Interface is identical to Ruby&#39;s logger</span>
736
+ </span></span><span style="display:flex;"><span> puts <span style="color:#e6db74">&#34;</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">Args:</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">#{</span>args<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span> <span style="color:#75715e"># Arguments that came after the command on the CLI (i.e.: `mytool test bar baz` will yield args=[&#39;bar&#39;, &#39;baz&#39;])</span>
737
+ </span></span><span style="display:flex;"><span> puts <span style="color:#e6db74">&#34;Params:</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">#{</span>params<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span> <span style="color:#75715e"># Parameters, as described through the option statements above</span>
738
+ </span></span><span style="display:flex;"><span> puts <span style="color:#e6db74">&#34;Global opts:</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">#{</span>global_opts<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span> <span style="color:#75715e"># Global Parameters, as descirbed in the Configurate section</span>
739
+ </span></span><span style="display:flex;"><span> puts <span style="color:#e6db74">&#34;Config:</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">#{</span>config<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span> <span style="color:#75715e"># Config file values</span>
740
+ </span></span><span style="display:flex;"><span> puts <span style="color:#e6db74">&#34;LocalState:</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">#{</span><span style="color:#66d9ef">Rbcli</span><span style="color:#f92672">.</span>local_state<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span> <span style="color:#75715e"># Local persistent state storage (when available) -- if unsure use Rbcli.local_state.nil?</span>
741
+ </span></span><span style="display:flex;"><span> puts <span style="color:#e6db74">&#34;RemoteState:</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">#{</span><span style="color:#66d9ef">Rbcli</span><span style="color:#f92672">.</span>remote_state<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span> <span style="color:#75715e"># Remote persistent state storage (when available) -- if unsure use Rbcli.remote_state.nil?</span>
742
+ </span></span><span style="display:flex;"><span> puts <span style="color:#e6db74">&#34;</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">Done!!!&#34;</span>
743
+ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">end</span>
744
+ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">end</span>
745
+ </span></span></code></pre></div><p>Commands are declared to RBCli simply by subclassing them from <code>Rbcli::Command</code> as shown above. Then, you have a list of declarations that tell RBCli information about it. They are:</p>
746
746
  <ul>
747
747
  <li><code>description</code>
748
748
  <ul>
@@ -773,38 +773,38 @@ rbcli command -n list
773
773
  <p>There is an additional declaration not shown here, <code>extern</code>. You can find more information on it in the section on <a href="/rbcli/advanced/command_types/">Advanced Command Types</a></p>
774
774
  <h2 id="creating-the-list-command">Creating the &ldquo;list&rdquo; Command</h2>
775
775
  <p>Now we&rsquo;re going to modify this command to list the contents of the current directory to the terminal. So let&rsquo;s change the code in that file to:</p>
776
- <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-ruby" data-lang="ruby"><span style="color:#66d9ef">class</span> <span style="color:#a6e22e">List</span> <span style="color:#f92672">&lt;</span> <span style="color:#66d9ef">Rbcli</span><span style="color:#f92672">::</span><span style="color:#66d9ef">Command</span>
777
- description <span style="color:#e6db74">%q{List files in current directory}</span>
778
- usage <span style="color:#e6db74">&lt;&lt;-EOF
779
- </span><span style="color:#e6db74"></span><span style="color:#66d9ef">Ever</span> wanted to see your files?
780
- <span style="color:#66d9ef">Now</span> you can!
781
- <span style="color:#66d9ef">EOF</span>
782
-
783
- action <span style="color:#66d9ef">do</span> <span style="color:#f92672">|</span>params, args, global_opts, config<span style="color:#f92672">|</span>
784
- filelist <span style="color:#f92672">=</span> <span style="color:#f92672">[]</span>
785
-
786
- <span style="color:#75715e"># We store a list of the files in an array, including dotfiles if specified</span>
787
- <span style="color:#66d9ef">Dir</span><span style="color:#f92672">.</span>glob <span style="color:#e6db74">&#34;./*&#34;</span> <span style="color:#66d9ef">do</span> <span style="color:#f92672">|</span>filename<span style="color:#f92672">|</span>
788
- outname <span style="color:#f92672">=</span> filename<span style="color:#f92672">.</span>split(<span style="color:#e6db74">&#39;/&#39;</span>)<span style="color:#f92672">[</span><span style="color:#ae81ff">1</span><span style="color:#f92672">]</span>
789
- outname <span style="color:#f92672">+=</span> <span style="color:#e6db74">&#39;/&#39;</span> <span style="color:#66d9ef">if</span> <span style="color:#66d9ef">File</span><span style="color:#f92672">.</span>directory? filename
790
- filelist<span style="color:#f92672">.</span>append outname
791
- <span style="color:#66d9ef">end</span>
792
-
793
- <span style="color:#75715e"># Apply color</span>
794
- filelist<span style="color:#f92672">.</span>map! <span style="color:#66d9ef">do</span> <span style="color:#f92672">|</span>filename<span style="color:#f92672">|</span>
795
- <span style="color:#66d9ef">if</span> <span style="color:#66d9ef">File</span><span style="color:#f92672">.</span>directory? filename
796
- filename<span style="color:#f92672">.</span>light_blue
797
- <span style="color:#66d9ef">elsif</span> <span style="color:#66d9ef">File</span><span style="color:#f92672">.</span>executable? filename
798
- filename<span style="color:#f92672">.</span>light_green
799
- <span style="color:#66d9ef">else</span>
800
- filename
801
- <span style="color:#66d9ef">end</span>
802
- <span style="color:#66d9ef">end</span> <span style="color:#66d9ef">if</span> global_opts<span style="color:#f92672">[</span><span style="color:#e6db74">:color</span><span style="color:#f92672">]</span>
803
-
804
- puts filelist
805
- <span style="color:#66d9ef">end</span>
806
- <span style="color:#66d9ef">end</span>
807
- </code></pre></div><p>Go ahead and test it out! The output doesn&rsquo;t show much obviously, just a list of names and nothing else. Don&rsquo;t worry though, we&rsquo;ll fix that in the next secion.</p>
776
+ <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-ruby" data-lang="ruby"><span style="display:flex;"><span><span style="color:#66d9ef">class</span> <span style="color:#a6e22e">List</span> <span style="color:#f92672">&lt;</span> <span style="color:#66d9ef">Rbcli</span><span style="color:#f92672">::</span><span style="color:#66d9ef">Command</span>
777
+ </span></span><span style="display:flex;"><span> description <span style="color:#e6db74">%q{List files in current directory}</span>
778
+ </span></span><span style="display:flex;"><span> usage <span style="color:#e6db74">&lt;&lt;-EOF
779
+ </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"></span><span style="color:#66d9ef">Ever</span> wanted to see your files?
780
+ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">Now</span> you can!
781
+ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">EOF</span>
782
+ </span></span><span style="display:flex;"><span>
783
+ </span></span><span style="display:flex;"><span> action <span style="color:#66d9ef">do</span> <span style="color:#f92672">|</span>params, args, global_opts, config<span style="color:#f92672">|</span>
784
+ </span></span><span style="display:flex;"><span> filelist <span style="color:#f92672">=</span> <span style="color:#f92672">[]</span>
785
+ </span></span><span style="display:flex;"><span>
786
+ </span></span><span style="display:flex;"><span> <span style="color:#75715e"># We store a list of the files in an array, including dotfiles if specified</span>
787
+ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">Dir</span><span style="color:#f92672">.</span>glob <span style="color:#e6db74">&#34;./*&#34;</span> <span style="color:#66d9ef">do</span> <span style="color:#f92672">|</span>filename<span style="color:#f92672">|</span>
788
+ </span></span><span style="display:flex;"><span> outname <span style="color:#f92672">=</span> filename<span style="color:#f92672">.</span>split(<span style="color:#e6db74">&#39;/&#39;</span>)<span style="color:#f92672">[</span><span style="color:#ae81ff">1</span><span style="color:#f92672">]</span>
789
+ </span></span><span style="display:flex;"><span> outname <span style="color:#f92672">+=</span> <span style="color:#e6db74">&#39;/&#39;</span> <span style="color:#66d9ef">if</span> <span style="color:#66d9ef">File</span><span style="color:#f92672">.</span>directory? filename
790
+ </span></span><span style="display:flex;"><span> filelist<span style="color:#f92672">.</span>append outname
791
+ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">end</span>
792
+ </span></span><span style="display:flex;"><span>
793
+ </span></span><span style="display:flex;"><span> <span style="color:#75715e"># Apply color</span>
794
+ </span></span><span style="display:flex;"><span> filelist<span style="color:#f92672">.</span>map! <span style="color:#66d9ef">do</span> <span style="color:#f92672">|</span>filename<span style="color:#f92672">|</span>
795
+ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">if</span> <span style="color:#66d9ef">File</span><span style="color:#f92672">.</span>directory? filename
796
+ </span></span><span style="display:flex;"><span> filename<span style="color:#f92672">.</span>light_blue
797
+ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">elsif</span> <span style="color:#66d9ef">File</span><span style="color:#f92672">.</span>executable? filename
798
+ </span></span><span style="display:flex;"><span> filename<span style="color:#f92672">.</span>light_green
799
+ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">else</span>
800
+ </span></span><span style="display:flex;"><span> filename
801
+ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">end</span>
802
+ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">end</span> <span style="color:#66d9ef">if</span> global_opts<span style="color:#f92672">[</span><span style="color:#e6db74">:color</span><span style="color:#f92672">]</span>
803
+ </span></span><span style="display:flex;"><span>
804
+ </span></span><span style="display:flex;"><span> puts filelist
805
+ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">end</span>
806
+ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">end</span>
807
+ </span></span></code></pre></div><p>Go ahead and test it out! The output doesn&rsquo;t show much obviously, just a list of names and nothing else. Don&rsquo;t worry though, we&rsquo;ll fix that in the next secion.</p>
808
808
  <h2 id="next-steps">Next Steps</h2>
809
809
  <p>Next we&rsquo;re going to take a look at options, parameters, and arguments, and we&rsquo;ll clean up our list command by using them. If you&rsquo;d like to learn more about the additional command types in RBCli before continuing, see the <a href="/rbcli/advanced/command_types/">Advanced Command Types</a> documentation.</p>
810
810
 
@@ -1240,19 +1240,19 @@ rbcli command -n list
1240
1240
  <div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
1241
1241
  <div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
1242
1242
  </div>
1243
- <script src="/rbcli/js/clipboard.min.js?1634703589"></script>
1244
- <script src="/rbcli/js/perfect-scrollbar.min.js?1634703589"></script>
1245
- <script src="/rbcli/js/perfect-scrollbar.jquery.min.js?1634703589"></script>
1246
- <script src="/rbcli/js/jquery.sticky.js?1634703589"></script>
1247
- <script src="/rbcli/js/featherlight.min.js?1634703589"></script>
1248
- <script src="/rbcli/js/highlight.pack.js?1634703589"></script>
1243
+ <script src="/rbcli/js/clipboard.min.js?1713907739"></script>
1244
+ <script src="/rbcli/js/perfect-scrollbar.min.js?1713907739"></script>
1245
+ <script src="/rbcli/js/perfect-scrollbar.jquery.min.js?1713907739"></script>
1246
+ <script src="/rbcli/js/jquery.sticky.js?1713907739"></script>
1247
+ <script src="/rbcli/js/featherlight.min.js?1713907739"></script>
1248
+ <script src="/rbcli/js/highlight.pack.js?1713907739"></script>
1249
1249
  <script>hljs.initHighlightingOnLoad();</script>
1250
- <script src="/rbcli/js/modernizr.custom-3.6.0.js?1634703589"></script>
1251
- <script src="/rbcli/js/learn.js?1634703589"></script>
1252
- <script src="/rbcli/js/hugo-learn.js?1634703589"></script>
1250
+ <script src="/rbcli/js/modernizr.custom-3.6.0.js?1713907739"></script>
1251
+ <script src="/rbcli/js/learn.js?1713907739"></script>
1252
+ <script src="/rbcli/js/hugo-learn.js?1713907739"></script>
1253
1253
 
1254
- <link href="/rbcli/mermaid/mermaid.css?1634703589" rel="stylesheet" />
1255
- <script src="/rbcli/mermaid/mermaid.js?1634703589"></script>
1254
+ <link href="/rbcli/mermaid/mermaid.css?1713907739" rel="stylesheet" />
1255
+ <script src="/rbcli/mermaid/mermaid.js?1713907739"></script>
1256
1256
  <script>
1257
1257
  mermaid.initialize({ startOnLoad: true });
1258
1258
  </script>