rbcli 0.1.10 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/CODE_OF_CONDUCT.md +1 -1
  4. data/Gemfile.lock +12 -12
  5. data/LICENSE.txt +674 -21
  6. data/README.md +80 -443
  7. data/bin/console +19 -0
  8. data/bin/setup +20 -0
  9. data/docs/404.html +639 -0
  10. data/docs/advanced/automatic_updates/index.html +791 -0
  11. data/docs/advanced/command_types/index.html +946 -0
  12. data/docs/advanced/distributed_state_locking/index.html +777 -0
  13. data/docs/advanced/hooks/index.html +836 -0
  14. data/docs/advanced/state_storage/index.html +957 -0
  15. data/docs/advanced/user_config_files/index.html +818 -0
  16. data/docs/assets/fonts/font-awesome.css +4 -0
  17. data/docs/assets/fonts/material-icons.css +13 -0
  18. data/docs/assets/fonts/specimen/FontAwesome.ttf +0 -0
  19. data/docs/assets/fonts/specimen/FontAwesome.woff +0 -0
  20. data/docs/assets/fonts/specimen/FontAwesome.woff2 +0 -0
  21. data/docs/assets/fonts/specimen/MaterialIcons-Regular.ttf +0 -0
  22. data/docs/assets/fonts/specimen/MaterialIcons-Regular.woff +0 -0
  23. data/docs/assets/fonts/specimen/MaterialIcons-Regular.woff2 +0 -0
  24. data/docs/assets/images/favicon.png +0 -0
  25. data/docs/assets/images/icons/bitbucket.1b09e088.svg +20 -0
  26. data/docs/assets/images/icons/github.f0b8504a.svg +18 -0
  27. data/docs/assets/images/icons/gitlab.6dd19c00.svg +38 -0
  28. data/docs/assets/javascripts/application.a59e2a89.js +1 -0
  29. data/docs/assets/javascripts/lunr/lunr.da.js +1 -0
  30. data/docs/assets/javascripts/lunr/lunr.de.js +1 -0
  31. data/docs/assets/javascripts/lunr/lunr.du.js +1 -0
  32. data/docs/assets/javascripts/lunr/lunr.es.js +1 -0
  33. data/docs/assets/javascripts/lunr/lunr.fi.js +1 -0
  34. data/docs/assets/javascripts/lunr/lunr.fr.js +1 -0
  35. data/docs/assets/javascripts/lunr/lunr.hu.js +1 -0
  36. data/docs/assets/javascripts/lunr/lunr.it.js +1 -0
  37. data/docs/assets/javascripts/lunr/lunr.jp.js +1 -0
  38. data/docs/assets/javascripts/lunr/lunr.multi.js +1 -0
  39. data/docs/assets/javascripts/lunr/lunr.no.js +1 -0
  40. data/docs/assets/javascripts/lunr/lunr.pt.js +1 -0
  41. data/docs/assets/javascripts/lunr/lunr.ro.js +1 -0
  42. data/docs/assets/javascripts/lunr/lunr.ru.js +1 -0
  43. data/docs/assets/javascripts/lunr/lunr.stemmer.support.js +1 -0
  44. data/docs/assets/javascripts/lunr/lunr.sv.js +1 -0
  45. data/docs/assets/javascripts/lunr/lunr.tr.js +1 -0
  46. data/docs/assets/javascripts/lunr/tinyseg.js +1 -0
  47. data/docs/assets/javascripts/modernizr.1aa3b519.js +1 -0
  48. data/docs/assets/stylesheets/application-palette.6079476c.css +2 -0
  49. data/docs/assets/stylesheets/application.ba0fd1a6.css +2 -0
  50. data/docs/development/code_of_conduct/index.html +883 -0
  51. data/docs/development/contributing/index.html +744 -0
  52. data/docs/development/license/index.html +715 -0
  53. data/docs/imported/changelog/index.html +853 -0
  54. data/docs/imported/quick_reference/index.html +1057 -0
  55. data/docs/index.html +732 -0
  56. data/docs/search/search_index.json +569 -0
  57. data/docs/sitemap.xml +93 -0
  58. data/docs/tutorial/10-getting_started/index.html +806 -0
  59. data/docs/tutorial/20-project_layout/index.html +972 -0
  60. data/docs/tutorial/30-your_first_command/index.html +906 -0
  61. data/docs/tutorial/40-options_parameters_and_arguments/index.html +1049 -0
  62. data/docs/tutorial/50-publishing/index.html +838 -0
  63. data/docs/whoami/index.html +709 -0
  64. data/docs-src/docs/advanced/automatic_updates.md +42 -0
  65. data/docs-src/docs/advanced/command_types.md +144 -0
  66. data/docs-src/docs/advanced/distributed_state_locking.md +33 -0
  67. data/docs-src/docs/advanced/hooks.md +65 -0
  68. data/docs-src/docs/advanced/logging.md +35 -0
  69. data/docs-src/docs/advanced/state_storage.md +117 -0
  70. data/docs-src/docs/advanced/user_config_files.md +47 -0
  71. data/docs-src/docs/development/code_of_conduct.md +74 -0
  72. data/docs-src/docs/development/contributing.md +49 -0
  73. data/docs-src/docs/development/license.md +10 -0
  74. data/docs-src/docs/imported/changelog.md +31 -0
  75. data/docs-src/docs/imported/quick_reference.md +150 -0
  76. data/docs-src/docs/index.md +38 -0
  77. data/docs-src/docs/tutorial/10-getting_started.md +41 -0
  78. data/docs-src/docs/tutorial/20-project_layout.md +115 -0
  79. data/docs-src/docs/tutorial/30-your_first_command.md +126 -0
  80. data/docs-src/docs/tutorial/40-options_parameters_and_arguments.md +251 -0
  81. data/docs-src/docs/tutorial/50-publishing.md +47 -0
  82. data/docs-src/docs/whoami.md +28 -0
  83. data/docs-src/makesite.sh +14 -0
  84. data/docs-src/mkdocs.yml +76 -0
  85. data/docs-src/runsite.sh +3 -0
  86. data/exe/rbcli +76 -5
  87. data/lib/rbcli/autoupdate/autoupdate.rb +24 -4
  88. data/lib/rbcli/autoupdate/gem_updater.rb +23 -2
  89. data/lib/rbcli/autoupdate/github_updater.rb +22 -1
  90. data/lib/rbcli/configuration/config.rb +22 -1
  91. data/lib/rbcli/configuration/configurate.rb +24 -2
  92. data/lib/rbcli/engine/command.rb +26 -6
  93. data/lib/rbcli/engine/load_project.rb +29 -3
  94. data/lib/rbcli/engine/parser.rb +25 -4
  95. data/lib/rbcli/logging/logging.rb +21 -0
  96. data/lib/rbcli/scriptwrapping/scriptwrapper.rb +30 -11
  97. data/lib/rbcli/stateful_systems/configuratestorage.rb +20 -0
  98. data/lib/rbcli/stateful_systems/state_storage.rb +20 -0
  99. data/lib/rbcli/stateful_systems/storagetypes/localstate.rb +20 -0
  100. data/lib/rbcli/stateful_systems/storagetypes/remote_state_connectors/dynamodb.rb +20 -0
  101. data/lib/rbcli/stateful_systems/storagetypes/remotestate_dynamodb.rb +20 -0
  102. data/lib/rbcli/util/hash_deep_symbolize.rb +43 -22
  103. data/lib/rbcli/util/string_colorize.rb +20 -0
  104. data/lib/rbcli/version.rb +21 -1
  105. data/lib/rbcli-tool/generators.rb +20 -0
  106. data/lib/rbcli-tool/mdless_fix.rb +20 -0
  107. data/lib/rbcli-tool/project.rb +27 -2
  108. data/lib/rbcli-tool/util.rb +20 -0
  109. data/lib/rbcli-tool.rb +20 -0
  110. data/lib/rbcli.rb +20 -0
  111. data/lib-sh/lib-rbcli.sh +19 -0
  112. data/rbcli.gemspec +22 -3
  113. data/skeletons/project/CODE_OF_CONDUCT.md +1 -1
  114. data/skeletons/project/README.md +17 -2
  115. data/skeletons/project/application/commands/command.erb +10 -8
  116. data/skeletons/project/application/commands/script.erb +3 -1
  117. data/skeletons/project/application/commands/scripts/script.sh +2 -2
  118. data/skeletons/project/application/options.rb +12 -3
  119. data/skeletons/project/config/autoupdate.rb +5 -2
  120. data/skeletons/project/config/storage.rb +7 -6
  121. data/skeletons/project/config/userspace.rb +6 -1
  122. data/skeletons/project/exe/executable +1 -1
  123. data/skeletons/project/lib/.keep +0 -0
  124. data/skeletons/project/untitled.gemspec +4 -4
  125. data/skeletons/project/{default_user_configs → userconf}/user_defaults.yml +0 -0
  126. metadata +85 -9
  127. data/examples/defaults.yml +0 -4
  128. data/examples/myscript.sh +0 -23
  129. data/examples/mytool +0 -95
