rbcli 0.3.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/Gemfile.lock +55 -51
  4. data/README.md +2 -2
  5. data/docs/404.html +8 -8
  6. data/docs/advanced/automatic_updates/index.html +28 -28
  7. data/docs/advanced/command_types/index.html +35 -35
  8. data/docs/advanced/distributed_state_locking/index.html +28 -28
  9. data/docs/advanced/hooks/index.html +30 -30
  10. data/docs/advanced/index.html +26 -26
  11. data/docs/advanced/index.xml +2 -6
  12. data/docs/advanced/interactive_commands/index.html +29 -29
  13. data/docs/advanced/logging/index.html +32 -32
  14. data/docs/advanced/remote_execution/index.html +31 -31
  15. data/docs/advanced/state_storage/index.html +30 -30
  16. data/docs/advanced/user_config_files/index.html +28 -28
  17. data/docs/categories/index.html +26 -26
  18. data/docs/categories/index.xml +2 -6
  19. data/docs/development/changelog/index.html +53 -40
  20. data/docs/development/code_of_conduct/index.html +27 -27
  21. data/docs/development/contributing/index.html +32 -32
  22. data/docs/development/index.html +26 -26
  23. data/docs/development/index.xml +3 -7
  24. data/docs/development/license/index.html +26 -26
  25. data/docs/index.html +26 -26
  26. data/docs/index.json +3 -3
  27. data/docs/index.xml +3 -7
  28. data/docs/quick_reference/index.html +39 -39
  29. data/docs/quick_reference/index.xml +2 -6
  30. data/docs/sitemap.xml +26 -78
  31. data/docs/tags/index.html +26 -26
  32. data/docs/tags/index.xml +2 -6
  33. data/docs/tutorial/10-getting_started/index.html +29 -29
  34. data/docs/tutorial/20-project_layout/index.html +29 -29
  35. data/docs/tutorial/30-your_first_command/index.html +32 -32
  36. data/docs/tutorial/40-options_parameters_and_arguments/index.html +41 -41
  37. data/docs/tutorial/50-publishing/index.html +27 -27
  38. data/docs/tutorial/index.html +26 -26
  39. data/docs/tutorial/index.xml +2 -6
  40. data/docs/whoami/index.html +26 -26
  41. data/docs/whoami/index.xml +2 -6
  42. data/docs-src/content/development/changelog.md +9 -0
  43. data/docs-src/content/quick_reference/_index.md +2 -2
  44. data/exe/rbcli +1 -1
  45. data/lib/rbcli/configuration/configurate.rb +1 -1
  46. data/lib/rbcli/engine/command.rb +2 -1
  47. data/lib/rbcli/engine/load_project.rb +1 -1
  48. data/lib/rbcli/features/userconfig.rb +3 -3
  49. data/lib/rbcli/state_storage/localstate.rb +1 -1
  50. data/lib/rbcli/version.rb +1 -1
  51. data/lib/rbcli-tool/generators.rb +3 -3
  52. data/lib/rbcli-tool/mdless_fix.rb +1 -1
  53. data/lib/rbcli-tool/project.rb +3 -3
  54. data/lib/rbcli-tool/util.rb +2 -2
  55. data/rbcli.gemspec +11 -13
  56. data/skeletons/project/application/commands/scripts/script.sh +6 -1
  57. data/skeletons/project/untitled.gemspec +3 -3
  58. metadata +32 -32
@@ -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.74.3" />
6
+ <meta name="generator" content="Hugo 0.88.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?1596148729" rel="stylesheet">
16
- <link href="/rbcli/css/fontawesome-all.min.css?1596148729" rel="stylesheet">
17
- <link href="/rbcli/css/hybrid.css?1596148729" rel="stylesheet">
18
- <link href="/rbcli/css/featherlight.min.css?1596148729" rel="stylesheet">
19
- <link href="/rbcli/css/perfect-scrollbar.min.css?1596148729" rel="stylesheet">
20
- <link href="/rbcli/css/auto-complete.css?1596148729" rel="stylesheet">
21
- <link href="/rbcli/css/atom-one-dark-reasonable.css?1596148729" rel="stylesheet">
22
- <link href="/rbcli/css/theme.css?1596148729" rel="stylesheet">
23
- <link href="/rbcli/css/hugo-theme.css?1596148729" rel="stylesheet">
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">
24
24
 
