rbcli 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +9 -0
- data/LICENSE.txt +5 -670
- data/README.md +64 -160
- data/VERSION +1 -0
- data/exe/rbcli +181 -242
- data/lib/rbcli/components/commands/command.rb +120 -0
- data/lib/rbcli/components/commands/command.rb.erb +55 -0
- data/lib/rbcli/components/commands/command_old.rb +105 -0
- data/lib/rbcli/components/commands/script.rb.erb +43 -0
- data/{lib-sh → lib/rbcli/components/commands/scriptwrapper}/lib-rbcli.sh +29 -34
- data/lib/rbcli/components/commands/scriptwrapper/scriptwrapper.rb +64 -0
- data/lib/rbcli/components/config/backend.rb +102 -0
- data/lib/rbcli/components/config/backends/env.rb +67 -0
- data/lib/rbcli/components/config/backends/helpers/deep_assign.rb +47 -0
- data/lib/rbcli/components/config/backends/ini.rb +53 -0
- data/lib/rbcli/components/config/backends/json.rb +32 -0
- data/lib/rbcli/components/config/backends/null.rb +32 -0
- data/lib/rbcli/components/config/backends/toml.rb +38 -0
- data/lib/rbcli/components/config/backends/yaml.rb +31 -0
- data/lib/rbcli/components/config/component.rb +33 -0
- data/lib/rbcli/components/config/config.rb +165 -0
- data/lib/rbcli/components/config/config_of_death.rb +12 -0
- data/lib/rbcli/components/config/template.rb.erb +36 -0
- data/lib/rbcli/components/core/configurate.rb +63 -0
- data/lib/rbcli/components/core/engine.rb +30 -0
- data/lib/rbcli/components/core/warehouse.rb +18 -0
- data/lib/rbcli/components/envvars/component.rb +20 -0
- data/lib/rbcli/components/envvars/template.rb.erb +24 -0
- data/lib/rbcli/components/hooks/component.rb +36 -0
- data/lib/rbcli/components/hooks/template.rb.erb +20 -0
- data/lib/rbcli/components/logger/component.rb +32 -0
- data/lib/rbcli/components/logger/logger.rb +155 -0
- data/lib/rbcli/components/logger/lolcat/lol.rb +71 -0
- data/lib/rbcli/components/logger/template.rb.erb +40 -0
- data/lib/rbcli/components/parser/component.rb +33 -0
- data/lib/rbcli/components/parser/optimist/optimist.rb +1149 -0
- data/lib/rbcli/components/parser/parser.rb +178 -0
- data/lib/rbcli/components/parser/template.rb.erb +35 -0
- data/lib/rbcli/components/updatechecker/common/common.rb +52 -0
- data/lib/rbcli/components/updatechecker/component.rb +42 -0
- data/lib/rbcli/components/updatechecker/gem_checker.rb +40 -0
- data/lib/rbcli/components/updatechecker/github_checker.rb +46 -0
- data/lib/rbcli/components/updatechecker/template.rb.erb +14 -0
- data/lib/rbcli/util/deprecation_warning.rb +41 -55
- data/lib/rbcli/util/errors.rb +12 -0
- data/lib/rbcli/util/exit.rb +12 -0
- data/lib/rbcli/util/hash_deep_symbolize.rb +26 -41
- data/lib/rbcli/util/string_compression.rb +10 -0
- data/lib/rbcli/version.rb +5 -20
- data/lib/rbcli-tool/helpers.rb +58 -0
- data/lib/rbcli-tool/skeletons/gem.rb.erb +17 -0
- data/lib/rbcli-tool/skeletons/portable.rb.erb +48 -0
- data/lib/rbcli.rb +19 -50
- data/sig/rbcli.rbs +9 -0
- metadata +125 -495
- data/.gitignore +0 -60
- data/.rakeTasks +0 -7
- data/.rbenv-gemsets +0 -1
- data/.travis.yml +0 -5
- data/CHANGELOG.md +0 -181
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -78
- data/Rakefile +0 -10
- data/bin/console +0 -33
- data/bin/setup +0 -28
- data/docs/404.html +0 -59
- data/docs/advanced/automatic_updates/index.html +0 -1174
- data/docs/advanced/command_types/index.html +0 -1262
- data/docs/advanced/distributed_state_locking/index.html +0 -1176
- data/docs/advanced/hooks/index.html +0 -1192
- data/docs/advanced/index.html +0 -1140
- data/docs/advanced/index.xml +0 -113
- data/docs/advanced/interactive_commands/index.html +0 -1177
- data/docs/advanced/logging/index.html +0 -1184
- data/docs/advanced/remote_execution/index.html +0 -1190
- data/docs/advanced/state_storage/index.html +0 -1281
- data/docs/advanced/user_config_files/index.html +0 -1209
- data/docs/categories/index.html +0 -1146
- data/docs/categories/index.xml +0 -10
- data/docs/css/atom-one-dark-reasonable.css +0 -77
- data/docs/css/auto-complete.css +0 -47
- data/docs/css/featherlight.min.css +0 -8
- data/docs/css/fontawesome-all.min.css +0 -1
- data/docs/css/hugo-theme.css +0 -254
- data/docs/css/hybrid.css +0 -102
- data/docs/css/nucleus.css +0 -615
- data/docs/css/perfect-scrollbar.min.css +0 -2
- data/docs/css/tags.css +0 -49
- data/docs/css/theme-blue.css +0 -111
- data/docs/css/theme-green.css +0 -111
- data/docs/css/theme-red.css +0 -111
- data/docs/css/theme.css +0 -1136
- data/docs/development/changelog/index.html +0 -1389
- data/docs/development/code_of_conduct/index.html +0 -1222
- data/docs/development/contributing/index.html +0 -1201
- data/docs/development/index.html +0 -1140
- data/docs/development/index.xml +0 -50
- data/docs/development/license/index.html +0 -1165
- data/docs/fonts/Inconsolata.eot +0 -0
- data/docs/fonts/Inconsolata.svg +0 -1
- data/docs/fonts/Inconsolata.ttf +0 -0
- data/docs/fonts/Inconsolata.woff +0 -0
- data/docs/fonts/Novecentosanswide-Normal-webfont.eot +0 -0
- data/docs/fonts/Novecentosanswide-Normal-webfont.svg +0 -1
- data/docs/fonts/Novecentosanswide-Normal-webfont.ttf +0 -0
- data/docs/fonts/Novecentosanswide-Normal-webfont.woff +0 -0
- data/docs/fonts/Novecentosanswide-Normal-webfont.woff2 +0 -0
- data/docs/fonts/Novecentosanswide-UltraLight-webfont.eot +0 -0
- data/docs/fonts/Novecentosanswide-UltraLight-webfont.svg +0 -1
- data/docs/fonts/Novecentosanswide-UltraLight-webfont.ttf +0 -0
- data/docs/fonts/Novecentosanswide-UltraLight-webfont.woff +0 -0
- data/docs/fonts/Novecentosanswide-UltraLight-webfont.woff2 +0 -0
- data/docs/fonts/Work_Sans_200.eot +0 -0
- data/docs/fonts/Work_Sans_200.svg +0 -1
- data/docs/fonts/Work_Sans_200.ttf +0 -0
- data/docs/fonts/Work_Sans_200.woff +0 -0
- data/docs/fonts/Work_Sans_200.woff2 +0 -0
- data/docs/fonts/Work_Sans_300.eot +0 -0
- data/docs/fonts/Work_Sans_300.svg +0 -1
- data/docs/fonts/Work_Sans_300.ttf +0 -0
- data/docs/fonts/Work_Sans_300.woff +0 -0
- data/docs/fonts/Work_Sans_300.woff2 +0 -0
- data/docs/fonts/Work_Sans_500.eot +0 -0
- data/docs/fonts/Work_Sans_500.svg +0 -1
- data/docs/fonts/Work_Sans_500.ttf +0 -0
- data/docs/fonts/Work_Sans_500.woff +0 -0
- data/docs/fonts/Work_Sans_500.woff2 +0 -0
- data/docs/images/clippy.svg +0 -1
- data/docs/images/favicon.png +0 -0
- data/docs/images/gopher-404.jpg +0 -0
- data/docs/imported/changelog/index.html +0 -1449
- data/docs/imported/index.html +0 -1191
- data/docs/imported/index.xml +0 -23
- data/docs/index.html +0 -1138
- data/docs/index.json +0 -183
- data/docs/index.xml +0 -208
- data/docs/js/auto-complete.js +0 -3
- data/docs/js/clipboard.min.js +0 -7
- data/docs/js/featherlight.min.js +0 -9
- data/docs/js/highlight.pack.js +0 -6
- data/docs/js/html5shiv-printshiv.min.js +0 -4
- data/docs/js/hugo-learn.js +0 -94
- data/docs/js/jquery-3.3.1.min.js +0 -2
- data/docs/js/jquery.sticky.js +0 -288
- data/docs/js/learn.js +0 -459
- data/docs/js/lunr.min.js +0 -6
- data/docs/js/modernizr.custom-3.6.0.js +0 -3
- data/docs/js/perfect-scrollbar.jquery.min.js +0 -2
- data/docs/js/perfect-scrollbar.min.js +0 -2
- data/docs/js/search.js +0 -93
- data/docs/mermaid/mermaid.css +0 -277
- data/docs/mermaid/mermaid.dark.css +0 -278
- data/docs/mermaid/mermaid.forest.css +0 -356
- data/docs/mermaid/mermaid.js +0 -8
- data/docs/quick_reference/index.html +0 -1246
- data/docs/quick_reference/index.xml +0 -11
- data/docs/sitemap.xml +0 -82
- data/docs/tags/index.html +0 -1146
- data/docs/tags/index.xml +0 -10
- data/docs/tutorial/10-getting_started/index.html +0 -1174
- data/docs/tutorial/20-project_layout/index.html +0 -1299
- data/docs/tutorial/30-your_first_command/index.html +0 -1263
- data/docs/tutorial/40-options_parameters_and_arguments/index.html +0 -1384
- data/docs/tutorial/50-publishing/index.html +0 -1187
- data/docs/tutorial/index.html +0 -1140
- data/docs/tutorial/index.xml +0 -67
- data/docs/webfonts/fa-brands-400.eot +0 -0
- data/docs/webfonts/fa-brands-400.svg +0 -1
- data/docs/webfonts/fa-brands-400.ttf +0 -0
- data/docs/webfonts/fa-brands-400.woff +0 -0
- data/docs/webfonts/fa-brands-400.woff2 +0 -0
- data/docs/webfonts/fa-regular-400.eot +0 -0
- data/docs/webfonts/fa-regular-400.svg +0 -1
- data/docs/webfonts/fa-regular-400.ttf +0 -0
- data/docs/webfonts/fa-regular-400.woff +0 -0
- data/docs/webfonts/fa-regular-400.woff2 +0 -0
- data/docs/webfonts/fa-solid-900.eot +0 -0
- data/docs/webfonts/fa-solid-900.svg +0 -1
- data/docs/webfonts/fa-solid-900.ttf +0 -0
- data/docs/webfonts/fa-solid-900.woff +0 -0
- data/docs/webfonts/fa-solid-900.woff2 +0 -0
- data/docs/whoami/index.html +0 -1155
- data/docs/whoami/index.xml +0 -11
- data/docs-src/archetypes/default.md +0 -6
- data/docs-src/config.toml +0 -37
- data/docs-src/content/_index.md +0 -40
- data/docs-src/content/advanced/_index.md +0 -11
- data/docs-src/content/advanced/automatic_updates.md +0 -46
- data/docs-src/content/advanced/command_types.md +0 -148
- data/docs-src/content/advanced/distributed_state_locking.md +0 -37
- data/docs-src/content/advanced/hooks.md +0 -69
- data/docs-src/content/advanced/interactive_commands.md +0 -41
- data/docs-src/content/advanced/logging.md +0 -39
- data/docs-src/content/advanced/remote_execution.md +0 -60
- data/docs-src/content/advanced/state_storage.md +0 -120
- data/docs-src/content/advanced/user_config_files.md +0 -51
- data/docs-src/content/development/_index.md +0 -11
- data/docs-src/content/development/changelog.md +0 -179
- data/docs-src/content/development/code_of_conduct.md +0 -81
- data/docs-src/content/development/contributing.md +0 -88
- data/docs-src/content/development/license.md +0 -17
- data/docs-src/content/quick_reference/_index.md +0 -180
- data/docs-src/content/tutorial/10-getting_started.md +0 -47
- data/docs-src/content/tutorial/20-project_layout.md +0 -123
- data/docs-src/content/tutorial/30-your_first_command.md +0 -132
- data/docs-src/content/tutorial/40-options_parameters_and_arguments.md +0 -282
- data/docs-src/content/tutorial/50-publishing.md +0 -53
- data/docs-src/content/tutorial/_index.md +0 -11
- data/docs-src/content/whoami/_index.md +0 -34
- data/docs-src/layouts/partials/logo.html +0 -3
- data/docs-src/makesite.sh +0 -40
- data/docs-src/mkdocs-archived.tar.gz +0 -0
- data/docs-src/runsite.sh +0 -8
- data/docs-src/themes/hugo-theme-learn/.editorconfig +0 -16
- data/docs-src/themes/hugo-theme-learn/.gitignore +0 -3
- data/docs-src/themes/hugo-theme-learn/.grenrc.yml +0 -25
- data/docs-src/themes/hugo-theme-learn/CHANGELOG.md +0 -226
- data/docs-src/themes/hugo-theme-learn/LICENSE.md +0 -22
- data/docs-src/themes/hugo-theme-learn/README.md +0 -97
- data/docs-src/themes/hugo-theme-learn/archetypes/chapter.md +0 -13
- data/docs-src/themes/hugo-theme-learn/archetypes/default.md +0 -7
- data/docs-src/themes/hugo-theme-learn/exampleSite/LICENSE.md +0 -20
- data/docs-src/themes/hugo-theme-learn/exampleSite/config.toml +0 -102
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/_index.en.md +0 -41
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/_index.fr.md +0 -43
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/_index.en.md +0 -12
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/_index.fr.md +0 -12
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/_index.zh.md +0 -12
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/configuration/_index.en.md +0 -60
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/configuration/_index.fr.md +0 -56
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/installation/_index.en.md +0 -102
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/installation/_index.fr.md +0 -100
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/installation/images/chapter.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/requirements/_index.en.md +0 -11
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/requirements/_index.fr.md +0 -11
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/requirements/images/magic.gif +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/style-customization/_index.en.md +0 -194
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/style-customization/_index.fr.md +0 -194
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/style-customization/images/blue-variant.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/style-customization/images/green-variant.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/style-customization/images/red-variant.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/_index.en.md +0 -12
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/_index.fr.md +0 -12
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/archetypes.en.md +0 -57
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/archetypes.fr.md +0 -57
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/i18n/_index.en.md +0 -78
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/i18n/_index.fr.md +0 -78
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/i18n/images/i18n-menu.gif +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/icons.en.md +0 -41
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/markdown.en.md +0 -692
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/markdown.fr.md +0 -666
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/menushortcuts.en.md +0 -109
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/menushortcuts.fr.md +0 -109
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/pages/_index.en.md +0 -166
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/pages/_index.fr.md +0 -146
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/pages/images/frontmatter-icon.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/pages/images/pages-chapter.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/pages/images/pages-default.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/syntaxhighlight.en.md +0 -89
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/tags.en.md +0 -39
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/tags.fr.md +0 -40
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/credits.en.md +0 -28
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/credits.fr.md +0 -28
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/_index.en.md +0 -16
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/_index.fr.md +0 -16
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.en.files/BachGavotteShort.mp3 +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.en.files/Carroll_AliceAuPaysDesMerveilles.pdf +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.en.files/adivorciarsetoca00cape.pdf +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.en.files/hugo.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.en.files/movieselectricsheep-flock-244-32500-2.mp4 +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.en.md +0 -85
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.fr.files/BachGavotteShort.mp3 +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.fr.files/Carroll_AliceAuPaysDesMerveilles.pdf +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.fr.files/adivorciarsetoca00cape.pdf +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.fr.files/hugo.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.fr.files/movieselectricsheep-flock-244-32500-2.mp4 +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.fr.md +0 -85
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/button.en.md +0 -16
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/button.fr.md +0 -16
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/_index.en.md +0 -45
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/_index.fr.md +0 -45
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/_index.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/_index.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/_index.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/_index.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/_index.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/_index.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/_index.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/_index.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/children-1-1-1-1-1/_index.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/children-1-1-1-1-1/_index.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-2/_index.en.md +0 -11
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-2/_index.fr.md +0 -11
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-2/test3.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-2/test3.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-3/_index.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-3/_index.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-4/_index.en.md +0 -7
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-4/_index.fr.md +0 -7
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/test.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/test.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/expand.en.md +0 -45
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/expand.fr.md +0 -45
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/mermaid.en.md +0 -283
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/mermaid.fr.md +0 -283
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/notice.en.md +0 -62
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/notice.fr.md +0 -62
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/siteparam.en.md +0 -23
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/siteparam.fr.md +0 -23
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/showcase.en.md +0 -13
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/showcase.fr.md +0 -14
- data/docs-src/themes/hugo-theme-learn/exampleSite/layouts/partials/custom-footer.html +0 -10
- data/docs-src/themes/hugo-theme-learn/exampleSite/layouts/partials/logo.html +0 -39
- data/docs-src/themes/hugo-theme-learn/exampleSite/layouts/partials/menu-footer.html +0 -14
- data/docs-src/themes/hugo-theme-learn/exampleSite/layouts/shortcodes/ghcontributors.html +0 -31
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/css/theme-mine.css +0 -104
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/fonts/monogramos-webfont.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/fonts/monogramos-webfont.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/fonts/monogramos-webfont.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/fonts/monogramos-webfont.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/fonts/monogramos-webfont.woff2 +0 -0
- 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/tat.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 +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/de.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/en.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/es.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/fr.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/hi.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/id.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/ja.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/nl.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/pt.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/ru.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/tr.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/zh-cn.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/images/screenshot.png +0 -0
- data/docs-src/themes/hugo-theme-learn/images/tn.png +0 -0
- data/docs-src/themes/hugo-theme-learn/layouts/404.html +0 -56
- data/docs-src/themes/hugo-theme-learn/layouts/_default/list.html +0 -22
- data/docs-src/themes/hugo-theme-learn/layouts/_default/single.html +0 -12
- data/docs-src/themes/hugo-theme-learn/layouts/index.html +0 -31
- data/docs-src/themes/hugo-theme-learn/layouts/index.json +0 -12
- data/docs-src/themes/hugo-theme-learn/layouts/partials/custom-comments.html +0 -3
- data/docs-src/themes/hugo-theme-learn/layouts/partials/custom-footer.html +0 -5
- data/docs-src/themes/hugo-theme-learn/layouts/partials/custom-header.html +0 -5
- data/docs-src/themes/hugo-theme-learn/layouts/partials/favicon.html +0 -1
- data/docs-src/themes/hugo-theme-learn/layouts/partials/footer.html +0 -77
- data/docs-src/themes/hugo-theme-learn/layouts/partials/header.html +0 -111
- data/docs-src/themes/hugo-theme-learn/layouts/partials/logo.html +0 -19
- data/docs-src/themes/hugo-theme-learn/layouts/partials/menu-footer.html +0 -1
- data/docs-src/themes/hugo-theme-learn/layouts/partials/menu.html +0 -151
- data/docs-src/themes/hugo-theme-learn/layouts/partials/meta.html +0 -2
- data/docs-src/themes/hugo-theme-learn/layouts/partials/search.html +0 -16
- data/docs-src/themes/hugo-theme-learn/layouts/partials/tags.html +0 -7
- data/docs-src/themes/hugo-theme-learn/layouts/partials/toc.html +0 -5
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/attachments.html +0 -36
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/button.html +0 -14
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/children.html +0 -101
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/expand.html +0 -17
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/mermaid.html +0 -2
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/notice.html +0 -2
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/ref.html +0 -14
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/relref.html +0 -14
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/siteparam.html +0 -7
- data/docs-src/themes/hugo-theme-learn/netlify.toml +0 -23
- data/docs-src/themes/hugo-theme-learn/static/css/atom-one-dark-reasonable.css +0 -77
- data/docs-src/themes/hugo-theme-learn/static/css/auto-complete.css +0 -47
- data/docs-src/themes/hugo-theme-learn/static/css/featherlight.min.css +0 -8
- data/docs-src/themes/hugo-theme-learn/static/css/fontawesome-all.min.css +0 -1
- data/docs-src/themes/hugo-theme-learn/static/css/hugo-theme.css +0 -254
- data/docs-src/themes/hugo-theme-learn/static/css/hybrid.css +0 -102
- data/docs-src/themes/hugo-theme-learn/static/css/nucleus.css +0 -615
- data/docs-src/themes/hugo-theme-learn/static/css/perfect-scrollbar.min.css +0 -2
- data/docs-src/themes/hugo-theme-learn/static/css/tags.css +0 -49
- data/docs-src/themes/hugo-theme-learn/static/css/theme-blue.css +0 -111
- data/docs-src/themes/hugo-theme-learn/static/css/theme-green.css +0 -111
- data/docs-src/themes/hugo-theme-learn/static/css/theme-red.css +0 -111
- data/docs-src/themes/hugo-theme-learn/static/css/theme.css +0 -1136
- data/docs-src/themes/hugo-theme-learn/static/fonts/Inconsolata.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Inconsolata.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/fonts/Inconsolata.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Inconsolata.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-Normal-webfont.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-Normal-webfont.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-Normal-webfont.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-Normal-webfont.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-Normal-webfont.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-UltraLight-webfont.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-UltraLight-webfont.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-UltraLight-webfont.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-UltraLight-webfont.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-UltraLight-webfont.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_200.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_200.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_200.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_200.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_200.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_300.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_300.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_300.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_300.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_300.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_500.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_500.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_500.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_500.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_500.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/static/images/clippy.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/images/favicon.png +0 -0
- data/docs-src/themes/hugo-theme-learn/static/images/gopher-404.jpg +0 -0
- data/docs-src/themes/hugo-theme-learn/static/js/auto-complete.js +0 -3
- data/docs-src/themes/hugo-theme-learn/static/js/clipboard.min.js +0 -7
- data/docs-src/themes/hugo-theme-learn/static/js/featherlight.min.js +0 -9
- data/docs-src/themes/hugo-theme-learn/static/js/highlight.pack.js +0 -6
- data/docs-src/themes/hugo-theme-learn/static/js/hugo-learn.js +0 -94
- data/docs-src/themes/hugo-theme-learn/static/js/jquery-3.3.1.min.js +0 -2
- data/docs-src/themes/hugo-theme-learn/static/js/jquery.sticky.js +0 -288
- data/docs-src/themes/hugo-theme-learn/static/js/learn.js +0 -459
- data/docs-src/themes/hugo-theme-learn/static/js/lunr.min.js +0 -6
- data/docs-src/themes/hugo-theme-learn/static/js/modernizr.custom-3.6.0.js +0 -3
- data/docs-src/themes/hugo-theme-learn/static/js/perfect-scrollbar.jquery.min.js +0 -2
- data/docs-src/themes/hugo-theme-learn/static/js/perfect-scrollbar.min.js +0 -2
- data/docs-src/themes/hugo-theme-learn/static/js/search.js +0 -93
- data/docs-src/themes/hugo-theme-learn/static/mermaid/mermaid.css +0 -277
- data/docs-src/themes/hugo-theme-learn/static/mermaid/mermaid.dark.css +0 -278
- data/docs-src/themes/hugo-theme-learn/static/mermaid/mermaid.forest.css +0 -356
- data/docs-src/themes/hugo-theme-learn/static/mermaid/mermaid.js +0 -8
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-brands-400.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-brands-400.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-brands-400.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-brands-400.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-brands-400.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-regular-400.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-regular-400.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-regular-400.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-regular-400.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-regular-400.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-solid-900.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-solid-900.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-solid-900.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-solid-900.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-solid-900.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/theme.toml +0 -21
- data/docs-src/themes/hugo-theme-learn/wercker.yml +0 -16
- data/lib/rbcli/configuration/configurate.rb +0 -85
- data/lib/rbcli/configuration/configurate_blocks/hooks.rb +0 -52
- data/lib/rbcli/configuration/configurate_blocks/me.rb +0 -122
- data/lib/rbcli/configuration/configurate_blocks/storage.rb +0 -50
- data/lib/rbcli/engine/command.rb +0 -251
- data/lib/rbcli/engine/load_project.rb +0 -45
- data/lib/rbcli/engine/parser.rb +0 -114
- data/lib/rbcli/features/autoupdate/common/autoupdate.rb +0 -50
- data/lib/rbcli/features/autoupdate/gem_updater.rb +0 -62
- data/lib/rbcli/features/autoupdate/github_updater.rb +0 -76
- data/lib/rbcli/features/logging.rb +0 -98
- data/lib/rbcli/features/remote_exec.rb +0 -187
- data/lib/rbcli/features/scriptwrapper.rb +0 -75
- data/lib/rbcli/features/userconfig.rb +0 -163
- data/lib/rbcli/state_storage/common/state_storage.rb +0 -138
- data/lib/rbcli/state_storage/localstate.rb +0 -77
- data/lib/rbcli/state_storage/placeholders.rb +0 -29
- data/lib/rbcli/state_storage/remote_state_connectors/dynamodb.rb +0 -272
- data/lib/rbcli/state_storage/remotestate_dynamodb.rb +0 -115
- data/lib/rbcli/util/msg.rb +0 -55
- data/lib/rbcli/util/string_colorize.rb +0 -45
- data/lib/rbcli/util/trollop.rb +0 -1050
- data/lib/rbcli-tool/generators.rb +0 -105
- data/lib/rbcli-tool/mdless_fix.rb +0 -406
- data/lib/rbcli-tool/project.rb +0 -120
- data/lib/rbcli-tool/util.rb +0 -70
- data/lib/rbcli-tool.rb +0 -37
- data/rbcli.gemspec +0 -69
- data/skeletons/micro/executable +0 -127
- data/skeletons/mini/executable +0 -242
- data/skeletons/project/.gitignore +0 -11
- data/skeletons/project/.rakeTasks +0 -7
- data/skeletons/project/.rspec +0 -3
- data/skeletons/project/CODE_OF_CONDUCT.md +0 -74
- data/skeletons/project/Gemfile +0 -6
- data/skeletons/project/README.md +0 -46
- data/skeletons/project/Rakefile +0 -6
- data/skeletons/project/application/commands/command.erb +0 -28
- data/skeletons/project/application/commands/script.erb +0 -30
- data/skeletons/project/application/commands/scripts/script.sh +0 -60
- data/skeletons/project/application/options.rb +0 -34
- data/skeletons/project/config/autoupdate.rb +0 -35
- data/skeletons/project/config/general.rb +0 -17
- data/skeletons/project/config/logging.rb +0 -19
- data/skeletons/project/config/storage.rb +0 -35
- data/skeletons/project/config/userspace.rb +0 -33
- data/skeletons/project/config/version.rb +0 -3
- data/skeletons/project/exe/executable +0 -53
- data/skeletons/project/hooks/default_action.rb +0 -16
- data/skeletons/project/hooks/first_run.rb +0 -16
- data/skeletons/project/hooks/post_execution.rb +0 -14
- data/skeletons/project/hooks/pre_execution.rb +0 -14
- data/skeletons/project/lib/lib.erb +0 -9
- data/skeletons/project/spec/spec_helper.rb +0 -14
- data/skeletons/project/spec/untitled_spec.rb +0 -9
- data/skeletons/project/untitled.gemspec +0 -40
- data/skeletons/project/userconf/user_defaults.yml +0 -6
- /data/{skeletons/project/.rbcli → lib/rbcli/plugins/.keep} +0 -0
@@ -1,282 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: "Options, Parameters, and Arguments"
|
3
|
-
date: 2019-06-20T15:07:21-04:00
|
4
|
-
draft: false
|
5
|
-
pre: "<b>4. </b>"
|
6
|
-
weight: 40
|
7
|
-
---
|
8
|
-
|
9
|
-
If you're already an experienced coder, you can jump to the last section of this document, the [Simplified Reference (TLDR)](#simplified-reference-tldr)
|
10
|
-
|
11
|
-
## Command Line Structure
|
12
|
-
|
13
|
-
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:
|
14
|
-
|
15
|
-
```
|
16
|
-
toolname [options] command [parameters] argument1 argument2...
|
17
|
-
```
|
18
|
-
|
19
|
-
* __Options__ are command line parameters such as `-f`, or `--force`. These are available globally to every command. You can create your own, though several are already built-in and reserved for RBCli:
|
20
|
-
* `--config-file=<filename>` allows specifying a config file location manually.
|
21
|
-
* `--generate-config` generates a config file for the user by writing out the defaults to a YAML file. This option will only appear if a config file has been set. The location is configurable, with more on that in the documentation on [User Config Files][user_config_documentation]).
|
22
|
-
* `-v / --version` shows the version.
|
23
|
-
* `-h / --help` shows the help.
|
24
|
-
* __Command__ represents the subcommands that you will create, such as `list`, `test`, or `apply`.
|
25
|
-
* __Parameters__ are the same as options, but only apply to the specific subcommand being executed. In this case only the `-h / --help` parameter is provided automatically.
|
26
|
-
* __Arguments__ are strings that don't begin with a '-', and are passed to the command's code as an array. These can be used as subcommands or additional parameters for your command.
|
27
|
-
|
28
|
-
So a valid command could look something like these:
|
29
|
-
|
30
|
-
```shell
|
31
|
-
mytool -n load --filename=foo.txt
|
32
|
-
mytool parse foo.txt
|
33
|
-
mytool show -l
|
34
|
-
```
|
35
|
-
|
36
|
-
Note that all options and parameters will have both a short and long version of the parameter available for use.
|
37
|
-
|
38
|
-
So let's take a look at how we define them.
|
39
|
-
|
40
|
-
|
41
|
-
## Options
|
42
|
-
|
43
|
-
You can find the options declarations under `application/options.rb`. You'll see the example in the code:
|
44
|
-
|
45
|
-
```ruby
|
46
|
-
option :name, 'Give me your name', short: 'n', type: :string, default: 'Jack', required: false, permitted: ['Jack', 'Jill']
|
47
|
-
```
|
48
|
-
|
49
|
-
This won't do for our tool, so let's change it. Remember that these options will be applicable to all of our commands, so lets make it something appropriate:
|
50
|
-
|
51
|
-
```ruby
|
52
|
-
option :color, 'Enable color output', short: 'c', type: :boolean, default: false
|
53
|
-
```
|
54
|
-
|
55
|
-
So now, let's take advantage of this flag in our `list` command. Let's change our block to:
|
56
|
-
|
57
|
-
```ruby
|
58
|
-
action do |params, args, global_opts, config|
|
59
|
-
Dir.glob "./*" do |filename|
|
60
|
-
outname = filename.split('/')[1]
|
61
|
-
outname += '/' if File.directory? filename
|
62
|
-
|
63
|
-
# We change the color based on the kind of file shown
|
64
|
-
if global_opts[:color]
|
65
|
-
if File.directory? filename
|
66
|
-
outname = outname.light_blue
|
67
|
-
elsif File.executable? filename
|
68
|
-
outname = outname.light_green
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
puts outname
|
73
|
-
end
|
74
|
-
end
|
75
|
-
```
|
76
|
-
|
77
|
-
Notice how we referenced the value by using `global_opts[:color]`. It's that simple. To see it in action, run:
|
78
|
-
|
79
|
-
```bash
|
80
|
-
mytool -c list
|
81
|
-
```
|
82
|
-
|
83
|
-
## Parameters
|
84
|
-
|
85
|
-
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's class. So let's add the following lines to our list command within the class declaration:
|
86
|
-
|
87
|
-
```ruby
|
88
|
-
parameter :sort, 'Sort output alphabetically', type: :boolean, default: false
|
89
|
-
parameter :all, 'Show hidden files', type: :boolean, default: false
|
90
|
-
parameter :directoriesfirst, 'Show directories on top', type: :boolean, default: false
|
91
|
-
```
|
92
|
-
|
93
|
-
And let's modify our action block to utilize them:
|
94
|
-
|
95
|
-
```ruby
|
96
|
-
action do |params, args, global_opts, config|
|
97
|
-
filelist = []
|
98
|
-
|
99
|
-
# We include dotfiles if specified
|
100
|
-
include_dotfiles = (params[:all]) ? File::FNM_DOTMATCH : 0
|
101
|
-
|
102
|
-
# We store a list of the files in an array, including dotfiles if specified
|
103
|
-
Dir.glob "./*", include_dotfiles do |filename|
|
104
|
-
outname = filename.split('/')[1]
|
105
|
-
outname += '/' if File.directory? filename
|
106
|
-
filelist.append outname
|
107
|
-
end
|
108
|
-
|
109
|
-
# Sort alphabetically if specified
|
110
|
-
filelist.sort! if params[:sort]
|
111
|
-
|
112
|
-
# Put directories first if specified
|
113
|
-
if params[:directoriesfirst]
|
114
|
-
files = []; dirs = []
|
115
|
-
filelist.each do |filename|
|
116
|
-
if File.directory? filename
|
117
|
-
dirs.append(filename)
|
118
|
-
else
|
119
|
-
files.append(filename)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
filelist = dirs + files
|
123
|
-
end
|
124
|
-
|
125
|
-
# Apply color. We do this at the end now because color codes can alter the sorting.
|
126
|
-
filelist.map! do |filename|
|
127
|
-
if File.directory? filename
|
128
|
-
filename.light_blue
|
129
|
-
elsif File.executable? filename
|
130
|
-
filename.light_green
|
131
|
-
else
|
132
|
-
filename
|
133
|
-
end
|
134
|
-
end if global_opts[:color]
|
135
|
-
|
136
|
-
puts filelist
|
137
|
-
end
|
138
|
-
```
|
139
|
-
|
140
|
-
You should be able to run it now:
|
141
|
-
|
142
|
-
```bash
|
143
|
-
mytool -c list -asd
|
144
|
-
```
|
145
|
-
|
146
|
-
Note how the parameters come after the `list` command in the syntax above. As you create more commands, each will have its own unique set of parameters, while the options remain _before_ the command and are available to all of them.
|
147
|
-
|
148
|
-
### User Prompting
|
149
|
-
|
150
|
-
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 `prompt:` keyword. Let's change one of our parameters to utilize it:
|
151
|
-
|
152
|
-
```ruby
|
153
|
-
parameter :sort, 'Sort output alphabetically', type: :boolean, default: false, prompt: "Sort output alphabetically?"
|
154
|
-
```
|
155
|
-
|
156
|
-
Now, let's run the tool while omitting the `--sort` parameter, as such:
|
157
|
-
|
158
|
-
```bash
|
159
|
-
mytool -c list -ad
|
160
|
-
```
|
161
|
-
|
162
|
-
This should give you the prompt:
|
163
|
-
|
164
|
-
```
|
165
|
-
Sort output alphabetically? (y/N):
|
166
|
-
```
|
167
|
-
|
168
|
-
Because we set the parameter to default to `false` the default here is `N`, which is used if the user hits enter without entering a letter. If the default was set to `true`, then the `Y` would be capitalized and be the default.
|
169
|
-
|
170
|
-
For more information, see the documentation on [Interactive Commands][interactive_commands].
|
171
|
-
|
172
|
-
## Arguments
|
173
|
-
|
174
|
-
Lastly on the command line, there are arguments. Arguments are simply strings without the `-` character in front, and automatically get passed into an array in your applicaiton. Let's take a look at how we can use them.
|
175
|
-
|
176
|
-
Unlike options and parameters, arguments require no setup. So let's assume that we want any arguments passed to the `list` command to be filenames that you want to display, and that you can pass multiple ones. Since arguments aren't listed automatically by the help function, this is a good example of what to put in your usage text. Let's take a look at what our class looks like now:
|
177
|
-
|
178
|
-
```ruby
|
179
|
-
class List < Rbcli::Command
|
180
|
-
description %q{List files in current directory}
|
181
|
-
usage <<-EOF
|
182
|
-
To list only specific files, you can enter filenames as arguments
|
183
|
-
|
184
|
-
mytool list filename1 filename2...
|
185
|
-
EOF
|
186
|
-
parameter :sort, 'Sort output alphabetically', type: :boolean, default: false
|
187
|
-
parameter :all, 'Show hidden files', type: :boolean, default: false
|
188
|
-
parameter :directoriesfirst, 'Show directories on top', type: :boolean, default: false
|
189
|
-
|
190
|
-
action do |params, args, global_opts, config|
|
191
|
-
filelist = []
|
192
|
-
|
193
|
-
# We include dotfiles if specified
|
194
|
-
include_dotfiles = (params[:all]) ? File::FNM_DOTMATCH : 0
|
195
|
-
|
196
|
-
# We store a list of the files in an array, including dotfiles if specified
|
197
|
-
Dir.glob "./*", include_dotfiles do |filename|
|
198
|
-
outname = filename.split('/')[1]
|
199
|
-
next unless args.include? outname if args.length > 0
|
200
|
-
outname += '/' if File.directory? filename
|
201
|
-
filelist.append outname
|
202
|
-
end
|
203
|
-
|
204
|
-
# Sort alphabetically if specified
|
205
|
-
filelist.sort! if params[:sort]
|
206
|
-
|
207
|
-
# Put directories first if specified
|
208
|
-
if params[:directoriesfirst]
|
209
|
-
files = []; dirs = []
|
210
|
-
filelist.each do |filename|
|
211
|
-
if File.directory? filename
|
212
|
-
dirs.append(filename)
|
213
|
-
else
|
214
|
-
files.append(filename)
|
215
|
-
end
|
216
|
-
end
|
217
|
-
filelist = dirs + files
|
218
|
-
end
|
219
|
-
|
220
|
-
# Apply color. We do this at the end because color codes can alter the sorting
|
221
|
-
filelist.map! do |filename|
|
222
|
-
if File.directory? filename
|
223
|
-
filename.light_blue
|
224
|
-
elsif File.executable? filename
|
225
|
-
filename.light_green
|
226
|
-
else
|
227
|
-
filename
|
228
|
-
end
|
229
|
-
end if global_opts[:color]
|
230
|
-
|
231
|
-
puts filelist
|
232
|
-
end
|
233
|
-
end
|
234
|
-
```
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
## Simplified Reference (TLDR)
|
239
|
-
|
240
|
-
RBCli enforces a CLI structure of:
|
241
|
-
|
242
|
-
```
|
243
|
-
toolname [options] command [parameters] argument1 argument2...
|
244
|
-
```
|
245
|
-
|
246
|
-
__Options__ are declared in `application/options.rb` file.
|
247
|
-
|
248
|
-
__Parameters__ are declared in the respective command's class declaration.
|
249
|
-
|
250
|
-
__Arguments__ don'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 `usage` text declaration so that the user can see what to do in the help.
|
251
|
-
|
252
|
-
__Options__ and __parameters__ both use the same format:
|
253
|
-
|
254
|
-
```ruby
|
255
|
-
option :<name>, "<description_string>", short: '<character>', type: <variable_type>, default: <default_value>, permitted: [<array_of_permitted_values]
|
256
|
-
|
257
|
-
parameter :<name>, "<description_string>", short: '<character>', type: <variable_type>, default: <default_value>, permitted: [<array_of_permitted_values]
|
258
|
-
```
|
259
|
-
|
260
|
-
* `name`
|
261
|
-
* (Required) The long name of the option, as a symbol. This will be represented as `--name` on the command line
|
262
|
-
* `description_string`
|
263
|
-
* (Required) A short description of the command that will appear in the help text for the user
|
264
|
-
* `type`
|
265
|
-
* (Required) The following types are supported: `:string`, `:boolean` or `:flag`, `:integer`, and `:float`
|
266
|
-
* `default`
|
267
|
-
* (Optional) A default value for the option if one isn't entered (default: nil)
|
268
|
-
* `short`
|
269
|
-
* (Optional) A letter that acts as a shortcut for the option. This will allow users to apply the command as `-n`
|
270
|
-
* To not have a short value, set this to :none (default: the first letter of the long name)
|
271
|
-
* `required`
|
272
|
-
* (Optional) Specify whether the option is required from the user (default: false)
|
273
|
-
* `permitted`
|
274
|
-
* (Optional) An array of whitelisted values for the option (default: nil)
|
275
|
-
|
276
|
-
## Next Steps
|
277
|
-
|
278
|
-
Next, we're going to take a quick look at how to publish and distribute your application, both publicly and within your organization.
|
279
|
-
|
280
|
-
[user_config_documentation]: {{< ref "advanced/user_config_files" >}}
|
281
|
-
[regex_explanation]: https://medium.com/factory-mind/regex-tutorial-a-simple-cheatsheet-by-examples-649dc1c3f285
|
282
|
-
[interactive_commands]: {{< ref "advanced/interactive_commands" >}}
|
@@ -1,53 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: "Publishing Your Application"
|
3
|
-
date: 2019-06-20T15:07:21-04:00
|
4
|
-
draft: false
|
5
|
-
pre: "<b>5. </b>"
|
6
|
-
weight: 50
|
7
|
-
---
|
8
|
-
|
9
|
-
RBCli creates projects designed to be easily distributed via either source control or as a gem. We'll go over both methods.
|
10
|
-
|
11
|
-
## Common Tasks
|
12
|
-
|
13
|
-
Regardless of where you are publishing, certain tasks need to be accomplished. Namely, preparing the gemspec and the README.
|
14
|
-
|
15
|
-
In both files the items that need changing are pretty obvious -- you'll need to fill out your name, email, etc, and replace the placeholder text in the README with something useful to your users.
|
16
|
-
|
17
|
-
Then, for every release, you'll need to update the version number in `config/version.rb`. This number is automatically used by the `gemspec` when versioning the gem in the system, and by RBCli when displaying help to the user and checking for automatic updates if you enable that feature (see [Automatic Updates][automatic_update_documentation] for more information).
|
18
|
-
|
19
|
-
## Source Control Distribution
|
20
|
-
|
21
|
-
With Source Control distribution your users will be cloning the source code directly from your repository, and building and installing the gem locally. Thankfully, the process is pretty simple:
|
22
|
-
|
23
|
-
```bash
|
24
|
-
git clone <your_repo_here>
|
25
|
-
gem build mytool.gemspec
|
26
|
-
gem install mytool-*.gem
|
27
|
-
```
|
28
|
-
|
29
|
-
Note that he README's placeholder text has these commands already listed for your users, which you can leave as instructions.
|
30
|
-
|
31
|
-
When using this method, we highly recommend using a git flow where you only merge to master when you are ready to release, this way your users don't inadvertently download a buggy commit.
|
32
|
-
|
33
|
-
## Rubygems.org Distribution
|
34
|
-
|
35
|
-
If you're distributing as a gem via Rubygems.org, you'll need to follow a specific release process.
|
36
|
-
|
37
|
-
1. Update the version number in `config/version.rb`
|
38
|
-
2. Commit the change locally
|
39
|
-
3. Run `bundle exec rake release`
|
40
|
-
|
41
|
-
This will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
42
|
-
|
43
|
-
## Recommended Platforms
|
44
|
-
|
45
|
-
As far as RBCli is concerned, all Git hosts and gem platforms work equally well, and as long as the code reaches your users in one piece it's all the same. That said, if you'd like to take advantage of automatic update notifications for your users, please see the documentation for [Automatic Updates][automatic_update_documentation] for a list of supported platforms for that feature.
|
46
|
-
|
47
|
-
## Next Steps
|
48
|
-
|
49
|
-
Congratulations! You've completed the tutorial on RBCli and should be able to make all sorts of CLI applications and tools with what you learned. That said, there are still many features in RBCli that we didn't explore, which you can find in the __Advanced__ section of this site. If you aren't sure where to start, we recommend looking at [User Config Files][user_config_files_documentation] and going from there.
|
50
|
-
|
51
|
-
|
52
|
-
[automatic_update_documentation]: {{< ref "advanced/automatic_updates" >}}
|
53
|
-
[user_config_files_documentation]: {{< ref "advanced/user_config_files" >}}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
+++
|
2
|
-
title = "Tutorial"
|
3
|
-
date = 2019-06-20T15:08:08-04:00
|
4
|
-
weight = 10
|
5
|
-
chapter = true
|
6
|
-
#pre = "<b>X. </b>"
|
7
|
-
+++
|
8
|
-
|
9
|
-
# Tutorial
|
10
|
-
|
11
|
-
Get yourself started with RBCli. This section alone won't make you a Ninja, but you'll be able to cut a tool from scratch pretty quickly.
|
@@ -1,34 +0,0 @@
|
|
1
|
-
+++
|
2
|
-
title = "My Letter To You"
|
3
|
-
#menuTitle = "whoami"
|
4
|
-
date = 2019-06-20T15:46:52-04:00
|
5
|
-
weight = 40
|
6
|
-
chapter = false
|
7
|
-
#pre = "<b>X. </b>"
|
8
|
-
+++
|
9
|
-
|
10
|
-
My Fellow Coder,
|
11
|
-
|
12
|
-
I'm glad to see you are interested in RBCli. I'd like to introduce myself. My name is Andrew, and I've been a technologist since 1992 when my father bought our first family computer -- a 486DX2 which ran at 66Mhz (33Mhz if you turned off the 'turbo' button) and came with MS DOS 5.0, [QBasic](https://en.wikipedia.org/wiki/QBasic), and a game already coded in it called [Nibbles](https://classicreload.com/qbasic-nibbles.html) (if you care to see the code, die 5 times and don't play again). I didn't like that the game forced my name to be "Sammy", and thought, "hey, if I can see the code, can't I change it?". So I did what any annoyed child would do and learned to code so I could do just that. I'd tell you what I changed it to, but I was so proud of myself for this simple feat that I changed it every 30 seconds and couldn't settle on just one name. Then I performed my first ever hack, and figured out how to go through walls without dying. All of a sudden the world seemed limitless.
|
13
|
-
|
14
|
-
I was only a child at the time, but on that day I learned that every "rule" in computing was an artifical construct and could be changed to suit your needs. Thus began my career in tech and my obsession to change the world with it. This is why RBCli was born.
|
15
|
-
|
16
|
-
RBCli started as a collection of code that I would copy-paste between projects, until one day when I wondered if I could just find a framework that suited me. I couldn't - in case you hadn't guessed - so I decided to build my own and give it to the world. I would not have accomplished even half of what I have without the open source community, and this is to be the first of hopefully many contributions back.
|
17
|
-
|
18
|
-
The features in RBCli have been chosen from over 25 years of experience writing applications, building features that 3rd parties left out, managing large scale infrastructure, designing embedded systems, integrating enterprise systems, automating CI/CD, scripting my own computers, and so much more. I hope that you can find as much use out of it as I have.
|
19
|
-
|
20
|
-
If you'd like to get in touch with me at any time, feel free to email me at [akhoury@live.com](mailto:akhoury@live.com).
|
21
|
-
|
22
|
-
All the best,
|
23
|
-
|
24
|
-
_Andrew_
|
25
|
-
|
26
|
-
|
27
|
-
P.S.: If you really liked RBCli and want to support it, any amount you can help out with goes a long way.
|
28
|
-
|
29
|
-
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
30
|
-
<input type="hidden" name="cmd" value="_s-xclick">
|
31
|
-
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----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-----END PKCS7-----">
|
32
|
-
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
33
|
-
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
34
|
-
</form>
|
data/docs-src/makesite.sh
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
if ! which hugo &> /dev/null; then
|
4
|
-
echo "Hugo not found. Installing..."
|
5
|
-
brew install hugo
|
6
|
-
fi
|
7
|
-
|
8
|
-
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
9
|
-
|
10
|
-
# Changelog
|
11
|
-
_chlog_src="${DIR}/../CHANGELOG.md"
|
12
|
-
_chlog_target="${DIR}/content/development/changelog.md"
|
13
|
-
cat << EOF > ${_chlog_target}
|
14
|
-
---
|
15
|
-
title: "Changelog"
|
16
|
-
date: 2019-06-20T15:07:21-04:00
|
17
|
-
draft: false
|
18
|
-
weight: 100
|
19
|
-
---
|
20
|
-
|
21
|
-
EOF
|
22
|
-
cat ${_chlog_src} | tail -n +2 >> ${_chlog_target}
|
23
|
-
|
24
|
-
|
25
|
-
# Quick Reference
|
26
|
-
_qref_src="${DIR}/../README.md"
|
27
|
-
_qref_target="${DIR}/content/quick_reference/_index.md"
|
28
|
-
cat << EOF > ${_qref_target}
|
29
|
-
+++
|
30
|
-
title = "Quick Reference"
|
31
|
-
date = 2019-06-20T15:49:49-04:00
|
32
|
-
weight = 1
|
33
|
-
chapter = false
|
34
|
-
draft = false
|
35
|
-
+++
|
36
|
-
|
37
|
-
EOF
|
38
|
-
sed -n '/Quick Reference/,$p' ${_qref_src} | tail -n +2 >> ${_qref_target}
|
39
|
-
|
40
|
-
hugo -d "${DIR}/../docs"
|
Binary file
|
data/docs-src/runsite.sh
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# https://editorconfig.org
|
2
|
-
|
3
|
-
root = true
|
4
|
-
|
5
|
-
[*]
|
6
|
-
charset = utf-8
|
7
|
-
end_of_line = lf
|
8
|
-
indent_size = 2
|
9
|
-
indent_style = space
|
10
|
-
trim_trailing_whitespace = true
|
11
|
-
|
12
|
-
[*.js]
|
13
|
-
insert_final_newline = true
|
14
|
-
|
15
|
-
[*.md]
|
16
|
-
trim_trailing_whitespace = false
|
@@ -1,25 +0,0 @@
|
|
1
|
-
---
|
2
|
-
dataSource: "prs"
|
3
|
-
prefix: "v"
|
4
|
-
onlyMilestones: false
|
5
|
-
changelogFilename: "CHANGELOG.md"
|
6
|
-
includeMessages: "all"
|
7
|
-
ignoreIssuesWith:
|
8
|
-
- "support"
|
9
|
-
ignoreLabels:
|
10
|
-
- "duplicate"
|
11
|
-
- "invalid"
|
12
|
-
- "wontfix"
|
13
|
-
groupBy:
|
14
|
-
New features:
|
15
|
-
- "feature"
|
16
|
-
Bug Fixes:
|
17
|
-
- "bug"
|
18
|
-
Enhancements:
|
19
|
-
- "enhancement"
|
20
|
-
Internationalisation:
|
21
|
-
- "i18n"
|
22
|
-
Theme Meta:
|
23
|
-
- "meta"
|
24
|
-
Uncategorised:
|
25
|
-
- "closed"
|