@@ -0,0 +1,1057 @@
1
+
2
+
3
+
4
+
5
+ <!DOCTYPE html>
6
+ <html lang="en" class="no-js">
7
+ <head>
8
+
9
+ <meta charset="utf-8">
10
+ <meta name="viewport" content="width=device-width,initial-scale=1">
11
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
12
+
13
+ <meta name="description" content="Description">
14
+
15
+
16
+
17
+ <meta name="author" content="Andrew Khoury">
18
+
19
+
20
+ <meta name="lang:clipboard.copy" content="Copy to clipboard">
21
+
22
+ <meta name="lang:clipboard.copied" content="Copied to clipboard">
23
+
24
+ <meta name="lang:search.language" content="en">
25
+
26
+ <meta name="lang:search.pipeline.stopwords" content="True">
27
+
28
+ <meta name="lang:search.pipeline.trimmer" content="True">
29
+
30
+ <meta name="lang:search.result.none" content="No matching documents">
31
+
32
+ <meta name="lang:search.result.one" content="1 matching document">
33
+
34
+ <meta name="lang:search.result.other" content="# matching documents">
35
+
36
+ <meta name="lang:search.tokenizer" content="[\s\-]+">
37
+
38
+ <link rel="shortcut icon" href="../../assets/images/favicon.png">
39
+ <meta name="generator" content="mkdocs-0.17.5, mkdocs-material-2.9.2">
40
+
41
+
42
+
43
+ <title>Quick Reference - RBCli Documentation</title>
44
+
45
+
46
+
47
+ <link rel="stylesheet" href="../../assets/stylesheets/application.ba0fd1a6.css">
48
+
49
+
50
+
51
+
52
+ <script src="../../assets/javascripts/modernizr.1aa3b519.js"></script>
53
+
54
+
55
+ <link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
56
+
57
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
58
+ <style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
59
+
60
+
61
+ <link rel="stylesheet" href="../../assets/fonts/material-icons.css">
62
+
63
+
64
+ </head>
65
+
66
+ <body dir="ltr">
67
+
68
+ <svg class="md-svg">
69
+ <defs>
70
+
71
+
72
+ <svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
73
+ viewBox="0 0 416 448" id="__github">
74
+ <path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
75
+ 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
76
+ 18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
77
+ 19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
78
+ 18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
79
+ 304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
80
+ 2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
81
+ 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
82
+ 37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
83
+ 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
84
+ 1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
85
+ 0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
86
+ 30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
87
+ 46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
88
+ 99.5z" />
89
+ </svg>
90
+
91
+ </defs>
92
+ </svg>
93
+ <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
94
+ <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
95
+ <label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
96
+
97
+ <a href="#quick-reference" tabindex="1" class="md-skip">
98
+ Skip to content
99
+ </a>
100
+
101
+
102
+ <header class="md-header" data-md-component="header">
103
+ <nav class="md-header-nav md-grid">
104
+ <div class="md-flex">
105
+ <div class="md-flex__cell md-flex__cell--shrink">
106
+ <a href="../.." title="RBCli Documentation" class="md-header-nav__button md-logo">
107
+
108
+ <i class="md-icon">devices</i>
109
+
110
+ </a>
111
+ </div>
112
+ <div class="md-flex__cell md-flex__cell--shrink">
113
+ <label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
114
+ </div>
115
+ <div class="md-flex__cell md-flex__cell--stretch">
116
+ <div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
117
+
118
+
119
+ <span class="md-header-nav__topic">
120
+ RBCli Documentation
121
+ </span>
122
+ <span class="md-header-nav__topic">
123
+ Quick Reference
124
+ </span>
125
+
126
+
127
+ </div>
128
+ </div>
129
+ <div class="md-flex__cell md-flex__cell--shrink">
130
+
131
+
132
+ <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
133
+
134
+ <div class="md-search" data-md-component="search" role="dialog">
135
+ <label class="md-search__overlay" for="__search"></label>
136
+ <div class="md-search__inner" role="search">
137
+ <form class="md-search__form" name="search">
138
+ <input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
139
+ <label class="md-icon md-search__icon" for="__search"></label>
140
+ <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
141
+ &#xE5CD;
142
+ </button>
143
+ </form>
144
+ <div class="md-search__output">
145
+ <div class="md-search__scrollwrap" data-md-scrollfix>
146
+ <div class="md-search-result" data-md-component="result">
147
+ <div class="md-search-result__meta">
148
+ Type to start searching
149
+ </div>
150
+ <ol class="md-search-result__list"></ol>
151
+ </div>
152
+ </div>
153
+ </div>
154
+ </div>
155
+ </div>
156
+
157
+
158
+ </div>
159
+
160
+ <div class="md-flex__cell md-flex__cell--shrink">
161
+ <div class="md-header-nav__source">
162
+
163
+
164
+
165
+
166
+
167
+
168
+ <a href="https://github.com/akhoury6/rbcli/" title="Go to repository" class="md-source" data-md-source="github">
169
+
170
+ <div class="md-source__icon">
171
+ <svg viewBox="0 0 24 24" width="24" height="24">
172
+ <use xlink:href="#__github" width="24" height="24"></use>
173
+ </svg>
174
+ </div>
175
+
176
+ <div class="md-source__repository">
177
+ GitHub
178
+ </div>
179
+ </a>
180
+
181
+ </div>
182
+ </div>
183
+
184
+ </div>
185
+ </nav>
186
+ </header>
187
+
188
+ <div class="md-container">
189
+
190
+
191
+
192
+
193
+
194
+
195
+ <nav class="md-tabs" data-md-component="tabs">
196
+ <div class="md-tabs__inner md-grid">
197
+ <ul class="md-tabs__list">
198
+
199
+
200
+ <li class="md-tabs__item">
201
+
202
+ <a href="../.." title="Home" class="md-tabs__link md-tabs__link--active">
203
+ Home
204
+ </a>
205
+
206
+ </li>
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+ <li class="md-tabs__item">
215
+
216
+ <a href="../../tutorial/10-getting_started/" title="Tutorial" class="md-tabs__link">
217
+ Tutorial
218
+ </a>
219
+
220
+ </li>
221
+
222
+
223
+
224
+
225
+
226
+
227
+ <li class="md-tabs__item">
228
+
229
+ <a href="../../advanced/command_types/" title="Advanced Features" class="md-tabs__link">
230
+ Advanced Features
231
+ </a>
232
+
233
+ </li>
234
+
235
+
236
+
237
+
238
+
239
+
240
+ <li class="md-tabs__item">
241
+
242
+ <a href="../../development/contributing/" title="Development" class="md-tabs__link">
243
+ Development
244
+ </a>
245
+
246
+ </li>
247
+
248
+
249
+
250
+
251
+
252
+ </ul>
253
+ </div>
254
+ </nav>
255
+
256
+ <main class="md-main">
257
+ <div class="md-main__inner md-grid" data-md-component="container">
258
+
259
+
260
+ <div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
261
+ <div class="md-sidebar__scrollwrap">
262
+ <div class="md-sidebar__inner">
263
+ <nav class="md-nav md-nav--primary" data-md-level="0">
264
+ <label class="md-nav__title md-nav__title--site" for="__drawer">
265
+ <span class="md-nav__button md-logo">
266
+
267
+ <i class="md-icon">devices</i>
268
+
269
+ </span>
270
+ RBCli Documentation
271
+ </label>
272
+
273
+ <div class="md-nav__source">
274
+
275
+
276
+
277
+
278
+
279
+
280
+ <a href="https://github.com/akhoury6/rbcli/" title="Go to repository" class="md-source" data-md-source="github">
281
+
282
+ <div class="md-source__icon">
283
+ <svg viewBox="0 0 24 24" width="24" height="24">
284
+ <use xlink:href="#__github" width="24" height="24"></use>
285
+ </svg>
286
+ </div>
287
+
288
+ <div class="md-source__repository">
289
+ GitHub
290
+ </div>
291
+ </a>
292
+
293
+ </div>
294
+
295
+ <ul class="md-nav__list" data-md-scrollfix>
296
+
297
+
298
+
299
+
300
+
301
+
302
+ <li class="md-nav__item">
303
+ <a href="../.." title="Home" class="md-nav__link">
304
+ Home
305
+ </a>
306
+ </li>
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+ <li class="md-nav__item md-nav__item--active">
317
+
318
+ <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
319
+
320
+
321
+
322
+
323
+ <label class="md-nav__link md-nav__link--active" for="__toc">
324
+ Quick Reference
325
+ </label>
326
+
327
+ <a href="./" title="Quick Reference" class="md-nav__link md-nav__link--active">
328
+ Quick Reference
329
+ </a>
330
+
331
+
332
+ <nav class="md-nav md-nav--secondary">
333
+
334
+
335
+
336
+
337
+
338
+ <label class="md-nav__title" for="__toc">Table of contents</label>
339
+ <ul class="md-nav__list" data-md-scrollfix>
340
+
341
+ <li class="md-nav__item">
342
+ <a href="#installation" title="Installation" class="md-nav__link">
343
+ Installation
344
+ </a>
345
+
346
+ </li>
347
+
348
+ <li class="md-nav__item">
349
+ <a href="#creating-a-command" title="Creating a command" class="md-nav__link">
350
+ Creating a command
351
+ </a>
352
+
353
+ <nav class="md-nav">
354
+ <ul class="md-nav__list">
355
+
356
+ <li class="md-nav__item">
357
+ <a href="#standard-commands" title="Standard Commands" class="md-nav__link">
358
+ Standard Commands
359
+ </a>
360
+
361
+ </li>
362
+
363
+ <li class="md-nav__item">
364
+ <a href="#scripted-commands" title="Scripted Commands" class="md-nav__link">
365
+ Scripted Commands
366
+ </a>
367
+
368
+ </li>
369
+
370
+ <li class="md-nav__item">
371
+ <a href="#external-commands" title="External Commands" class="md-nav__link">
372
+ External Commands
373
+ </a>
374
+
375
+ </li>
376
+
377
+ </ul>
378
+ </nav>
379
+
380
+ </li>
381
+
382
+ <li class="md-nav__item">
383
+ <a href="#hooks" title="Hooks" class="md-nav__link">
384
+ Hooks
385
+ </a>
386
+
387
+ </li>
388
+
389
+ <li class="md-nav__item">
390
+ <a href="#storage" title="Storage" class="md-nav__link">
391
+ Storage
392
+ </a>
393
+
394
+ <nav class="md-nav">
395
+ <ul class="md-nav__list">
396
+
397
+ <li class="md-nav__item">
398
+ <a href="#local-state" title="Local State" class="md-nav__link">
399
+ Local State
400
+ </a>
401
+
402
+ </li>
403
+
404
+ <li class="md-nav__item">
405
+ <a href="#remote-state" title="Remote State" class="md-nav__link">
406
+ Remote State
407
+ </a>
408
+
409
+ </li>
410
+
411
+ </ul>
412
+ </nav>
413
+
414
+ </li>
415
+
416
+ <li class="md-nav__item">
417
+ <a href="#userspace-configuration-files" title="Userspace Configuration Files" class="md-nav__link">
418
+ Userspace Configuration Files
419
+ </a>
420
+
421
+ </li>
422
+
423
+ <li class="md-nav__item">
424
+ <a href="#logging" title="Logging" class="md-nav__link">
425
+ Logging
426
+ </a>
427
+
428
+ </li>
429
+
430
+ <li class="md-nav__item">
431
+ <a href="#automatic-update-check" title="Automatic Update Check" class="md-nav__link">
432
+ Automatic Update Check
433
+ </a>
434
+
435
+ </li>
436
+
437
+ <li class="md-nav__item">
438
+ <a href="#development-and-contributing" title="Development and Contributing" class="md-nav__link">
439
+ Development and Contributing
440
+ </a>
441
+
442
+ </li>
443
+
444
+ <li class="md-nav__item">
445
+ <a href="#license" title="License" class="md-nav__link">
446
+ License
447
+ </a>
448
+
449
+ </li>
450
+
451
+ <li class="md-nav__item">
452
+ <a href="#full-documentation" title="Full Documentation" class="md-nav__link">
453
+ Full Documentation
454
+ </a>
455
+
456
+ </li>
457
+
458
+
459
+
460
+
461
+
462
+ </ul>
463
+
464
+ </nav>
465
+
466
+ </li>
467
+
468
+
469
+
470
+
471
+
472
+
473
+
474
+ <li class="md-nav__item md-nav__item--nested">
475
+
476
+ <input class="md-toggle md-nav__toggle" data-md-toggle="nav-3" type="checkbox" id="nav-3">
477
+
478
+ <label class="md-nav__link" for="nav-3">
479
+ Tutorial
480
+ </label>
481
+ <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
482
+ <label class="md-nav__title" for="nav-3">
483
+ Tutorial
484
+ </label>
485
+ <ul class="md-nav__list" data-md-scrollfix>
486
+
487
+
488
+
489
+
490
+
491
+
492
+
493
+ <li class="md-nav__item">
494
+ <a href="../../tutorial/10-getting_started/" title="Getting Started" class="md-nav__link">
495
+ Getting Started
496
+ </a>
497
+ </li>
498
+
499
+
500
+
501
+
502
+
503
+
504
+
505
+ <li class="md-nav__item">
506
+ <a href="../../tutorial/20-project_layout/" title="The Project Layout" class="md-nav__link">
507
+ The Project Layout
508
+ </a>
509
+ </li>
510
+
511
+
512
+
513
+
514
+
515
+
516
+
517
+ <li class="md-nav__item">
518
+ <a href="../../tutorial/30-your_first_command/" title="Your First Command" class="md-nav__link">
519
+ Your First Command
520
+ </a>
521
+ </li>
522
+
523
+
524
+
525
+
526
+
527
+
528
+
529
+ <li class="md-nav__item">
530
+ <a href="../../tutorial/40-options_parameters_and_arguments/" title="Options, Parameters, and Arguments" class="md-nav__link">
531
+ Options, Parameters, and Arguments
532
+ </a>
533
+ </li>
534
+
535
+
536
+
537
+
538
+
539
+
540
+
541
+ <li class="md-nav__item">
542
+ <a href="../../tutorial/50-publishing/" title="Publishing and Distribution" class="md-nav__link">
543
+ Publishing and Distribution
544
+ </a>
545
+ </li>
546
+
547
+
548
+ </ul>
549
+ </nav>
550
+ </li>
551
+
552
+
553
+
554
+
555
+
556
+
557
+
558
+ <li class="md-nav__item md-nav__item--nested">
559
+
560
+ <input class="md-toggle md-nav__toggle" data-md-toggle="nav-4" type="checkbox" id="nav-4">
561
+
562
+ <label class="md-nav__link" for="nav-4">
563
+ Advanced Features
564
+ </label>
565
+ <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
566
+ <label class="md-nav__title" for="nav-4">
567
+ Advanced Features
568
+ </label>
569
+ <ul class="md-nav__list" data-md-scrollfix>
570
+
571
+
572
+
573
+
574
+
575
+
576
+
577
+ <li class="md-nav__item">
578
+ <a href="../../advanced/command_types/" title="Command Types" class="md-nav__link">
579
+ Command Types
580
+ </a>
581
+ </li>
582
+
583
+
584
+
585
+
586
+
587
+
588
+
589
+ <li class="md-nav__item">
590
+ <a href="../../advanced/user_config_files/" title="User Config Files" class="md-nav__link">
591
+ User Config Files
592
+ </a>
593
+ </li>
594
+
595
+
596
+
597
+
598
+
599
+
600
+
601
+ <li class="md-nav__item">
602
+ <a href="../../advanced/hooks/" title="Hooks" class="md-nav__link">
603
+ Hooks
604
+ </a>
605
+ </li>
606
+
607
+
608
+
609
+
610
+
611
+
612
+
613
+ <li class="md-nav__item">
614
+ <a href="../../advanced/automatic_updates/" title="Automatic Updates" class="md-nav__link">
615
+ Automatic Updates
616
+ </a>
617
+ </li>
618
+
619
+
620
+
621
+
622
+
623
+
624
+
625
+ <li class="md-nav__item">
626
+ <a href="../../advanced/state_storage/" title="State Storage" class="md-nav__link">
627
+ State Storage
628
+ </a>
629
+ </li>
630
+
631
+
632
+
633
+
634
+
635
+
636
+
637
+ <li class="md-nav__item">
638
+ <a href="../../advanced/distributed_state_locking/" title="Distributed State Locking" class="md-nav__link">
639
+ Distributed State Locking
640
+ </a>
641
+ </li>
642
+
643
+
644
+ </ul>
645
+ </nav>
646
+ </li>
647
+
648
+
649
+
650
+
651
+
652
+
653
+
654
+ <li class="md-nav__item md-nav__item--nested">
655
+
656
+ <input class="md-toggle md-nav__toggle" data-md-toggle="nav-5" type="checkbox" id="nav-5">
657
+
658
+ <label class="md-nav__link" for="nav-5">
659
+ Development
660
+ </label>
661
+ <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
662
+ <label class="md-nav__title" for="nav-5">
663
+ Development
664
+ </label>
665
+ <ul class="md-nav__list" data-md-scrollfix>
666
+
667
+
668
+
669
+
670
+
671
+
672
+
673
+ <li class="md-nav__item">
674
+ <a href="../../development/contributing/" title="Contribution Guide" class="md-nav__link">
675
+ Contribution Guide
676
+ </a>
677
+ </li>
678
+
679
+
680
+
681
+
682
+
683
+
684
+
685
+ <li class="md-nav__item">
686
+ <a href="../../development/license/" title="License Info" class="md-nav__link">
687
+ License Info
688
+ </a>
689
+ </li>
690
+
691
+
692
+
693
+
694
+
695
+
696
+
697
+ <li class="md-nav__item">
698
+ <a href="../../development/code_of_conduct/" title="Code of Conduct" class="md-nav__link">
699
+ Code of Conduct
700
+ </a>
701
+ </li>
702
+
703
+
704
+
705
+
706
+
707
+
708
+
709
+ <li class="md-nav__item">
710
+ <a href="../changelog/" title="Changelog" class="md-nav__link">
711
+ Changelog
712
+ </a>
713
+ </li>
714
+
715
+
716
+ </ul>
717
+ </nav>
718
+ </li>
719
+
720
+
721
+
722
+
723
+
724
+
725
+
726
+ <li class="md-nav__item">
727
+ <a href="../../whoami/" title="$ whoami" class="md-nav__link">
728
+ $ whoami
729
+ </a>
730
+ </li>
731
+
732
+
733
+ </ul>
734
+ </nav>
735
+ </div>
736
+ </div>
737
+ </div>
738
+
739
+
740
+ <div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
741
+ <div class="md-sidebar__scrollwrap">
742
+ <div class="md-sidebar__inner">
743
+
744
+ <nav class="md-nav md-nav--secondary">
745
+
746
+
747
+
748
+
749
+
750
+ <label class="md-nav__title" for="__toc">Table of contents</label>
751
+ <ul class="md-nav__list" data-md-scrollfix>
752
+
753
+ <li class="md-nav__item">
754
+ <a href="#installation" title="Installation" class="md-nav__link">
755
+ Installation
756
+ </a>
757
+
758
+ </li>
759
+
760
+ <li class="md-nav__item">
761
+ <a href="#creating-a-command" title="Creating a command" class="md-nav__link">
762
+ Creating a command
763
+ </a>
764
+
765
+ <nav class="md-nav">
766
+ <ul class="md-nav__list">
767
+
768
+ <li class="md-nav__item">
769
+ <a href="#standard-commands" title="Standard Commands" class="md-nav__link">
770
+ Standard Commands
771
+ </a>
772
+
773
+ </li>
774
+
775
+ <li class="md-nav__item">
776
+ <a href="#scripted-commands" title="Scripted Commands" class="md-nav__link">
777
+ Scripted Commands
778
+ </a>
779
+
780
+ </li>
781
+
782
+ <li class="md-nav__item">
783
+ <a href="#external-commands" title="External Commands" class="md-nav__link">
784
+ External Commands
785
+ </a>
786
+
787
+ </li>
788
+
789
+ </ul>
790
+ </nav>
791
+
792
+ </li>
793
+
794
+ <li class="md-nav__item">
795
+ <a href="#hooks" title="Hooks" class="md-nav__link">
796
+ Hooks
797
+ </a>
798
+
799
+ </li>
800
+
801
+ <li class="md-nav__item">
802
+ <a href="#storage" title="Storage" class="md-nav__link">
803
+ Storage
804
+ </a>
805
+
806
+ <nav class="md-nav">
807
+ <ul class="md-nav__list">
808
+
809
+ <li class="md-nav__item">
810
+ <a href="#local-state" title="Local State" class="md-nav__link">
811
+ Local State
812
+ </a>
813
+
814
+ </li>
815
+
816
+ <li class="md-nav__item">
817
+ <a href="#remote-state" title="Remote State" class="md-nav__link">
818
+ Remote State
819
+ </a>
820
+
821
+ </li>
822
+
823
+ </ul>
824
+ </nav>
825
+
826
+ </li>
827
+
828
+ <li class="md-nav__item">
829
+ <a href="#userspace-configuration-files" title="Userspace Configuration Files" class="md-nav__link">
830
+ Userspace Configuration Files
831
+ </a>
832
+
833
+ </li>
834
+
835
+ <li class="md-nav__item">
836
+ <a href="#logging" title="Logging" class="md-nav__link">
837
+ Logging
838
+ </a>
839
+
840
+ </li>
841
+
842
+ <li class="md-nav__item">
843
+ <a href="#automatic-update-check" title="Automatic Update Check" class="md-nav__link">
844
+ Automatic Update Check
845
+ </a>
846
+
847
+ </li>
848
+
849
+ <li class="md-nav__item">
850
+ <a href="#development-and-contributing" title="Development and Contributing" class="md-nav__link">
851
+ Development and Contributing
852
+ </a>
853
+
854
+ </li>
855
+
856
+ <li class="md-nav__item">
857
+ <a href="#license" title="License" class="md-nav__link">
858
+ License
859
+ </a>
860
+
861
+ </li>
862
+
863
+ <li class="md-nav__item">
864
+ <a href="#full-documentation" title="Full Documentation" class="md-nav__link">
865
+ Full Documentation
866
+ </a>
867
+
868
+ </li>
869
+
870
+
871
+
872
+
873
+
874
+ </ul>
875
+
876
+ </nav>
877
+ </div>
878
+ </div>
879
+ </div>
880
+
881
+
882
+ <div class="md-content">
883
+ <article class="md-content__inner md-typeset">
884
+
885
+
886
+
887
+ <h1 id="quick-reference">Quick Reference</h1>
888
+ <h2 id="installation">Installation</h2>
889
+ <p>RBCli is available on rubygems.org. You can add it to your application's <code>Gemfile</code> or <code>gemspec</code>, or install it manually by running:</p>
890
+ <pre><code class="bash">gem install rbcli
891
+ </code></pre>
892
+
893
+ <p>Then, <code>cd</code> to the folder you'd like to create your project under and run:</p>
894
+ <pre><code class="bash">rbcli init -n mytool -d &quot;A simple CLI tool&quot;
895
+ </code></pre>
896
+
897
+ <p>Or, for a single-file tool without any folder/gem tructure, run <code>rbcli init -t mini -n &lt;projectname&gt;</code> or <code>rbcli init -t micro -n &lt;projectname&gt;</code>.</p>
898
+ <h2 id="creating-a-command">Creating a command</h2>
899
+ <p>There are three types of commands: standard, scripted, and external.</p>
900
+ <ul>
901
+ <li><strong>Standard</strong> commands let you code the command directly in Ruby</li>
902
+ <li><strong>Scripted</strong> commands provide you with a bash script, where all of the parsed information (params, options, args, and config) is shared</li>
903
+ <li><strong>External</strong> commands let you wrap 3rd party applications directly</li>
904
+ </ul>
905
+ <h3 id="standard-commands">Standard Commands</h3>
906
+ <p>To create a new command called <code>foo</code>, run:</p>
907
+ <pre><code class="bash">rbcli command -n foo
908
+ </code></pre>
909
+
910
+ <p>You will now find the command code in <code>application/commands/list.rb</code>. Edit the <code>action</code> block to write your coode.</p>
911
+ <h3 id="scripted-commands">Scripted Commands</h3>
912
+ <p>To create a new scripted command called <code>bar</code>, run:</p>
913
+ <pre><code class="bash">rbcli script -n bar
914
+ </code></pre>
915
+
916
+ <p>You will then find two new files:</p>
917
+ <ul>
918
+ <li>The command declaration under <code>application/commands/bar.rb</code></li>
919
+ <li>The script code under <code>application/commands/scripts/bar.sh</code></li>
920
+ </ul>
921
+ <p>Edit the script to write your code.</p>
922
+ <h3 id="external-commands">External Commands</h3>
923
+ <p>To create a new external command called <code>baz</code>, run:</p>
924
+ <pre><code class="bash">rbcli extern -n baz
925
+ </code></pre>
926
+
927
+ <p>You will then find the command code in <code>application/commands/baz.rb</code>.</p>
928
+ <p>Use one of the two provided modes -- direct path mode or variable path mode -- to provide the path to the external program.</p>
929
+ <h2 id="hooks">Hooks</h2>
930
+ <p>RBCli has several hooks that run at different points in the exectution chain. They can be created via the <code>rbcli</code> command line tool:</p>
931
+ <pre><code class="bash">rbcli hook --default # Runs when no command is provided
932
+ rbcli hook --pre # Runs before any command
933
+ rbcli hook --post # Runs after any command
934
+ rbcli hook --firstrun # Runs the first time a user runs your application. Requires userspace config.
935
+ rbcli hook -dpof # Create all hooks at once
936
+ </code></pre>
937
+
938
+ <h2 id="storage">Storage</h2>
939
+ <p>RBCli supports both local and remote state storage. This is done by synchronizing a Hash with either the local disk or a remote database.</p>
940
+ <h3 id="local-state">Local State</h3>
941
+ <p>RBCli can provide you with a unique hash that can be persisted to disk on any change to a top-level value.</p>
942
+ <p>Enable local state in <code>config/storage.rb</code>.</p>
943
+ <p>Then access it in your Standard Commands with <code>Rbcli.local_state[:yourkeyhere]</code>.</p>
944
+ <h3 id="remote-state">Remote State</h3>
945
+ <p>Similar to the Local State above, RBCli can provide you with a unique hash that can be persisted to a remote storage location.</p>
946
+ <p>Currently only AWS DynamoDB is supported, and credentials will be required for each user.</p>
947
+ <p>Enable remote state in <code>config/storage.rb</code>.</p>
948
+ <p>Then access it in your Standard Commands with <code>Rbcli.remote_state[:yourkeyhere]</code>.</p>
949
+ <h2 id="userspace-configuration-files">Userspace Configuration Files</h2>
950
+ <p>RBCli provides an easy mechanism to generate and read configuration files from your users. You set the default values and help text with the <strong>defaults chain</strong>, and leverage the <strong>user chain</strong> to read them.</p>
951
+ <p>You can set defaults either by placing a YAML file in the <code>userconf/</code> folder or by specifying individual options in <code>application/options.rb</code> (global) or <code>application/command/*.rb</code> (command-specific).</p>
952
+ <p>Users can generate a config file, complete with help text, by running your tool with the <code>--generate-config</code> option.</p>
953
+ <h2 id="logging">Logging</h2>
954
+ <p>RBCli's logger is configured in <code>config/logging.rb</code>.</p>
955
+ <pre><code class="ruby">log_level :info
956
+ log_target 'stderr'
957
+ </code></pre>
958
+
959
+ <p>Then it can be accessed when writing your commands via:</p>
960
+ <pre><code class="ruby">Rbcli::log.info { 'These logs can go to STDERR, STDOUT, or a file' }
961
+ </code></pre>
962
+
963
+ <p>The user will also be able to change the log level and target via their config file, if it is enabled.</p>
964
+ <h2 id="automatic-update-check">Automatic Update Check</h2>
965
+ <p>RBCli can automatically notify users when an update is available. Two sources are currently supported: Github (including Enterprise) and RubyGems.</p>
966
+ <p>You can configure automatic updates in <code>config/autoupdate.rb</code> in your project.</p>
967
+ <h2 id="development-and-contributing">Development and Contributing</h2>
968
+ <p>For more information about development and contributing, please see the <a href="https://akhoury6.github.com/rbcli/development/contributing/">Official Development Documentation</a></p>
969
+ <h2 id="license">License</h2>
970
+ <p>The gem is available as open source under the terms of the <a href="https://github.com/akhoury6/rbcli/blob/master/CODE_OF_CONDUCT.md">GPLv3</a>.</p>
971
+ <h2 id="full-documentation">Full Documentation</h2>
972
+ <p><a href="https://akhoury6.github.com/rbcli">You can find the Official Documentation for RBCli Here.</a></p>
973
+
974
+
975
+
976
+
977
+
978
+
979
+
980
+
981
+
982
+ </article>
983
+ </div>
984
+ </div>
985
+ </main>
986
+
987
+
988
+ <footer class="md-footer">
989
+
990
+ <div class="md-footer-nav">
991
+ <nav class="md-footer-nav__inner md-grid">
992
+
993
+ <a href="../.." title="Home" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
994
+ <div class="md-flex__cell md-flex__cell--shrink">
995
+ <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
996
+ </div>
997
+ <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
998
+ <span class="md-flex__ellipsis">
999
+ <span class="md-footer-nav__direction">
1000
+ Previous
1001
+ </span>
1002
+ Home
1003
+ </span>
1004
+ </div>
1005
+ </a>
1006
+
1007
+
1008
+ <a href="../../tutorial/10-getting_started/" title="Getting Started" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
1009
+ <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
1010
+ <span class="md-flex__ellipsis">
1011
+ <span class="md-footer-nav__direction">
1012
+ Next
1013
+ </span>
1014
+ Getting Started
1015
+ </span>
1016
+ </div>
1017
+ <div class="md-flex__cell md-flex__cell--shrink">
1018
+ <i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
1019
+ </div>
1020
+ </a>
1021
+
1022
+ </nav>
1023
+ </div>
1024
+
1025
+ <div class="md-footer-meta md-typeset">
1026
+ <div class="md-footer-meta__inner md-grid">
1027
+ <div class="md-footer-copyright">
1028
+
1029
+ <div class="md-footer-copyright__highlight">
1030
+ Copyright © 2018 Andrew Khoury
1031
+ </div>
1032
+
1033
+ powered by
1034
+ <a href="https://www.mkdocs.org">MkDocs</a>
1035
+ and
1036
+ <a href="https://squidfunk.github.io/mkdocs-material/">
1037
+ Material for MkDocs</a>
1038
+ </div>
1039
+
1040
+
1041
+
1042
+ </div>
1043
+ </div>
1044
+ </footer>
1045
+
1046
+ </div>
1047
+
1048
+ <script src="../../assets/javascripts/application.a59e2a89.js"></script>
1049
+
1050
+ <script>app.initialize({version:"0.17.5",url:{base:"../.."}})</script>
1051
+
1052
+
1053
+
1054
+
1055
+
1056
+ </body>
1057
+ </html>