25
- <link href="/rbcli/css/theme-blue.css?1596148729" rel="stylesheet">
25
+ <link href="/rbcli/css/theme-blue.css?1634703589" rel="stylesheet">
26
26
 
27
27
 
28
28
 
29
- <script src="/rbcli/js/jquery-3.3.1.min.js?1596148729"></script>
29
+ <script src="/rbcli/js/jquery-3.3.1.min.js?1634703589"></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?1596148729"></script>
59
- <script type="text/javascript" src="/rbcli/js/auto-complete.js?1596148729"></script>
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>
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?1596148729"></script>
65
+ <script type="text/javascript" src="/rbcli/js/search.js?1634703589"></script>
66
66
 
67
67
 
68
68
  </div>
@@ -712,11 +712,11 @@
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 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
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
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 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>
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
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 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
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
720
  ls -ahl
721
721
  </code></pre></div><p>Congratulations! This is the beginning of your first project.</p>
722
722
  <h2 id="next-steps">Next Steps</h2>
@@ -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?1596148729"></script>
1155
- <script src="/rbcli/js/perfect-scrollbar.min.js?1596148729"></script>
1156
- <script src="/rbcli/js/perfect-scrollbar.jquery.min.js?1596148729"></script>
1157
- <script src="/rbcli/js/jquery.sticky.js?1596148729"></script>
1158
- <script src="/rbcli/js/featherlight.min.js?1596148729"></script>
1159
- <script src="/rbcli/js/highlight.pack.js?1596148729"></script>
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>
1160
1160
  <script>hljs.initHighlightingOnLoad();</script>
1161
- <script src="/rbcli/js/modernizr.custom-3.6.0.js?1596148729"></script>
1162
- <script src="/rbcli/js/learn.js?1596148729"></script>
1163
- <script src="/rbcli/js/hugo-learn.js?1596148729"></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>
1164
1164
 
1165
- <link href="/rbcli/mermaid/mermaid.css?1596148729" rel="stylesheet" />
1166
- <script src="/rbcli/mermaid/mermaid.js?1596148729"></script>
1165
+ <link href="/rbcli/mermaid/mermaid.css?1634703589" rel="stylesheet" />
1166
+ <script src="/rbcli/mermaid/mermaid.js?1634703589"></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.74.3" />
6
+ <meta name="generator" content="Hugo 0.88.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?1596148729" rel="stylesheet">
16
- <link href="/rbcli/css/fontawesome-all.min.css?1596148729" rel="stylesheet">
17
- <link href="/rbcli/css/hybrid.css?1596148729" rel="stylesheet">
18
- <link href="/rbcli/css/featherlight.min.css?1596148729" rel="stylesheet">
19
- <link href="/rbcli/css/perfect-scrollbar.min.css?1596148729" rel="stylesheet">
20
- <link href="/rbcli/css/auto-complete.css?1596148729" rel="stylesheet">
21
- <link href="/rbcli/css/atom-one-dark-reasonable.css?1596148729" rel="stylesheet">
22
- <link href="/rbcli/css/theme.css?1596148729" rel="stylesheet">
23
- <link href="/rbcli/css/hugo-theme.css?1596148729" rel="stylesheet">
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">
24
24
 
25
- <link href="/rbcli/css/theme-blue.css?1596148729" rel="stylesheet">
25
+ <link href="/rbcli/css/theme-blue.css?1634703589" rel="stylesheet">
26
26
 
27
27
 
28
28
 
