rbcli 0.2.12 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/Gemfile.lock +39 -38
- data/docs-src/content/development/changelog.md +16 -1
- data/docs-src/themes/hugo-theme-learn/CHANGELOG.md +74 -2
- data/docs-src/themes/hugo-theme-learn/README.md +42 -5
- data/docs-src/themes/hugo-theme-learn/exampleSite/config.toml +27 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/_index.zh.md +12 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/configuration/_index.en.md +6 -4
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/configuration/_index.fr.md +7 -5
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/installation/_index.en.md +1 -1
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/markdown.en.md +88 -61
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/pages/_index.fr.md +3 -3
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/syntaxhighlight.en.md +89 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/_index.en.md +2 -2
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/notice.en.md +2 -2
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/showcase.en.md +4 -1
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/showcase.fr.md +4 -1
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/fonts/monogramos-webfont.svg +1 -237
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/images/showcase/inteliver_docs.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/images/showcase/tshark_dev.png +0 -0
- data/docs-src/themes/hugo-theme-learn/i18n/ar.toml +26 -0
- data/docs-src/themes/hugo-theme-learn/i18n/de.toml +26 -0
- data/docs-src/themes/hugo-theme-learn/i18n/hi.toml +26 -0
- data/docs-src/themes/hugo-theme-learn/i18n/ja.toml +26 -0
- data/docs-src/themes/hugo-theme-learn/i18n/ru.toml +26 -0
- data/docs-src/themes/hugo-theme-learn/i18n/zh-cn.toml +26 -0
- data/docs-src/themes/hugo-theme-learn/layouts/_default/list.html +1 -1
- data/docs-src/themes/hugo-theme-learn/layouts/_default/single.html +1 -2
- data/docs-src/themes/hugo-theme-learn/layouts/partials/footer.html +3 -4
- data/docs-src/themes/hugo-theme-learn/layouts/partials/header.html +8 -6
- data/docs-src/themes/hugo-theme-learn/layouts/partials/menu.html +6 -5
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/children.html +2 -2
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/ref.html +1 -1
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/relref.html +1 -1
- data/docs-src/themes/hugo-theme-learn/netlify.toml +1 -2
- data/docs-src/themes/hugo-theme-learn/static/css/theme.css +4 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Inconsolata.svg +1 -359
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-Normal-webfont.svg +1 -1019
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-UltraLight-webfont.svg +1 -918
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_200.svg +1 -332
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_300.svg +1 -331
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_500.svg +1 -333
- data/docs-src/themes/hugo-theme-learn/static/images/clippy.svg +1 -1
- data/docs-src/themes/hugo-theme-learn/static/js/auto-complete.js +3 -223
- data/docs-src/themes/hugo-theme-learn/static/js/highlight.pack.js +6 -3
- data/docs-src/themes/hugo-theme-learn/static/js/hugo-learn.js +8 -5
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-brands-400.svg +1 -1260
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-regular-400.svg +1 -471
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-solid-900.svg +1 -2763
- data/docs/404.html +8 -8
- data/docs/advanced/automatic_updates/index.html +85 -65
- data/docs/advanced/command_types/index.html +139 -144
- data/docs/advanced/distributed_state_locking/index.html +83 -55
- data/docs/advanced/hooks/index.html +94 -81
- data/docs/advanced/index.html +75 -34
- data/docs/advanced/index.xml +8 -8
- data/docs/advanced/interactive_commands/index.html +90 -66
- data/docs/advanced/logging/index.html +94 -67
- data/docs/advanced/remote_execution/index.html +94 -75
- data/docs/advanced/state_storage/index.html +122 -119
- data/docs/advanced/user_config_files/index.html +94 -71
- data/docs/categories/index.html +82 -30
- data/docs/categories/index.xml +1 -1
- data/docs/css/theme.css +4 -0
- data/docs/development/changelog/index.html +185 -177
- data/docs/development/code_of_conduct/index.html +85 -64
- data/docs/development/contributing/index.html +96 -96
- data/docs/development/index.html +75 -34
- data/docs/development/index.xml +2 -2
- data/docs/development/license/index.html +80 -46
- data/docs/fonts/Inconsolata.svg +1 -359
- data/docs/fonts/Novecentosanswide-Normal-webfont.svg +1 -1019
- data/docs/fonts/Novecentosanswide-UltraLight-webfont.svg +1 -918
- data/docs/fonts/Work_Sans_200.svg +1 -332
- data/docs/fonts/Work_Sans_300.svg +1 -331
- data/docs/fonts/Work_Sans_500.svg +1 -333
- data/docs/images/clippy.svg +1 -1
- data/docs/index.html +112 -61
- data/docs/index.json +24 -24
- data/docs/index.xml +13 -13
- data/docs/js/auto-complete.js +3 -223
- data/docs/js/highlight.pack.js +6 -3
- data/docs/js/hugo-learn.js +8 -5
- data/docs/quick_reference/index.html +126 -159
- data/docs/quick_reference/index.xml +1 -1
- data/docs/sitemap.xml +2 -4
- data/docs/tags/index.html +82 -30
- data/docs/tags/index.xml +1 -1
- data/docs/tutorial/10-getting_started/index.html +87 -66
- data/docs/tutorial/20-project_layout/index.html +126 -116
- data/docs/tutorial/30-your_first_command/index.html +151 -141
- data/docs/tutorial/40-options_parameters_and_arguments/index.html +233 -258
- data/docs/tutorial/50-publishing/index.html +86 -66
- data/docs/tutorial/index.html +75 -34
- data/docs/tutorial/index.xml +4 -4
- data/docs/webfonts/fa-brands-400.svg +1 -1260
- data/docs/webfonts/fa-regular-400.svg +1 -471
- data/docs/webfonts/fa-solid-900.svg +1 -2763
- data/docs/whoami/index.html +76 -46
- data/docs/whoami/index.xml +1 -1
- data/lib/rbcli/configuration/configurate_blocks/me.rb +5 -5
- data/lib/rbcli/util/deprecation_warning.rb +21 -4
- data/lib/rbcli/version.rb +1 -1
- data/rbcli.gemspec +8 -8
- data/skeletons/project/Gemfile +1 -1
- data/skeletons/project/config/general.rb +1 -1
- data/skeletons/project/lib/lib.erb +2 -0
- data/skeletons/project/spec/spec_helper.rb +7 -7
- data/skeletons/project/spec/untitled_spec.rb +6 -6
- data/skeletons/project/untitled.gemspec +28 -26
- metadata +29 -20
- data/docs-src/themes/hugo-theme-learn/static/js/html5shiv-printshiv.min.js +0 -4
data/docs/404.html
CHANGED
@@ -9,15 +9,15 @@
|
|
9
9
|
<title>404 Page not found</title>
|
10
10
|
|
11
11
|
|
12
|
-
<link href="/rbcli/css/nucleus.css?
|
13
|
-
<link href="/rbcli/css/fontawesome-all.min.css?
|
14
|
-
<link href="/rbcli/css/hybrid.css?
|
15
|
-
<link href="/rbcli/css/featherlight.min.css?
|
16
|
-
<link href="/rbcli/css/perfect-scrollbar.min.css?
|
17
|
-
<link href="/rbcli/css/theme.css?
|
18
|
-
<link href="/rbcli/css/hugo-theme.css?
|
12
|
+
<link href="/rbcli/css/nucleus.css?1596148729" rel="stylesheet">
|
13
|
+
<link href="/rbcli/css/fontawesome-all.min.css?1596148729" rel="stylesheet">
|
14
|
+
<link href="/rbcli/css/hybrid.css?1596148729" rel="stylesheet">
|
15
|
+
<link href="/rbcli/css/featherlight.min.css?1596148729" rel="stylesheet">
|
16
|
+
<link href="/rbcli/css/perfect-scrollbar.min.css?1596148729" rel="stylesheet">
|
17
|
+
<link href="/rbcli/css/theme.css?1596148729" rel="stylesheet">
|
18
|
+
<link href="/rbcli/css/hugo-theme.css?1596148729" rel="stylesheet">
|
19
19
|
|
20
|
-
<link href="/rbcli/css/theme-blue.css?
|
20
|
+
<link href="/rbcli/css/theme-blue.css?1596148729" rel="stylesheet">
|
21
21
|
|
22
22
|
<style>
|
23
23
|
:root #header + #content > #left > #rlblock_left {
|
@@ -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.
|
6
|
+
<meta name="generator" content="Hugo 0.74.3" />
|
7
7
|
<meta name="description" content="">
|
8
8
|
|
9
9
|
|
@@ -12,20 +12,21 @@
|
|
12
12
|
<title>Automatic Updates :: RBCli Documentation</title>
|
13
13
|
|
14
14
|
|
15
|
-
<link href="/rbcli/css/nucleus.css?
|
16
|
-
<link href="/rbcli/css/fontawesome-all.min.css?
|
17
|
-
<link href="/rbcli/css/hybrid.css?
|
18
|
-
<link href="/rbcli/css/featherlight.min.css?
|
19
|
-
<link href="/rbcli/css/perfect-scrollbar.min.css?
|
20
|
-
<link href="/rbcli/css/auto-complete.css?
|
21
|
-
<link href="/rbcli/css/atom-one-dark-reasonable.css?
|
22
|
-
<link href="/rbcli/css/theme.css?
|
23
|
-
<link href="/rbcli/css/hugo-theme.css?
|
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">
|
24
|
+
|
25
|
+
<link href="/rbcli/css/theme-blue.css?1596148729" rel="stylesheet">
|
24
26
|
|
25
|
-
<link href="/rbcli/css/theme-blue.css?1561087612" rel="stylesheet">
|
26
27
|
|
27
28
|
|
28
|
-
<script src="/rbcli/js/jquery-3.3.1.min.js?
|
29
|
+
<script src="/rbcli/js/jquery-3.3.1.min.js?1596148729"></script>
|
29
30
|
|
30
31
|
<style>
|
31
32
|
:root #header + #content > #left > #rlblock_left{
|
@@ -54,14 +55,14 @@
|
|
54
55
|
<span data-search-clear=""><i class="fas fa-times"></i></span>
|
55
56
|
</div>
|
56
57
|
|
57
|
-
<script type="text/javascript" src="/rbcli/js/lunr.min.js?
|
58
|
-
<script type="text/javascript" src="/rbcli/js/auto-complete.js?
|
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>
|
59
60
|
<script type="text/javascript">
|
60
61
|
|
61
62
|
var baseurl = "https:\/\/akhoury6.github.io\/rbcli\/";
|
62
63
|
|
63
64
|
</script>
|
64
|
-
<script type="text/javascript" src="/rbcli/js/search.js?
|
65
|
+
<script type="text/javascript" src="/rbcli/js/search.js?1596148729"></script>
|
65
66
|
|
66
67
|
|
67
68
|
</div>
|
@@ -74,6 +75,8 @@
|
|
74
75
|
|
75
76
|
|
76
77
|
|
78
|
+
|
79
|
+
|
77
80
|
|
78
81
|
|
79
82
|
|
@@ -96,6 +99,8 @@
|
|
96
99
|
|
97
100
|
|
98
101
|
|
102
|
+
|
103
|
+
|
99
104
|
|
100
105
|
|
101
106
|
|
@@ -121,6 +126,8 @@
|
|
121
126
|
|
122
127
|
|
123
128
|
|
129
|
+
|
130
|
+
|
124
131
|
|
125
132
|
|
126
133
|
|
@@ -140,6 +147,8 @@
|
|
140
147
|
|
141
148
|
|
142
149
|
|
150
|
+
|
151
|
+
|
143
152
|
|
144
153
|
|
145
154
|
|
@@ -159,6 +168,8 @@
|
|
159
168
|
|
160
169
|
|
161
170
|
|
171
|
+
|
172
|
+
|
162
173
|
|
163
174
|
|
164
175
|
|
@@ -178,6 +189,8 @@
|
|
178
189
|
|
179
190
|
|
180
191
|
|
192
|
+
|
193
|
+
|
181
194
|
|
182
195
|
|
183
196
|
|
@@ -197,6 +210,8 @@
|
|
197
210
|
|
198
211
|
|
199
212
|
|
213
|
+
|
214
|
+
|
200
215
|
|
201
216
|
|
202
217
|
|
@@ -223,6 +238,8 @@
|
|
223
238
|
|
224
239
|
|
225
240
|
|
241
|
+
|
242
|
+
|
226
243
|
|
227
244
|
|
228
245
|
|
@@ -248,6 +265,8 @@
|
|
248
265
|
|
249
266
|
|
250
267
|
|
268
|
+
|
269
|
+
|
251
270
|
|
252
271
|
|
253
272
|
|
@@ -267,6 +286,8 @@
|
|
267
286
|
|
268
287
|
|
269
288
|
|
289
|
+
|
290
|
+
|
270
291
|
|
271
292
|
|
272
293
|
|
@@ -286,6 +307,8 @@
|
|
286
307
|
|
287
308
|
|
288
309
|
|
310
|
+
|
311
|
+
|
289
312
|
|
290
313
|
|
291
314
|
|
@@ -305,6 +328,8 @@
|
|
305
328
|
|
306
329
|
|
307
330
|
|
331
|
+
|
332
|
+
|
308
333
|
|
309
334
|
|
310
335
|
|
@@ -324,6 +349,8 @@
|
|
324
349
|
|
325
350
|
|
326
351
|
|
352
|
+
|
353
|
+
|
327
354
|
|
328
355
|
|
329
356
|
|
@@ -343,6 +370,8 @@
|
|
343
370
|
|
344
371
|
|
345
372
|
|
373
|
+
|
374
|
+
|
346
375
|
|
347
376
|
|
348
377
|
|
@@ -362,6 +391,8 @@
|
|
362
391
|
|
363
392
|
|
364
393
|
|
394
|
+
|
395
|
+
|
365
396
|
|
366
397
|
|
367
398
|
|
@@ -381,6 +412,8 @@
|
|
381
412
|
|
382
413
|
|
383
414
|
|
415
|
+
|
416
|
+
|
384
417
|
|
385
418
|
|
386
419
|
|
@@ -400,6 +433,8 @@
|
|
400
433
|
|
401
434
|
|
402
435
|
|
436
|
+
|
437
|
+
|
403
438
|
|
404
439
|
|
405
440
|
|
@@ -426,6 +461,8 @@
|
|
426
461
|
|
427
462
|
|
428
463
|
|
464
|
+
|
465
|
+
|
429
466
|
|
430
467
|
|
431
468
|
|
@@ -451,6 +488,8 @@
|
|
451
488
|
|
452
489
|
|
453
490
|
|
491
|
+
|
492
|
+
|
454
493
|
|
455
494
|
|
456
495
|
|
@@ -470,6 +509,8 @@
|
|
470
509
|
|
471
510
|
|
472
511
|
|
512
|
+
|
513
|
+
|
473
514
|
|
474
515
|
|
475
516
|
|
@@ -489,6 +530,8 @@
|
|
489
530
|
|
490
531
|
|
491
532
|
|
533
|
+
|
534
|
+
|
492
535
|
|
493
536
|
|
494
537
|
|
@@ -508,6 +551,8 @@
|
|
508
551
|
|
509
552
|
|
510
553
|
|
554
|
+
|
555
|
+
|
511
556
|
|
512
557
|
|
513
558
|
|
@@ -534,6 +579,8 @@
|
|
534
579
|
|
535
580
|
|
536
581
|
|
582
|
+
|
583
|
+
|
537
584
|
|
538
585
|
|
539
586
|
|
@@ -585,7 +632,6 @@
|
|
585
632
|
|
586
633
|
|
587
634
|
|
588
|
-
|
589
635
|
<section id="body">
|
590
636
|
<div id="overlay"></div>
|
591
637
|
<div class="padding highlightable">
|
@@ -619,9 +665,9 @@
|
|
619
665
|
|
620
666
|
<a href='/rbcli/'></a> > <a href='/rbcli/advanced/'>Advanced</a> > Automatic Updates
|
621
667
|
|
622
|
-
|
668
|
+
|
623
669
|
|
624
|
-
|
670
|
+
|
625
671
|
|
626
672
|
|
627
673
|
|
@@ -631,13 +677,10 @@
|
|
631
677
|
<div class="progress">
|
632
678
|
<div class="wrapper">
|
633
679
|
<nav id="TableOfContents">
|
634
|
-
<ul>
|
635
|
-
<li>
|
636
|
-
<
|
637
|
-
|
638
|
-
<li><a href="#rubygems-org-update-check">Rubygems.org Update Check</a></li>
|
639
|
-
</ul></li>
|
640
|
-
</ul>
|
680
|
+
<ul>
|
681
|
+
<li><a href="#github-update-check">GitHub Update Check</a></li>
|
682
|
+
<li><a href="#rubygemsorg-update-check">Rubygems.org Update Check</a></li>
|
683
|
+
</ul>
|
641
684
|
</nav>
|
642
685
|
</div>
|
643
686
|
</div>
|
@@ -661,51 +704,29 @@
|
|
661
704
|
|
662
705
|
|
663
706
|
|
664
|
-
|
665
|
-
|
666
|
-
|
667
707
|
<p>RBCli can automatically notify users when an update is available. If <code>force_update</code> is set (see below), RBCli can halt execution until the user updates their application.</p>
|
668
|
-
|
669
708
|
<p>Two sources are currently supported: <strong>Github</strong> (including Enterprise) and <strong>RubyGems</strong>.</p>
|
670
|
-
|
671
709
|
<h2 id="github-update-check">GitHub Update Check</h2>
|
672
|
-
|
673
710
|
<p>The GitHub update check works best when paired with GitHub’s best practices on releases, where new releases are tagged on master with the format <strong>vX.X.X</strong>. See <a href="https://help.github.com/articles/creating-releases/">Github’s release documentation</a> to learn more.</p>
|
674
|
-
|
675
711
|
<p>RBCli will check your github repo’s tags and compare that version number with one specified in your application at <code>config/version.rb</code>.</p>
|
676
|
-
|
677
|
-
|
678
|
-
</code></pre>
|
679
|
-
|
680
|
-
<p>The <code>github_repo</code> should point to the repo using the <code>user/repo</code> syntax.</p>
|
681
|
-
|
712
|
+
<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">autoupdate <span style="color:#e6db74">github_repo</span>: <span style="color:#e6db74">'<your_user>/<your_repo>'</span>, <span style="color:#e6db74">access_token</span>: <span style="color:#66d9ef">nil</span>, <span style="color:#e6db74">enterprise_hostname</span>: <span style="color:#66d9ef">nil</span>, <span style="color:#e6db74">force_update</span>: <span style="color:#66d9ef">false</span>, <span style="color:#e6db74">message</span>: <span style="color:#66d9ef">nil</span>
|
713
|
+
</code></pre></div><p>The <code>github_repo</code> should point to the repo using the <code>user/repo</code> syntax.</p>
|
682
714
|
<p>The <code>access_token</code> can be overridden by the user via their config file, so it can be left as <code>nil</code> if you enable <a href="/rbcli/advanced/user_config_files/">Userspace Configuration</a>. The token is not needed at all if using a public repo. For instructions on generating a new access token, see <a href="https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/">here</a>.</p>
|
683
|
-
|
684
715
|
<p>The <code>enterprise_hostname</code> setting allows you to point RBCli at a local GitHub Enterprise server.</p>
|
685
|
-
|
686
716
|
<p>Setting <code>force_update: true</code> will halt execution if an update is available, forcing the user to update.</p>
|
687
|
-
|
688
717
|
<p>The <code>message</code> parameter allows setting a custom message that will be displayed when an update is available. Leaving it as <code>nil</code> will use the default message provided by RBCli.</p>
|
689
|
-
|
690
|
-
<h2 id="rubygems-org-update-check">Rubygems.org Update Check</h2>
|
691
|
-
|
718
|
+
<h2 id="rubygemsorg-update-check">Rubygems.org Update Check</h2>
|
692
719
|
<p>The Rubygems update check will check if there is a new published version of the gem on Rubygems.org. The latest published version is compared to the version number you configured RBCli with.</p>
|
693
|
-
|
694
|
-
|
695
|
-
</code></pre>
|
696
|
-
|
697
|
-
<p>The <code>gem</code> parameter should simply state the name of the gem.</p>
|
698
|
-
|
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-ruby" data-lang="ruby">autoupdate <span style="color:#e6db74">gem</span>: <span style="color:#e6db74">'<your_gem>'</span>, <span style="color:#e6db74">force_update</span>: <span style="color:#66d9ef">false</span>, <span style="color:#e6db74">message</span>: <span style="color:#66d9ef">nil</span>
|
721
|
+
</code></pre></div><p>The <code>gem</code> parameter should simply state the name of the gem.</p>
|
699
722
|
<p>Setting <code>force_update: true</code> will halt execution if an update is available, forcing the user to update.</p>
|
700
|
-
|
701
723
|
<p>The <code>message</code> parameter allows setting a custom message that will be displayed when an update is available. Leaving it as <code>nil</code> will use the default message provided by RBCli.</p>
|
702
724
|
|
703
725
|
|
704
|
-
<footer class="
|
726
|
+
<footer class="footline">
|
705
727
|
|
706
728
|
</footer>
|
707
729
|
|
708
|
-
|
709
730
|
|
710
731
|
</div>
|
711
732
|
|
@@ -1130,20 +1151,19 @@
|
|
1130
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;">
|
1131
1152
|
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
1132
1153
|
</div>
|
1133
|
-
<script src="/rbcli/js/clipboard.min.js?
|
1134
|
-
<script src="/rbcli/js/perfect-scrollbar.min.js?
|
1135
|
-
<script src="/rbcli/js/perfect-scrollbar.jquery.min.js?
|
1136
|
-
<script src="/rbcli/js/jquery.sticky.js?
|
1137
|
-
<script src="/rbcli/js/featherlight.min.js?
|
1138
|
-
<script src="/rbcli/js/
|
1139
|
-
<script src="/rbcli/js/highlight.pack.js?1561087612"></script>
|
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>
|
1140
1160
|
<script>hljs.initHighlightingOnLoad();</script>
|
1141
|
-
<script src="/rbcli/js/modernizr.custom-3.6.0.js?
|
1142
|
-
<script src="/rbcli/js/learn.js?
|
1143
|
-
<script src="/rbcli/js/hugo-learn.js?
|
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>
|
1144
1164
|
|
1145
|
-
<link href="/rbcli/mermaid/mermaid.css?
|
1146
|
-
<script src="/rbcli/mermaid/mermaid.js?
|
1165
|
+
<link href="/rbcli/mermaid/mermaid.css?1596148729" rel="stylesheet" />
|
1166
|
+
<script src="/rbcli/mermaid/mermaid.js?1596148729"></script>
|
1147
1167
|
<script>
|
1148
1168
|
mermaid.initialize({ startOnLoad: true });
|
1149
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.
|
6
|
+
<meta name="generator" content="Hugo 0.74.3" />
|
7
7
|
<meta name="description" content="">
|
8
8
|
|
9
9
|
|
@@ -12,20 +12,21 @@
|
|
12
12
|
<title>Command Types :: RBCli Documentation</title>
|
13
13
|
|
14
14
|
|
15
|
-
<link href="/rbcli/css/nucleus.css?
|
16
|
-
<link href="/rbcli/css/fontawesome-all.min.css?
|
17
|
-
<link href="/rbcli/css/hybrid.css?
|
18
|
-
<link href="/rbcli/css/featherlight.min.css?
|
19
|
-
<link href="/rbcli/css/perfect-scrollbar.min.css?
|
20
|
-
<link href="/rbcli/css/auto-complete.css?
|
21
|
-
<link href="/rbcli/css/atom-one-dark-reasonable.css?
|
22
|
-
<link href="/rbcli/css/theme.css?
|
23
|
-
<link href="/rbcli/css/hugo-theme.css?
|
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">
|
24
|
+
|
25
|
+
<link href="/rbcli/css/theme-blue.css?1596148729" rel="stylesheet">
|
24
26
|
|
25
|
-
<link href="/rbcli/css/theme-blue.css?1561087612" rel="stylesheet">
|
26
27
|
|
27
28
|
|
28
|
-
<script src="/rbcli/js/jquery-3.3.1.min.js?
|
29
|
+
<script src="/rbcli/js/jquery-3.3.1.min.js?1596148729"></script>
|
29
30
|
|
30
31
|
<style>
|
31
32
|
:root #header + #content > #left > #rlblock_left{
|
@@ -54,14 +55,14 @@
|
|
54
55
|
<span data-search-clear=""><i class="fas fa-times"></i></span>
|
55
56
|
</div>
|
56
57
|
|
57
|
-
<script type="text/javascript" src="/rbcli/js/lunr.min.js?
|
58
|
-
<script type="text/javascript" src="/rbcli/js/auto-complete.js?
|
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>
|
59
60
|
<script type="text/javascript">
|
60
61
|
|
61
62
|
var baseurl = "https:\/\/akhoury6.github.io\/rbcli\/";
|
62
63
|
|
63
64
|
</script>
|
64
|
-
<script type="text/javascript" src="/rbcli/js/search.js?
|
65
|
+
<script type="text/javascript" src="/rbcli/js/search.js?1596148729"></script>
|
65
66
|
|
66
67
|
|
67
68
|
</div>
|
@@ -74,6 +75,8 @@
|
|
74
75
|
|
75
76
|
|
76
77
|
|
78
|
+
|
79
|
+
|
77
80
|
|
78
81
|
|
79
82
|
|
@@ -96,6 +99,8 @@
|
|
96
99
|
|
97
100
|
|
98
101
|
|
102
|
+
|
103
|
+
|
99
104
|
|
100
105
|
|
101
106
|
|
@@ -121,6 +126,8 @@
|
|
121
126
|
|
122
127
|
|
123
128
|
|
129
|
+
|
130
|
+
|
124
131
|
|
125
132
|
|
126
133
|
|
@@ -140,6 +147,8 @@
|
|
140
147
|
|
141
148
|
|
142
149
|
|
150
|
+
|
151
|
+
|
143
152
|
|
144
153
|
|
145
154
|
|
@@ -159,6 +168,8 @@
|
|
159
168
|
|
160
169
|
|
161
170
|
|
171
|
+
|
172
|
+
|
162
173
|
|
163
174
|
|
164
175
|
|
@@ -178,6 +189,8 @@
|
|
178
189
|
|
179
190
|
|
180
191
|
|
192
|
+
|
193
|
+
|
181
194
|
|
182
195
|
|
183
196
|
|
@@ -197,6 +210,8 @@
|
|
197
210
|
|
198
211
|
|
199
212
|
|
213
|
+
|
214
|
+
|
200
215
|
|
201
216
|
|
202
217
|
|
@@ -223,6 +238,8 @@
|
|
223
238
|
|
224
239
|
|
225
240
|
|
241
|
+
|
242
|
+
|
226
243
|
|
227
244
|
|
228
245
|
|
@@ -248,6 +265,8 @@
|
|
248
265
|
|
249
266
|
|
250
267
|
|
268
|
+
|
269
|
+
|
251
270
|
|
252
271
|
|
253
272
|
|
@@ -267,6 +286,8 @@
|
|
267
286
|
|
268
287
|
|
269
288
|
|
289
|
+
|
290
|
+
|
270
291
|
|
271
292
|
|
272
293
|
|
@@ -286,6 +307,8 @@
|
|
286
307
|
|
287
308
|
|
288
309
|
|
310
|
+
|
311
|
+
|
289
312
|
|
290
313
|
|
291
314
|
|
@@ -305,6 +328,8 @@
|
|
305
328
|
|
306
329
|
|
307
330
|
|
331
|
+
|
332
|
+
|
308
333
|
|
309
334
|
|
310
335
|
|
@@ -324,6 +349,8 @@
|
|
324
349
|
|
325
350
|
|
326
351
|
|
352
|
+
|
353
|
+
|
327
354
|
|
328
355
|
|
329
356
|
|
@@ -343,6 +370,8 @@
|
|
343
370
|
|
344
371
|
|
345
372
|
|
373
|
+
|
374
|
+
|
346
375
|
|
347
376
|
|
348
377
|
|
@@ -362,6 +391,8 @@
|
|
362
391
|
|
363
392
|
|
364
393
|
|
394
|
+
|
395
|
+
|
365
396
|
|
366
397
|
|
367
398
|
|
@@ -381,6 +412,8 @@
|
|
381
412
|
|
382
413
|
|
383
414
|
|
415
|
+
|
416
|
+
|
384
417
|
|
385
418
|
|
386
419
|
|
@@ -400,6 +433,8 @@
|
|
400
433
|
|
401
434
|
|
402
435
|
|
436
|
+
|
437
|
+
|
403
438
|
|
404
439
|
|
405
440
|
|
@@ -426,6 +461,8 @@
|
|
426
461
|
|
427
462
|
|
428
463
|
|
464
|
+
|
465
|
+
|
429
466
|
|
430
467
|
|
431
468
|
|
@@ -451,6 +488,8 @@
|
|
451
488
|
|
452
489
|
|
453
490
|
|
491
|
+
|
492
|
+
|
454
493
|
|
455
494
|
|
456
495
|
|
@@ -470,6 +509,8 @@
|
|
470
509
|
|
471
510
|
|
472
511
|
|
512
|
+
|
513
|
+
|
473
514
|
|
474
515
|
|
475
516
|
|
@@ -489,6 +530,8 @@
|
|
489
530
|
|
490
531
|
|
491
532
|
|
533
|
+
|
534
|
+
|
492
535
|
|
493
536
|
|
494
537
|
|
@@ -508,6 +551,8 @@
|
|
508
551
|
|
509
552
|
|
510
553
|
|
554
|
+
|
555
|
+
|
511
556
|
|
512
557
|
|
513
558
|
|
@@ -534,6 +579,8 @@
|
|
534
579
|
|
535
580
|
|
536
581
|
|
582
|
+
|
583
|
+
|
537
584
|
|
538
585
|
|
539
586
|
|
@@ -585,7 +632,6 @@
|
|
585
632
|
|
586
633
|
|
587
634
|
|
588
|
-
|
589
635
|
<section id="body">
|
590
636
|
<div id="overlay"></div>
|
591
637
|
<div class="padding highlightable">
|
@@ -619,9 +665,9 @@
|
|
619
665
|
|
620
666
|
<a href='/rbcli/'></a> > <a href='/rbcli/advanced/'>Advanced</a> > Command Types
|
621
667
|
|
622
|
-
|
668
|
+
|
623
669
|
|
624
|
-
|
670
|
+
|
625
671
|
|
626
672
|
|
627
673
|
|
@@ -631,19 +677,17 @@
|
|
631
677
|
<div class="progress">
|
632
678
|
<div class="wrapper">
|
633
679
|
<nav id="TableOfContents">
|
634
|
-
<ul>
|
635
|
-
<li>
|
636
|
-
<
|
637
|
-
<li><a href="#
|
638
|
-
<li><a href="#
|
639
|
-
<
|
640
|
-
<li><a href="#
|
641
|
-
<
|
642
|
-
|
643
|
-
|
644
|
-
</ul
|
645
|
-
</ul></li>
|
646
|
-
</ul>
|
680
|
+
<ul>
|
681
|
+
<li><a href="#general-command-structure">General Command Structure</a></li>
|
682
|
+
<li><a href="#standard-commands">Standard Commands</a></li>
|
683
|
+
<li><a href="#scripted-commands">Scripted Commands</a></li>
|
684
|
+
<li><a href="#external-commands">External Commands</a>
|
685
|
+
<ul>
|
686
|
+
<li><a href="#direct-path-mode">Direct Path Mode</a></li>
|
687
|
+
<li><a href="#variable-path-mode">Variable Path Mode</a></li>
|
688
|
+
</ul>
|
689
|
+
</li>
|
690
|
+
</ul>
|
647
691
|
</nav>
|
648
692
|
</div>
|
649
693
|
</div>
|
@@ -667,155 +711,107 @@
|
|
667
711
|
|
668
712
|
|
669
713
|
|
670
|
-
|
671
|
-
|
672
|
-
|
673
714
|
<p>RBCli has three different command types:</p>
|
674
|
-
|
675
715
|
<ul>
|
676
716
|
<li><strong>Standard Commands</strong> (Ruby-based)</li>
|
677
717
|
<li><strong>Scripted Commands</strong> (Ruby+Bash based)</li>
|
678
718
|
<li><strong>External Commands</strong> (Wrapping a 3rd party application)</li>
|
679
719
|
</ul>
|
680
|
-
|
681
720
|
<p>This document is provided to be a reference. If you would like an in-depth tutorial, please see <a href="/rbcli/tutorial/30-your_first_command/">Your First Command</a>.</p>
|
682
|
-
|
683
721
|
<h2 id="general-command-structure">General Command Structure</h2>
|
684
|
-
|
685
722
|
<p>Commands in RBCli are created by subclassing <code>Rbcli::Command</code>. All commands share a certain common structure:</p>
|
686
|
-
|
687
|
-
<
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
</code></pre>
|
698
|
-
|
699
|
-
<ul>
|
723
|
+
<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"><</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
|
+
description <span style="color:#e6db74">'TODO: Description goes here'</span> <span style="color:#75715e"># (Required) Short description for the global help</span>
|
725
|
+
usage <span style="color:#e6db74"><<-EOF
|
726
|
+
</span><span style="color:#e6db74"></span><span style="color:#e6db74">TODO</span>: <span style="color:#66d9ef">Usage</span> text goes here
|
727
|
+
<span style="color:#66d9ef">EOF</span> <span style="color:#75715e"># (Required) Long description for the command-specific help</span>
|
728
|
+
parameter <span style="color:#e6db74">:force</span>, <span style="color:#e6db74">'Force testing'</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>
|
729
|
+
|
730
|
+
config_default <span style="color:#e6db74">:myopt2</span>, <span style="color:#e6db74">description</span>: <span style="color:#e6db74">'My Option #2'</span>, <span style="color:#e6db74">default</span>: <span style="color:#e6db74">'Default Value Here'</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>
|
731
|
+
<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>
|
732
|
+
<span style="color:#66d9ef">end</span>
|
733
|
+
</code></pre></div><ul>
|
700
734
|
<li><code>description</code>
|
701
|
-
|
702
735
|
<ul>
|
703
736
|
<li>A short description of the command, which will appear in the top-level help (when the user runs <code>mytool -h</code>).</li>
|
704
|
-
</ul
|
737
|
+
</ul>
|
738
|
+
</li>
|
705
739
|
<li><code>usage</code>
|
706
|
-
|
707
740
|
<ul>
|
708
741
|
<li>A description of how the command is meant to be used. This description can be as long as you want, and can be as in-depth as you’d like. It will show up as a long, multi-line description when the user runs the command-sepcific help (<code>mytool list -h</code>).</li>
|
709
|
-
</ul
|
742
|
+
</ul>
|
743
|
+
</li>
|
710
744
|
<li><code>parameter</code>
|
711
|
-
|
712
745
|
<ul>
|
713
746
|
<li>Command-line tags that the user can enter that are specific to only this command. We will get into these in the next section on <a href="/rbcli/tutorial/40-options_parameters_and_arguments/">Options, Parameters, and Arguments</a></li>
|
714
|
-
</ul
|
747
|
+
</ul>
|
748
|
+
</li>
|
715
749
|
<li><code>config_default</code>
|
716
|
-
|
717
750
|
<ul>
|
718
751
|
<li>This sets a single item in the config file that will be made available to the user. More information can be found in the documentation on <a href="/rbcli/advanced/user_config_files/">User Config Files</a></li>
|
719
|
-
</ul></li>
|
720
752
|
</ul>
|
721
|
-
|
753
|
+
</li>
|
754
|
+
</ul>
|
722
755
|
<h2 id="standard-commands">Standard Commands</h2>
|
723
|
-
|
724
756
|
<p>Standard commands are written as ruby code. To create a standard command called <code>list</code>, run:</p>
|
725
|
-
|
726
|
-
<
|
727
|
-
#or
|
757
|
+
<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
|
758
|
+
<span style="color:#75715e">#or</span>
|
728
759
|
rbcli command -n list
|
729
|
-
</code></pre>
|
730
|
-
|
731
|
-
<
|
732
|
-
|
733
|
-
<
|
734
|
-
|
735
|
-
|
736
|
-
end
|
737
|
-
end
|
738
|
-
</code></pre>
|
739
|
-
|
740
|
-
<p>Your application’s <strong>parameters</strong>, <strong>arguments</strong>, <strong>options</strong>, and <strong>config</strong> are available in the variables passed into the block. For more information on these, see <a href="/rbcli/tutorial/40-options_parameters_and_arguments/">Options, Parameters, and Arguments</a>.</p>
|
741
|
-
|
760
|
+
</code></pre></div><p>A standard command can be identified by the presence of an <code>action</code> block in the definition:</p>
|
761
|
+
<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"><</span> <span style="color:#66d9ef">Rbcli</span><span style="color:#f92672">::</span><span style="color:#66d9ef">Command</span>
|
762
|
+
action <span style="color:#66d9ef">do</span> <span style="color:#f92672">|</span>params, args, global_opts, config<span style="color:#f92672">|</span>
|
763
|
+
<span style="color:#75715e"># Code goes here</span>
|
764
|
+
<span style="color:#66d9ef">end</span>
|
765
|
+
<span style="color:#66d9ef">end</span>
|
766
|
+
</code></pre></div><p>Your application’s <strong>parameters</strong>, <strong>arguments</strong>, <strong>options</strong>, and <strong>config</strong> are available in the variables passed into the block. For more information on these, see <a href="/rbcli/tutorial/40-options_parameters_and_arguments/">Options, Parameters, and Arguments</a>.</p>
|
742
767
|
<h2 id="scripted-commands">Scripted Commands</h2>
|
743
|
-
|
744
768
|
<p>Scripted commands are part Ruby, part Bash scripting. They are a good choice to use if you feel something might be easier or more performant to script with Bash, or if you already have a Bash script you’d like to use in your project. You can create one with:</p>
|
745
|
-
|
746
|
-
|
747
|
-
</code></pre>
|
748
|
-
|
749
|
-
<p>This will create two files in your RBCli project: a Ruby file with the common command declaration (see <a href="#general-command-structure">General Command Structure</a>), and a bash script in the folder <code>application/commands/scripts/</code>.</p>
|
750
|
-
|
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-bash" data-lang="bash">rbcli script -n list
|
770
|
+
</code></pre></div><p>This will create two files in your RBCli project: a Ruby file with the common command declaration (see <a href="#general-command-structure">General Command Structure</a>), and a bash script in the folder <code>application/commands/scripts/</code>.</p>
|
751
771
|
<p>You can tell a command is a script by the line:</p>
|
752
|
-
|
753
|
-
<pre><code class="language-ruby">class List < Rbcli::Command
|
772
|
+
<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"><</span> <span style="color:#66d9ef">Rbcli</span><span style="color:#f92672">::</span><span style="color:#66d9ef">Command</span>
|
754
773
|
script
|
755
|
-
end
|
756
|
-
</code></pre>
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
<pre><code class="language-bash">source $(echo $(cd "$(dirname $(gem which rbcli))/../lib-sh" && pwd)/lib-rbcli.sh)
|
761
|
-
</code></pre>
|
762
|
-
|
763
|
-
<p>This will find the library which is stored on the system as part of the RBCli gem.</p>
|
764
|
-
|
774
|
+
<span style="color:#66d9ef">end</span>
|
775
|
+
</code></pre></div><p>RBCli will pass along your applications config and CLI parameters through JSON environment variables. To make things easy, a Bash library is provided that makes retrieving and parsing these variables easy. It is already imported when you generate the command, with the line:</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-bash" data-lang="bash">source <span style="color:#66d9ef">$(</span>echo <span style="color:#66d9ef">$(</span>cd <span style="color:#e6db74">"</span><span style="color:#66d9ef">$(</span>dirname <span style="color:#66d9ef">$(</span>gem which rbcli<span style="color:#66d9ef">))</span><span style="color:#e6db74">/../lib-sh"</span> <span style="color:#f92672">&&</span> pwd<span style="color:#66d9ef">)</span>/lib-rbcli.sh<span style="color:#66d9ef">)</span>
|
777
|
+
</code></pre></div><p>This will find the library which is stored on the system as part of the RBCli gem.</p>
|
765
778
|
<p>You can then retrieve the values present in your variables like such:</p>
|
766
|
-
|
767
|
-
<pre><code class="language-bash">rbcli params
|
779
|
+
<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 params
|
768
780
|
rbcli args
|
769
781
|
rbcli global_opts
|
770
782
|
rbcli config
|
771
783
|
rbcli myvars
|
772
784
|
|
773
|
-
echo
|
774
|
-
echo
|
775
|
-
echo
|
776
|
-
echo
|
777
|
-
</code></pre>
|
778
|
-
|
779
|
-
<p>For your convenience, the script will have all the instructions needed there. For more instructions on how to use JQ syntax to parse values, see the <a href="https://stedolan.github.io/jq/manual/">JQ documentation</a>.</p>
|
780
|
-
|
785
|
+
echo <span style="color:#e6db74">"Usage Examples:"</span>
|
786
|
+
echo <span style="color:#e6db74">"Log Level: </span><span style="color:#66d9ef">$(</span>rbcli config .logger.log_level<span style="color:#66d9ef">)</span><span style="color:#e6db74">"</span>
|
787
|
+
echo <span style="color:#e6db74">"Log Target: </span><span style="color:#66d9ef">$(</span>rbcli config .logger.log_target<span style="color:#66d9ef">)</span><span style="color:#e6db74">"</span>
|
788
|
+
echo <span style="color:#e6db74">"First Argument (if passed): </span><span style="color:#66d9ef">$(</span>rbcli args .<span style="color:#f92672">[</span>0<span style="color:#f92672">]</span><span style="color:#66d9ef">)</span><span style="color:#e6db74">"</span>
|
789
|
+
</code></pre></div><p>For your convenience, the script will have all the instructions needed there. For more instructions on how to use JQ syntax to parse values, see the <a href="https://stedolan.github.io/jq/manual/">JQ documentation</a>.</p>
|
781
790
|
<h2 id="external-commands">External Commands</h2>
|
782
|
-
|
783
791
|
<p>External Commands are used to wrap 3rd party applications. RBCli accomplishes this by allowing you to set environment variables and command line parameters based on your input variables.</p>
|
784
|
-
|
785
792
|
<p>RBCli provides this feature through the <code>extern</code> keyword. It provides two modes – <strong>direct path</strong> and <strong>variable path</strong> – which work similarly.</p>
|
786
|
-
|
787
793
|
<h3 id="direct-path-mode">Direct Path Mode</h3>
|
788
|
-
|
789
794
|
<p>Direct path mode is the simpler mode of the two External Command modes. It allows you to provide a specific command with environment variables set, though it does not allow using RBCli parameters, arguments, options, and config.</p>
|
790
|
-
|
791
|
-
<
|
792
|
-
|
793
|
-
|
794
|
-
</code></pre>
|
795
|
-
|
796
|
-
<p>Here, we supply a string to run the command. We can optioanlly provide environment variables which will be set for the external application.</p>
|
797
|
-
|
795
|
+
<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"><</span> <span style="color:#66d9ef">Rbcli</span><span style="color:#f92672">::</span><span style="color:#66d9ef">Command</span>
|
796
|
+
extern <span style="color:#e6db74">path</span>: <span style="color:#e6db74">'path/to/application'</span>, <span style="color:#e6db74">envvars</span>: {<span style="color:#e6db74">MYVAR</span>: <span style="color:#e6db74">'some_value'</span>} <span style="color:#75715e"># (Required) Runs a given application, with optional environment variables, when the user runs the command.</span>
|
797
|
+
<span style="color:#66d9ef">end</span>
|
798
|
+
</code></pre></div><p>Here, we supply a string to run the command. We can optioanlly provide environment variables which will be set for the external application.</p>
|
798
799
|
<h3 id="variable-path-mode">Variable Path Mode</h3>
|
799
|
-
|
800
800
|
<p>Variable Path mode works the same as Direct Path Mode, only instead of providing a string we provide a block that returns a string (which will be the command executed). This allows us to generate different commands based on the CLI parameters that the user passed, or pass configuration as CLI parameters to the external application:</p>
|
801
|
-
|
802
|
-
<
|
803
|
-
|
804
|
-
cmd =
|
805
|
-
cmd += ' --test-script foo --ignore-errors' if params[:force]
|
801
|
+
<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">Test</span> <span style="color:#f92672"><</span> <span style="color:#66d9ef">Rbcli</span><span style="color:#f92672">::</span><span style="color:#66d9ef">Command</span>
|
802
|
+
extern <span style="color:#e6db74">envvars</span>: {<span style="color:#e6db74">MY_OTHER_VAR</span>: <span style="color:#e6db74">'another_value'</span>} <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"># Alternate usage. Supplying a block instead of a path allows us to modify the command based on the arguments and configuration supplied by the user. This allows passing config settings as command line arguments to external applications. The block must return a string, which is the command to be executed.</span>
|
803
|
+
cmd <span style="color:#f92672">=</span> <span style="color:#e6db74">'/path/to/application'</span>
|
804
|
+
cmd <span style="color:#f92672">+=</span> <span style="color:#e6db74">' --test-script foo --ignore-errors'</span> <span style="color:#66d9ef">if</span> params<span style="color:#f92672">[</span><span style="color:#e6db74">:force</span><span style="color:#f92672">]</span>
|
806
805
|
cmd
|
807
|
-
end
|
808
|
-
end
|
809
|
-
</code></pre>
|
810
|
-
|
811
|
-
<p><strong>NOTE</strong>: Passing user-supplied data as part of the command string may be a security risk (example: <code>/path/to/application --name #{params[:name]}</code>). It is highly recommended to provide the fixed strings yourself, and only select which strings are used based on the variables provided. This is demonstrated in the example above.</p>
|
806
|
+
<span style="color:#66d9ef">end</span>
|
807
|
+
<span style="color:#66d9ef">end</span>
|
808
|
+
</code></pre></div><p><strong>NOTE</strong>: Passing user-supplied data as part of the command string may be a security risk (example: <code>/path/to/application --name #{params[:name]}</code>). It is highly recommended to provide the fixed strings yourself, and only select which strings are used based on the variables provided. This is demonstrated in the example above.</p>
|
812
809
|
|
813
810
|
|
814
|
-
<footer class="
|
811
|
+
<footer class="footline">
|
815
812
|
|
816
813
|
</footer>
|
817
814
|
|
818
|
-
|
819
815
|
|
820
816
|
</div>
|
821
817
|
|
@@ -1243,20 +1239,19 @@ end
|
|
1243
1239
|
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
1244
1240
|
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
1245
1241
|
</div>
|
1246
|
-
<script src="/rbcli/js/clipboard.min.js?
|
1247
|
-
<script src="/rbcli/js/perfect-scrollbar.min.js?
|
1248
|
-
<script src="/rbcli/js/perfect-scrollbar.jquery.min.js?
|
1249
|
-
<script src="/rbcli/js/jquery.sticky.js?
|
1250
|
-
<script src="/rbcli/js/featherlight.min.js?
|
1251
|
-
<script src="/rbcli/js/
|
1252
|
-
<script src="/rbcli/js/highlight.pack.js?1561087612"></script>
|
1242
|
+
<script src="/rbcli/js/clipboard.min.js?1596148729"></script>
|
1243
|
+
<script src="/rbcli/js/perfect-scrollbar.min.js?1596148729"></script>
|
1244
|
+
<script src="/rbcli/js/perfect-scrollbar.jquery.min.js?1596148729"></script>
|
1245
|
+
<script src="/rbcli/js/jquery.sticky.js?1596148729"></script>
|
1246
|
+
<script src="/rbcli/js/featherlight.min.js?1596148729"></script>
|
1247
|
+
<script src="/rbcli/js/highlight.pack.js?1596148729"></script>
|
1253
1248
|
<script>hljs.initHighlightingOnLoad();</script>
|
1254
|
-
<script src="/rbcli/js/modernizr.custom-3.6.0.js?
|
1255
|
-
<script src="/rbcli/js/learn.js?
|
1256
|
-
<script src="/rbcli/js/hugo-learn.js?
|
1249
|
+
<script src="/rbcli/js/modernizr.custom-3.6.0.js?1596148729"></script>
|
1250
|
+
<script src="/rbcli/js/learn.js?1596148729"></script>
|
1251
|
+
<script src="/rbcli/js/hugo-learn.js?1596148729"></script>
|
1257
1252
|
|
1258
|
-
<link href="/rbcli/mermaid/mermaid.css?
|
1259
|
-
<script src="/rbcli/mermaid/mermaid.js?
|
1253
|
+
<link href="/rbcli/mermaid/mermaid.css?1596148729" rel="stylesheet" />
|
1254
|
+
<script src="/rbcli/mermaid/mermaid.js?1596148729"></script>
|
1260
1255
|
<script>
|
1261
1256
|
mermaid.initialize({ startOnLoad: true });
|
1262
1257
|
</script>
|