29
- <script src="/rbcli/js/jquery-3.3.1.min.js?1596148729"></script>
29
+ <script src="/rbcli/js/jquery-3.3.1.min.js?1634703589"></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?1596148729"></script>
59
- <script type="text/javascript" src="/rbcli/js/auto-complete.js?1596148729"></script>
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>
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?1596148729"></script>
65
+ <script type="text/javascript" src="/rbcli/js/search.js?1634703589"></script>
66
66
 
67
67
 
68
68
  </div>
@@ -722,19 +722,19 @@
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 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
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
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>
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 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
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
731
  <span style="color:#75715e"># or</span>
732
732
  rbcli init -n mytool -t micro
733
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>
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 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;/
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
738
  |--- application/
739
739
  | |--- commands/
740
740
  | | |--- scripts/
@@ -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?1596148729"></script>
1280
- <script src="/rbcli/js/perfect-scrollbar.min.js?1596148729"></script>
1281
- <script src="/rbcli/js/perfect-scrollbar.jquery.min.js?1596148729"></script>
1282
- <script src="/rbcli/js/jquery.sticky.js?1596148729"></script>
1283
- <script src="/rbcli/js/featherlight.min.js?1596148729"></script>
1284
- <script src="/rbcli/js/highlight.pack.js?1596148729"></script>
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>
1285
1285
  <script>hljs.initHighlightingOnLoad();</script>
1286
- <script src="/rbcli/js/modernizr.custom-3.6.0.js?1596148729"></script>
1287
- <script src="/rbcli/js/learn.js?1596148729"></script>
1288
- <script src="/rbcli/js/hugo-learn.js?1596148729"></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>
1289
1289
 
1290
- <link href="/rbcli/mermaid/mermaid.css?1596148729" rel="stylesheet" />
1291
- <script src="/rbcli/mermaid/mermaid.js?1596148729"></script>
1290
+ <link href="/rbcli/mermaid/mermaid.css?1634703589" rel="stylesheet" />
1291
+ <script src="/rbcli/mermaid/mermaid.js?1634703589"></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.74.3" />
6
+ <meta name="generator" content="Hugo 0.88.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?1596148729" rel="stylesheet">
16
- <link href="/rbcli/css/fontawesome-all.min.css?1596148729" rel="stylesheet">
17
- <link href="/rbcli/css/hybrid.css?1596148729" rel="stylesheet">
18
- <link href="/rbcli/css/featherlight.min.css?1596148729" rel="stylesheet">
19
- <link href="/rbcli/css/perfect-scrollbar.min.css?1596148729" rel="stylesheet">
20
- <link href="/rbcli/css/auto-complete.css?1596148729" rel="stylesheet">
21
- <link href="/rbcli/css/atom-one-dark-reasonable.css?1596148729" rel="stylesheet">
22
- <link href="/rbcli/css/theme.css?1596148729" rel="stylesheet">
23
- <link href="/rbcli/css/hugo-theme.css?1596148729" rel="stylesheet">
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">
24
24
 
25
- <link href="/rbcli/css/theme-blue.css?1596148729" rel="stylesheet">
25
+ <link href="/rbcli/css/theme-blue.css?1634703589" rel="stylesheet">
26
26
 
27
27
 
28
28
 
29
- <script src="/rbcli/js/jquery-3.3.1.min.js?1596148729"></script>
29
+ <script src="/rbcli/js/jquery-3.3.1.min.js?1634703589"></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?1596148729"></script>
59
- <script type="text/javascript" src="/rbcli/js/auto-complete.js?1596148729"></script>
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>
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?1596148729"></script>
65
+ <script type="text/javascript" src="/rbcli/js/search.js?1634703589"></script>
66
66
 
67
67
 
68
68
  </div>
@@ -708,20 +708,20 @@
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 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
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
712
  <span style="color:#75715e">#or</span>
713
713
  rbcli command -n list
714
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 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
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
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>
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 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>
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
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 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
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
721
  </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 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>
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
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
726
  usage <span style="color:#e6db74">&lt;&lt;-EOF
727
727
  </span><span style="color:#e6db74"></span><span style="color:#e6db74">TODO</span>: <span style="color:#66d9ef">Usage</span> text goes here
@@ -773,7 +773,7 @@ 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 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>
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
777
  description <span style="color:#e6db74">%q{List files in current directory}</span>
778
778
  usage <span style="color:#e6db74">&lt;&lt;-EOF
779
779
  </span><span style="color:#e6db74"></span><span style="color:#66d9ef">Ever</span> wanted to see your files?
@@ -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?1596148729"></script>
1244
- <script src="/rbcli/js/perfect-scrollbar.min.js?1596148729"></script>
1245
- <script src="/rbcli/js/perfect-scrollbar.jquery.min.js?1596148729"></script>
1246
- <script src="/rbcli/js/jquery.sticky.js?1596148729"></script>
1247
- <script src="/rbcli/js/featherlight.min.js?1596148729"></script>
1248
- <script src="/rbcli/js/highlight.pack.js?1596148729"></script>
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>
1249
1249
  <script>hljs.initHighlightingOnLoad();</script>
1250
- <script src="/rbcli/js/modernizr.custom-3.6.0.js?1596148729"></script>
1251
- <script src="/rbcli/js/learn.js?1596148729"></script>
1252
- <script src="/rbcli/js/hugo-learn.js?1596148729"></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>
1253
1253
 
1254
- <link href="/rbcli/mermaid/mermaid.css?1596148729" rel="stylesheet" />
1255
- <script src="/rbcli/mermaid/mermaid.js?1596148729"></script>
1254
+ <link href="/rbcli/mermaid/mermaid.css?1634703589" rel="stylesheet" />
1255
+ <script src="/rbcli/mermaid/mermaid.js?1634703589"></script>
1256
1256
  <script>
1257
1257
  mermaid.initialize({ startOnLoad: true });
1258
1258
  </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.74.3" />
6
+ <meta name="generator" content="Hugo 0.88.1" />
7
7
  <meta name="description" content="">
8
8
 
9
9
 
@@ -12,21 +12,21 @@
12
12
  <title>Options, Parameters, and Arguments :: RBCli Documentation</title>
13
13
 
14
14
 
15
- <link href="/rbcli/css/nucleus.css?1596148729" rel="stylesheet">
16
- <link href="/rbcli/css/fontawesome-all.min.css?1596148729" rel="stylesheet">
17
- <link href="/rbcli/css/hybrid.css?1596148729" rel="stylesheet">
18
- <link href="/rbcli/css/featherlight.min.css?1596148729" rel="stylesheet">
19
- <link href="/rbcli/css/perfect-scrollbar.min.css?1596148729" rel="stylesheet">
20
- <link href="/rbcli/css/auto-complete.css?1596148729" rel="stylesheet">
21
- <link href="/rbcli/css/atom-one-dark-reasonable.css?1596148729" rel="stylesheet">
22
- <link href="/rbcli/css/theme.css?1596148729" rel="stylesheet">
23
- <link href="/rbcli/css/hugo-theme.css?1596148729" rel="stylesheet">
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">
24
24
 
25
- <link href="/rbcli/css/theme-blue.css?1596148729" rel="stylesheet">
25
+ <link href="/rbcli/css/theme-blue.css?1634703589" rel="stylesheet">
26
26
 
27
27
 
28
28
 
29
- <script src="/rbcli/js/jquery-3.3.1.min.js?1596148729"></script>
29
+ <script src="/rbcli/js/jquery-3.3.1.min.js?1634703589"></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?1596148729"></script>
59
- <script type="text/javascript" src="/rbcli/js/auto-complete.js?1596148729"></script>
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>
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?1596148729"></script>
65
+ <script type="text/javascript" src="/rbcli/js/search.js?1634703589"></script>
66
66
 
67
67
 
68
68
  </div>
@@ -715,7 +715,7 @@
715
715
  <p>If you&rsquo;re already an experienced coder, you can jump to the last section of this document, the <a href="#simplified-reference-tldr">Simplified Reference (TLDR)</a></p>
716
716
  <h2 id="command-line-structure">Command Line Structure</h2>
717
717
  <p>In the previous section, you saw two parts of the RBCli command line structure - the executable followed by the command. However, RBCli is capable of more complex interaction. The structure is as follows:</p>
718
- <pre><code>toolname [options] command [parameters] argument1 argument2...
718
+ <pre tabindex="0"><code>toolname [options] command [parameters] argument1 argument2...
719
719
  </code></pre><ul>
720
720
  <li><strong>Options</strong> are command line parameters such as <code>-f</code>, or <code>--force</code>. These are available globally to every command. You can create your own, though several are already built-in and reserved for RBCli:
721
721
  <ul>
@@ -730,18 +730,18 @@
730
730
  <li><strong>Arguments</strong> are strings that don&rsquo;t begin with a &lsquo;-&rsquo;, and are passed to the command&rsquo;s code as an array. These can be used as subcommands or additional parameters for your command.</li>
731
731
  </ul>
732
732
  <p>So a valid command could look something like these:</p>
733
- <div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">mytool -n load --filename<span style="color:#f92672">=</span>foo.txt
733
+ <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-shell" data-lang="shell">mytool -n load --filename<span style="color:#f92672">=</span>foo.txt
734
734
  mytool parse foo.txt
735
735
  mytool show -l
736
736
  </code></pre></div><p>Note that all options and parameters will have both a short and long version of the parameter available for use.</p>
737
737
  <p>So let&rsquo;s take a look at how we define them.</p>
738
738
  <h2 id="options">Options</h2>
739
739
  <p>You can find the options declarations under <code>application/options.rb</code>. You&rsquo;ll see the example in the code:</p>
740
- <div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-ruby" data-lang="ruby">option <span style="color:#e6db74">:name</span>, <span style="color:#e6db74">&#39;Give me your name&#39;</span>, <span style="color:#e6db74">short</span>: <span style="color:#e6db74">&#39;n&#39;</span>, <span style="color:#e6db74">type</span>: <span style="color:#e6db74">:string</span>, <span style="color:#e6db74">default</span>: <span style="color:#e6db74">&#39;Jack&#39;</span>, <span style="color:#e6db74">required</span>: <span style="color:#66d9ef">false</span>, <span style="color:#e6db74">permitted</span>: <span style="color:#f92672">[</span><span style="color:#e6db74">&#39;Jack&#39;</span>, <span style="color:#e6db74">&#39;Jill&#39;</span><span style="color:#f92672">]</span>
740
+ <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">option <span style="color:#e6db74">:name</span>, <span style="color:#e6db74">&#39;Give me your name&#39;</span>, <span style="color:#e6db74">short</span>: <span style="color:#e6db74">&#39;n&#39;</span>, <span style="color:#e6db74">type</span>: <span style="color:#e6db74">:string</span>, <span style="color:#e6db74">default</span>: <span style="color:#e6db74">&#39;Jack&#39;</span>, <span style="color:#e6db74">required</span>: <span style="color:#66d9ef">false</span>, <span style="color:#e6db74">permitted</span>: <span style="color:#f92672">[</span><span style="color:#e6db74">&#39;Jack&#39;</span>, <span style="color:#e6db74">&#39;Jill&#39;</span><span style="color:#f92672">]</span>
741
741
  </code></pre></div><p>This won&rsquo;t do for our tool, so let&rsquo;s change it. Remember that these options will be applicable to all of our commands, so lets make it something appropriate:</p>
742
- <div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-ruby" data-lang="ruby">option <span style="color:#e6db74">:color</span>, <span style="color:#e6db74">&#39;Enable color output&#39;</span>, <span style="color:#e6db74">short</span>: <span style="color:#e6db74">&#39;c&#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>
742
+ <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">option <span style="color:#e6db74">:color</span>, <span style="color:#e6db74">&#39;Enable color output&#39;</span>, <span style="color:#e6db74">short</span>: <span style="color:#e6db74">&#39;c&#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>
743
743
  </code></pre></div><p>So now, let&rsquo;s take advantage of this flag in our <code>list</code> command. Let&rsquo;s change our block to:</p>
744
- <div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-ruby" data-lang="ruby"> action <span style="color:#66d9ef">do</span> <span style="color:#f92672">|</span>params, args, global_opts, config<span style="color:#f92672">|</span>
744
+ <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"> action <span style="color:#66d9ef">do</span> <span style="color:#f92672">|</span>params, args, global_opts, config<span style="color:#f92672">|</span>
745
745
  <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>
746
746
  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>
747
747
  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
@@ -759,14 +759,14 @@ mytool show -l
759
759
  <span style="color:#66d9ef">end</span>
760
760
  <span style="color:#66d9ef">end</span>
761
761
  </code></pre></div><p>Notice how we referenced the value by using <code>global_opts[:color]</code>. It&rsquo;s that simple. To see it in action, run:</p>
762
- <div class="highlight"><pre 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 -c list
762
+ <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 -c list
763
763
  </code></pre></div><h2 id="parameters">Parameters</h2>
764
764
  <p>Parameters work the same way as options, but they are localized to only the selected command. They are declared - as you probably guessed by now - in the command&rsquo;s class. So let&rsquo;s add the following lines to our list command within the class declaration:</p>
765
- <div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-ruby" data-lang="ruby">parameter <span style="color:#e6db74">:sort</span>, <span style="color:#e6db74">&#39;Sort output alphabetically&#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>
765
+ <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">parameter <span style="color:#e6db74">:sort</span>, <span style="color:#e6db74">&#39;Sort output alphabetically&#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>
766
766
  parameter <span style="color:#e6db74">:all</span>, <span style="color:#e6db74">&#39;Show hidden files&#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>
767
767
  parameter <span style="color:#e6db74">:directoriesfirst</span>, <span style="color:#e6db74">&#39;Show directories on top&#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>
768
768
  </code></pre></div><p>And let&rsquo;s modify our action block to utilize them:</p>
769
- <div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-ruby" data-lang="ruby"> action <span style="color:#66d9ef">do</span> <span style="color:#f92672">|</span>params, args, global_opts, config<span style="color:#f92672">|</span>
769
+ <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"> action <span style="color:#66d9ef">do</span> <span style="color:#f92672">|</span>params, args, global_opts, config<span style="color:#f92672">|</span>
770
770
  filelist <span style="color:#f92672">=</span> <span style="color:#f92672">[]</span>
771
771
 
772
772
  <span style="color:#75715e"># We include dotfiles if specified</span>
@@ -809,21 +809,21 @@ parameter <span style="color:#e6db74">:directoriesfirst</span>, <span style="col
809
809
  puts filelist
810
810
  <span style="color:#66d9ef">end</span>
811
811
  </code></pre></div><p>You should be able to run it now:</p>
812
- <div class="highlight"><pre 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 -c list -asd
812
+ <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 -c list -asd
813
813
  </code></pre></div><p>Note how the parameters come after the <code>list</code> command in the syntax above. As you create more commands, each will have its own unique set of parameters, while the options remain <em>before</em> the command and are available to all of them.</p>
814
814
  <h3 id="user-prompting">User Prompting</h3>
815
815
  <p>There is an additional option when declaring parameters to prompt the user for a value if not entered on the command line. This can be done with the <code>prompt:</code> keyword. Let&rsquo;s change one of our parameters to utilize it:</p>
816
- <div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-ruby" data-lang="ruby">parameter <span style="color:#e6db74">:sort</span>, <span style="color:#e6db74">&#39;Sort output alphabetically&#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">prompt</span>: <span style="color:#e6db74">&#34;Sort output alphabetically?&#34;</span>
816
+ <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">parameter <span style="color:#e6db74">:sort</span>, <span style="color:#e6db74">&#39;Sort output alphabetically&#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">prompt</span>: <span style="color:#e6db74">&#34;Sort output alphabetically?&#34;</span>
817
817
  </code></pre></div><p>Now, let&rsquo;s run the tool while omitting the <code>--sort</code> parameter, as such:</p>
818
- <div class="highlight"><pre 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 -c list -ad
818
+ <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 -c list -ad
819
819
  </code></pre></div><p>This should give you the prompt:</p>
820
- <pre><code>Sort output alphabetically? (y/N):
820
+ <pre tabindex="0"><code>Sort output alphabetically? (y/N):
821
821
  </code></pre><p>Because we set the parameter to default to <code>false</code> the default here is <code>N</code>, which is used if the user hits enter without entering a letter. If the default was set to <code>true</code>, then the <code>Y</code> would be capitalized and be the default.</p>
822
822
  <p>For more information, see the documentation on <a href="/rbcli/advanced/interactive_commands/">Interactive Commands</a>.</p>
823
823
  <h2 id="arguments">Arguments</h2>
824
824
  <p>Lastly on the command line, there are arguments. Arguments are simply strings without the <code>-</code> character in front, and automatically get passed into an array in your applicaiton. Let&rsquo;s take a look at how we can use them.</p>
825
825
  <p>Unlike options and parameters, arguments require no setup. So let&rsquo;s assume that we want any arguments passed to the <code>list</code> command to be filenames that you want to display, and that you can pass multiple ones. Since arguments aren&rsquo;t listed automatically by the help function, this is a good example of what to put in your usage text. Let&rsquo;s take a look at what our class looks like now:</p>
826
- <div class="highlight"><pre 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>
826
+ <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>
827
827
  description <span style="color:#e6db74">%q{List files in current directory}</span>
828
828
  usage <span style="color:#e6db74">&lt;&lt;-EOF
829
829
  </span><span style="color:#e6db74"></span><span style="color:#66d9ef">To</span> list only specific files, you can enter filenames as arguments
@@ -880,12 +880,12 @@ parameter <span style="color:#e6db74">:directoriesfirst</span>, <span style="col
880
880
  <span style="color:#66d9ef">end</span>
881
881
  </code></pre></div><h2 id="simplified-reference-tldr">Simplified Reference (TLDR)</h2>
882
882
  <p>RBCli enforces a CLI structure of:</p>
883
- <pre><code>toolname [options] command [parameters] argument1 argument2...
883
+ <pre tabindex="0"><code>toolname [options] command [parameters] argument1 argument2...
884
884
  </code></pre><p><strong>Options</strong> are declared in <code>application/options.rb</code> file.</p>
885
885
  <p><strong>Parameters</strong> are declared in the respective command&rsquo;s class declaration.</p>
886
886
  <p><strong>Arguments</strong> don&rsquo;t need to be declared, and are passed in as an array to your commands. It is helpful to describe the argument purpose in the <code>usage</code> text declaration so that the user can see what to do in the help.</p>
887
887
  <p><strong>Options</strong> and <strong>parameters</strong> both use the same format:</p>
888
- <div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-ruby" data-lang="ruby">option <span style="color:#e6db74">:&lt;</span>name<span style="color:#f92672">&gt;</span>, <span style="color:#e6db74">&#34;&lt;description_string&gt;&#34;</span>, <span style="color:#e6db74">short</span>: <span style="color:#e6db74">&#39;&lt;character&gt;&#39;</span>, <span style="color:#e6db74">type</span>: <span style="color:#f92672">&lt;</span>variable_type<span style="color:#f92672">&gt;</span>, <span style="color:#e6db74">default</span>: <span style="color:#f92672">&lt;</span>default_value<span style="color:#f92672">&gt;</span>, <span style="color:#e6db74">permitted</span>: <span style="color:#f92672">[&lt;</span>array_of_permitted_values<span style="color:#f92672">]</span>
888
+ <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">option <span style="color:#e6db74">:&lt;</span>name<span style="color:#f92672">&gt;</span>, <span style="color:#e6db74">&#34;&lt;description_string&gt;&#34;</span>, <span style="color:#e6db74">short</span>: <span style="color:#e6db74">&#39;&lt;character&gt;&#39;</span>, <span style="color:#e6db74">type</span>: <span style="color:#f92672">&lt;</span>variable_type<span style="color:#f92672">&gt;</span>, <span style="color:#e6db74">default</span>: <span style="color:#f92672">&lt;</span>default_value<span style="color:#f92672">&gt;</span>, <span style="color:#e6db74">permitted</span>: <span style="color:#f92672">[&lt;</span>array_of_permitted_values<span style="color:#f92672">]</span>
889
889
 
890
890
  parameter <span style="color:#e6db74">:&lt;</span>name<span style="color:#f92672">&gt;</span>, <span style="color:#e6db74">&#34;&lt;description_string&gt;&#34;</span>, <span style="color:#e6db74">short</span>: <span style="color:#e6db74">&#39;&lt;character&gt;&#39;</span>, <span style="color:#e6db74">type</span>: <span style="color:#f92672">&lt;</span>variable_type<span style="color:#f92672">&gt;</span>, <span style="color:#e6db74">default</span>: <span style="color:#f92672">&lt;</span>default_value<span style="color:#f92672">&gt;</span>, <span style="color:#e6db74">permitted</span>: <span style="color:#f92672">[&lt;</span>array_of_permitted_values<span style="color:#f92672">]</span>
891
891
  </code></pre></div><ul>
@@ -1361,19 +1361,19 @@ parameter <span style="color:#e6db74">:&lt;</span>name<span style="color:#f92672
1361
1361
  <div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
1362
1362
  <div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
1363
1363
  </div>
1364
- <script src="/rbcli/js/clipboard.min.js?1596148729"></script>
1365
- <script src="/rbcli/js/perfect-scrollbar.min.js?1596148729"></script>
1366
- <script src="/rbcli/js/perfect-scrollbar.jquery.min.js?1596148729"></script>
1367
- <script src="/rbcli/js/jquery.sticky.js?1596148729"></script>
1368
- <script src="/rbcli/js/featherlight.min.js?1596148729"></script>
1369
- <script src="/rbcli/js/highlight.pack.js?1596148729"></script>
1364
+ <script src="/rbcli/js/clipboard.min.js?1634703589"></script>
1365
+ <script src="/rbcli/js/perfect-scrollbar.min.js?1634703589"></script>
1366
+ <script src="/rbcli/js/perfect-scrollbar.jquery.min.js?1634703589"></script>
1367
+ <script src="/rbcli/js/jquery.sticky.js?1634703589"></script>
1368
+ <script src="/rbcli/js/featherlight.min.js?1634703589"></script>
1369
+ <script src="/rbcli/js/highlight.pack.js?1634703589"></script>
1370
1370
  <script>hljs.initHighlightingOnLoad();</script>
1371
- <script src="/rbcli/js/modernizr.custom-3.6.0.js?1596148729"></script>
1372
- <script src="/rbcli/js/learn.js?1596148729"></script>
1373
- <script src="/rbcli/js/hugo-learn.js?1596148729"></script>
1371
+ <script src="/rbcli/js/modernizr.custom-3.6.0.js?1634703589"></script>
1372
+ <script src="/rbcli/js/learn.js?1634703589"></script>
1373
+ <script src="/rbcli/js/hugo-learn.js?1634703589"></script>
1374
1374
 
1375
- <link href="/rbcli/mermaid/mermaid.css?1596148729" rel="stylesheet" />
1376
- <script src="/rbcli/mermaid/mermaid.js?1596148729"></script>
1375
+ <link href="/rbcli/mermaid/mermaid.css?1634703589" rel="stylesheet" />
1376
+ <script src="/rbcli/mermaid/mermaid.js?1634703589"></script>
1377
1377
  <script>
1378
1378
  mermaid.initialize({ startOnLoad: true });
1379
1379
  </script>