rbcli 0.3.3 → 0.4.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.
- 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/{util → components/parser/optimist}/optimist.rb +134 -48
- 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 -496
- data/.gitignore +0 -60
- data/.rakeTasks +0 -7
- data/.rbenv-gemsets +0 -1
- data/.travis.yml +0 -5
- data/CHANGELOG.md +0 -193
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -92
- 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 -75
- 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 -11
- 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 -1420
- 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 -40
- 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 -138
- 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 -12
- data/docs/sitemap.xml +0 -81
- data/docs/tags/index.html +0 -1146
- data/docs/tags/index.xml +0 -11
- 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 -47
- 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 -12
- 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 -199
- 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 -116
- 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-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 -73
- data/skeletons/micro/executable +0 -132
- data/skeletons/mini/executable +0 -247
- data/skeletons/project/.gitignore +0 -11
- data/skeletons/project/.rakeTasks +0 -7
- data/skeletons/project/.rbcli +0 -0
- 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/{docs-src/.hugo_build.lock → lib/rbcli/plugins/.keep} +0 -0
@@ -0,0 +1,155 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
##################################################################################
|
3
|
+
# Rbcli -- A framework for developing command line applications in Ruby #
|
4
|
+
# Copyright (C) 2024 Andrew Khoury <akhoury@live.com> #
|
5
|
+
##################################################################################
|
6
|
+
%w(logger json colorize).each { |req| require req }
|
7
|
+
require_relative 'lolcat/lol'
|
8
|
+
|
9
|
+
# noinspection RubyClassVariableUsageInspection
|
10
|
+
class Rbcli::Logger
|
11
|
+
EXECUTABLE ||= File.basename($0).gsub(/\.[^.]+$/, '')
|
12
|
+
@max_prog_len = 0
|
13
|
+
@original_formatter = Logger::Formatter.new
|
14
|
+
@@formatters = {
|
15
|
+
display: Proc.new { |severity, _datetime, _progname, msg|
|
16
|
+
severity == 'INFO' ? msg : "#{colorlevel(severity)}#{(' ' * (5 - severity.length))} || #{msg}"
|
17
|
+
},
|
18
|
+
simple: Proc.new { |severity, _datetime, progname, msg|
|
19
|
+
@max_prog_len = (@max_prog_len > progname.length) ? @max_prog_len : progname.length unless progname.nil?
|
20
|
+
"#{colorlevel(severity)}#{(' ' * (5 - severity.length))} || #{progname || (' ' * @max_prog_len)} || #{msg}"
|
21
|
+
},
|
22
|
+
full: Proc.new { |severity, datetime, progname, msg|
|
23
|
+
@max_prog_len = (@max_prog_len > progname.length) ? @max_prog_len : progname.length unless progname.nil?
|
24
|
+
"#{datetime.strftime("%Y-%m-%d %H:%M:%S.%6N")} || #{EXECUTABLE} || #{progname || (' ' * @max_prog_len)} || #{colorlevel(severity)}#{(' ' * (5 - severity.length))} || #{msg}"
|
25
|
+
},
|
26
|
+
apache: Proc.new { |severity, datetime, progname, msg|
|
27
|
+
"[#{datetime.strftime("%a %b %d %H:%M:%S.%6N %Y")}] [#{severity}] [#{EXECUTABLE}] [#{progname}] #{msg.gsub(/\e\[([;\d]+)?m/, '')}"
|
28
|
+
},
|
29
|
+
json: Proc.new { |severity, datetime, progname, msg|
|
30
|
+
{ timestamp: datetime.strftime("%Y-%m-%d %H:%M:%S.%N"), severity: severity, application: EXECUTABLE, module: progname, message: msg.gsub(/\e\[([;\d]+)?m/, '') }.to_json
|
31
|
+
},
|
32
|
+
ruby: Proc.new { |severity, datetime, progname, msg|
|
33
|
+
@original_formatter.call(severity, datetime, progname, msg).chomp
|
34
|
+
},
|
35
|
+
lolcat: Proc.new { |severity, _datetime, _progname, msg|
|
36
|
+
"#{colorlevel(severity)}#{(' ' * (5 - severity.length))} || #{Lol.makestr(msg, { spread: 3, freq: 0.1, slope: 4, invert: false, truecolor: true })}"
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
def self.formats
|
41
|
+
@@formatters.keys
|
42
|
+
end
|
43
|
+
|
44
|
+
def initialize(target: STDOUT, level: :info, format: :display)
|
45
|
+
self.target(target)
|
46
|
+
self.level(level)
|
47
|
+
self.format(format)
|
48
|
+
end
|
49
|
+
|
50
|
+
def target target
|
51
|
+
@logger = Logger.new(target_select(target))
|
52
|
+
@logger.formatter = Proc.new { |severity, datetime, progname, msg|
|
53
|
+
msg = msg.to_s unless msg.is_a?(String)
|
54
|
+
msg.lines.map { |line| @@formatters[@format].call(severity, datetime, progname, line.chomp) }.join("\n") + "\n"
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def level slug = nil
|
59
|
+
return @logger.level if slug.nil?
|
60
|
+
@logger.level = logger_level(slug)
|
61
|
+
end
|
62
|
+
|
63
|
+
def format slug = nil
|
64
|
+
return @format if slug.nil?
|
65
|
+
@format = slug if @@formatters.key?(slug)
|
66
|
+
end
|
67
|
+
|
68
|
+
def add_format slug, prok
|
69
|
+
@@formatters[slug] = prok
|
70
|
+
end
|
71
|
+
|
72
|
+
def add level, message, progname = nil, &block
|
73
|
+
@logger.add(logger_level(level), message, progname, &block)
|
74
|
+
end
|
75
|
+
|
76
|
+
def debug message, progname = nil, &block
|
77
|
+
self.add(Logger::DEBUG, message, progname, &block)
|
78
|
+
end
|
79
|
+
|
80
|
+
def info message, progname = nil, &block
|
81
|
+
self.add(Logger::INFO, message, progname, &block)
|
82
|
+
end
|
83
|
+
|
84
|
+
def warn message, progname = nil, &block
|
85
|
+
self.add(Logger::WARN, message, progname, &block)
|
86
|
+
end
|
87
|
+
|
88
|
+
def error message, progname = nil, &block
|
89
|
+
self.add(Logger::ERROR, message, progname, &block)
|
90
|
+
end
|
91
|
+
|
92
|
+
def fatal message, progname = nil, &block
|
93
|
+
self.add(Logger::FATAL, message, progname, &block)
|
94
|
+
end
|
95
|
+
|
96
|
+
def unknown message, progname = nil, &block
|
97
|
+
self.add(Logger::UNKNOWN, message, progname, &block)
|
98
|
+
end
|
99
|
+
|
100
|
+
%w(debug, info, warn, error, fatal, unknown).each do |l|
|
101
|
+
self.define_method(l.to_sym) do |message, progname = nil, &block|
|
102
|
+
self.send(:add, l.to_sym, message, progname, &block)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
private
|
107
|
+
|
108
|
+
def self.colorlevel level
|
109
|
+
level.colorize(
|
110
|
+
{
|
111
|
+
'DEBUG' => :blue,
|
112
|
+
'INFO' => :green,
|
113
|
+
'WARN' => :yellow,
|
114
|
+
'ERROR' => :red,
|
115
|
+
'FATAL' => { color: :light_red, mode: :bold },
|
116
|
+
'ANY' => :cyan
|
117
|
+
}[level.to_s.upcase] || :default)
|
118
|
+
end
|
119
|
+
|
120
|
+
def target_select slug
|
121
|
+
{
|
122
|
+
stdout: STDOUT,
|
123
|
+
stderr: STDERR
|
124
|
+
}[slug] || slug
|
125
|
+
end
|
126
|
+
|
127
|
+
def logger_level slug
|
128
|
+
if slug.is_a?(String) || slug.is_a?(Symbol)
|
129
|
+
{
|
130
|
+
debug: Logger::DEBUG,
|
131
|
+
info: Logger::INFO,
|
132
|
+
warn: Logger::WARN,
|
133
|
+
error: Logger::ERROR,
|
134
|
+
fatal: Logger::FATAL,
|
135
|
+
unknown: Logger::UNKNOWN,
|
136
|
+
any: -1
|
137
|
+
}[slug.to_s.downcase.to_sym] || Logger::UNKNOWN
|
138
|
+
else
|
139
|
+
slug
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
module Rbcli
|
145
|
+
@logger = nil
|
146
|
+
|
147
|
+
def self.start_logger target: STDOUT, level: :info, format: :display
|
148
|
+
@logger = Rbcli::Logger.new(target: target, level: level, format: format)
|
149
|
+
end
|
150
|
+
|
151
|
+
def self.log
|
152
|
+
self.start_logger if @logger.nil?
|
153
|
+
@logger
|
154
|
+
end
|
155
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# This file was obtained and modified from: https://github.com/busyloop/lolcat/blob/master/lib/lolcat/lol.rb
|
2
|
+
|
3
|
+
# Copyright (c) 2016, moe@busyloop.net
|
4
|
+
# All rights reserved.
|
5
|
+
#
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
7
|
+
# modification, are permitted provided that the following conditions are met:
|
8
|
+
# * Redistributions of source code must retain the above copyright
|
9
|
+
# notice, this list of conditions and the following disclaimer.
|
10
|
+
# * Redistributions in binary form must reproduce the above copyright
|
11
|
+
# notice, this list of conditions and the following disclaimer in the
|
12
|
+
# documentation and/or other materials provided with the distribution.
|
13
|
+
# * Neither the name of the lolcat nor the
|
14
|
+
# names of its contributors may be used to endorse or promote products
|
15
|
+
# derived from this software without specific prior written permission.
|
16
|
+
#
|
17
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
18
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
20
|
+
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
21
|
+
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
22
|
+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
23
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
24
|
+
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
26
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
require 'paint'
|
29
|
+
|
30
|
+
module Lol
|
31
|
+
ANSI_ESCAPE = /((?:\e(?:[ -\/]+.|[\]PX^_][^\a\e]*|\[[0-?]*.|.))*)(.?)/m
|
32
|
+
|
33
|
+
@os = 0
|
34
|
+
@paint_init = false
|
35
|
+
|
36
|
+
def self.makestr(str, opts = {})
|
37
|
+
@os = rand(256) unless @paint_init
|
38
|
+
set_mode(opts[:truecolor]) unless @paint_init
|
39
|
+
|
40
|
+
result = ''
|
41
|
+
filtered = str.scan(ANSI_ESCAPE)
|
42
|
+
filtered.each_with_index do |c, i|
|
43
|
+
# color = rainbow(opts[:freq], @os + i / opts[:spread])
|
44
|
+
color = rainbow(opts[:freq], (@os + i) / opts[:spread])
|
45
|
+
if opts[:invert] then
|
46
|
+
result += c[0] + Paint.color(nil, color) + c[1] + "\e[49m"
|
47
|
+
else
|
48
|
+
result += c[0] + Paint.color(color) + c[1] + "\e[39m"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
@os += opts[:slope]
|
52
|
+
result
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def self.set_mode(truecolor)
|
58
|
+
# @paint_mode_detected = Paint.mode
|
59
|
+
@paint_mode_detected = %w[truecolor 24bit].include?(ENV['COLORTERM']) ? 0xffffff : 256
|
60
|
+
Paint.mode = truecolor ? 0xffffff : @paint_mode_detected
|
61
|
+
STDERR.puts "DEBUG: Paint.mode = #{Paint.mode} (detected: #{@paint_mode_detected})" if ENV['LOLCAT_DEBUG']
|
62
|
+
@paint_init = true
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.rainbow(freq, i)
|
66
|
+
red = Math.sin(freq * i + 0) * 127 + 128
|
67
|
+
green = Math.sin(freq * i + 2 * Math::PI / 3) * 127 + 128
|
68
|
+
blue = Math.sin(freq * i + 4 * Math::PI / 3) * 127 + 128
|
69
|
+
"#%02X%02X%02X" % [red, green, blue]
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
Rbcli::Configurate.logger do
|
2
|
+
<%- if @showdocs -%>
|
3
|
+
##### Logger (Optional) #####
|
4
|
+
# The Rbcli logger is a wrapper around the standard Ruby `Logger` library
|
5
|
+
# It is recommended that - unless you want to use specialized output libraries (such as ncurses) - that all
|
6
|
+
# of your application output is directed through the logger. This will allow for easy formatting and redirection
|
7
|
+
# no matter how your application is run.
|
8
|
+
#
|
9
|
+
# Valid targets are: :stdout, :stderr, "/path/to/a/file", or an IO or StringIO object (Default: :stdout)
|
10
|
+
# Valid levels are: :debug, :info, :warn, :error, :fatal, :unknown, :any (Default: :info)
|
11
|
+
# Valid formats are: :display, :simple, :full, :ruby, :json, :apache, :lolcat (Default: :display)
|
12
|
+
#
|
13
|
+
# The first three formats are designed to cover most use cases:
|
14
|
+
# display: For display on a terminal, with user interaction
|
15
|
+
# simple: For display on a terminal, for a developer
|
16
|
+
# full: For logging to a file, or using log collection software
|
17
|
+
# The next three are for specialized integrations in case you already have log collection configured:
|
18
|
+
# ruby: Default ruby logger format
|
19
|
+
# json: Each line is a JSON object
|
20
|
+
# apache: Follows the standard Apache log format
|
21
|
+
# As for :lolcat... if you can't guess what it does then give it a shot
|
22
|
+
<%- end -%>
|
23
|
+
logger target: :stdout, level: :info, format: :display
|
24
|
+
<%- if @showdocs -%>
|
25
|
+
# Custom formats can also be defined here.
|
26
|
+
# Declaring a format here will not switch to it. However, if
|
27
|
+
# the `format` keyword is used without providing a Proc, it will switch
|
28
|
+
# to that format.
|
29
|
+
#
|
30
|
+
# Format switch: format :json
|
31
|
+
# Format definition: format :foo, Proc.new { |severity, datetime, progname, msg| "Foo! " + msg }
|
32
|
+
#
|
33
|
+
# You can also switch formats mid-execution by calling this method on
|
34
|
+
# the logger object itself.
|
35
|
+
#
|
36
|
+
# Rbcli.log.format :json
|
37
|
+
#
|
38
|
+
<%- end -%>
|
39
|
+
# format :foo, Proc.new { |severity, datetime, progname, msg| "Foo! " + msg }
|
40
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
##################################################################################
|
3
|
+
# Rbcli -- A framework for developing command line applications in Ruby #
|
4
|
+
# Copyright (C) 2024 Andrew Khoury <akhoury@live.com> #
|
5
|
+
##################################################################################
|
6
|
+
module Rbcli::Configurate::Cli
|
7
|
+
include Rbcli::Configurable
|
8
|
+
|
9
|
+
@defaults = {
|
10
|
+
appinfo: {
|
11
|
+
appname: EXECUTABLE,
|
12
|
+
version: nil,
|
13
|
+
author: nil,
|
14
|
+
email: nil,
|
15
|
+
copyright_year: nil,
|
16
|
+
license: nil,
|
17
|
+
helptext: nil
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
@defaults.keys.each do |namespace|
|
22
|
+
@defaults[namespace].each do |key, default|
|
23
|
+
Rbcli::Warehouse.set(key, default, namespace)
|
24
|
+
self.define_singleton_method(key) do |value|
|
25
|
+
Rbcli::Warehouse.set(key, value, namespace)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.opt * args
|
31
|
+
Rbcli::Parser.add_opt *args
|
32
|
+
end
|
33
|
+
end
|
@@ -66,7 +66,7 @@ module Optimist
|
|
66
66
|
else
|
67
67
|
lookup = type.to_sym
|
68
68
|
end
|
69
|
-
raise ArgumentError, "Unsupported argument type '#{type}', registry lookup '#{lookup}'" unless @registry.
|
69
|
+
raise ArgumentError, "Unsupported argument type '#{type}', registry lookup '#{lookup}'" unless @registry.key?(lookup)
|
70
70
|
return @registry[lookup].new
|
71
71
|
end
|
72
72
|
|
@@ -116,6 +116,7 @@ module Optimist
|
|
116
116
|
## [+:default+] Set the default value for an argument. Without a default value, the hash returned by #parse (and thus Optimist::options) will have a +nil+ value for this key unless the argument is given on the commandline. The argument type is derived automatically from the class of the default value given, so specifying a +:type+ is not necessary if a +:default+ is given. (But see below for an important caveat when +:multi+: is specified too.) If the argument is a flag, and the default is set to +true+, then if it is specified on the the commandline the value will be +false+.
|
117
117
|
## [+:required+] If set to +true+, the argument must be provided on the commandline.
|
118
118
|
## [+:multi+] If set to +true+, allows multiple occurrences of the option on the commandline. Otherwise, only a single instance of the option is allowed. (Note that this is different from taking multiple parameters. See below.)
|
119
|
+
## [+:permitted+] Specify an Array of permitted values for an option. If the user provides a value outside this list, an error is thrown.
|
119
120
|
##
|
120
121
|
## Note that there are two types of argument multiplicity: an argument
|
121
122
|
## can take multiple values, e.g. "--arg 1 2 3". An argument can also
|
@@ -184,6 +185,7 @@ module Optimist
|
|
184
185
|
def banner(s)
|
185
186
|
@order << [:text, s]
|
186
187
|
end
|
188
|
+
|
187
189
|
alias_method :text, :banner
|
188
190
|
|
189
191
|
## Marks two (or more!) options as requiring each other. Only handles
|
@@ -242,7 +244,7 @@ module Optimist
|
|
242
244
|
vals = {}
|
243
245
|
required = {}
|
244
246
|
|
245
|
-
opt :version, "Print version and exit" if @version && !
|
247
|
+
opt :version, "Print version and exit" if @version && !(@specs[:version] || @long["version"])
|
246
248
|
opt :help, "Show this message" unless @specs[:help] || @long["help"]
|
247
249
|
|
248
250
|
@specs.each do |sym, opts|
|
@@ -265,9 +267,9 @@ module Optimist
|
|
265
267
|
end
|
266
268
|
|
267
269
|
sym = case arg
|
268
|
-
when /^-([^-])$/
|
269
|
-
when /^--([^-]\S*)$/
|
270
|
-
else
|
270
|
+
when /^-([^-])$/ then @short[$1]
|
271
|
+
when /^--([^-]\S*)$/ then @long[$1] || @long["no-#{$1}"]
|
272
|
+
else raise CommandlineError, "invalid argument syntax: '#{arg}'"
|
271
273
|
end
|
272
274
|
|
273
275
|
sym = nil if arg =~ /--no-/ # explicitly invalidate --no-no- arguments
|
@@ -294,10 +296,10 @@ module Optimist
|
|
294
296
|
|
295
297
|
unless params.empty?
|
296
298
|
if @specs[sym].single_arg?
|
297
|
-
given_args[sym][:params] << params[0, 1]
|
299
|
+
given_args[sym][:params] << params[0, 1] # take the first parameter
|
298
300
|
num_params_taken = 1
|
299
301
|
elsif @specs[sym].multi_arg?
|
300
|
-
given_args[sym][:params] << params
|
302
|
+
given_args[sym][:params] << params # take all the parameters
|
301
303
|
num_params_taken = params.size
|
302
304
|
end
|
303
305
|
end
|
@@ -348,13 +350,14 @@ module Optimist
|
|
348
350
|
vals[sym] = opts.parse(params, negative_given)
|
349
351
|
|
350
352
|
if opts.single_arg?
|
351
|
-
if opts.multi?
|
353
|
+
if opts.multi? # multiple options, each with a single parameter
|
352
354
|
vals[sym] = vals[sym].map { |p| p[0] }
|
353
|
-
else
|
355
|
+
else
|
356
|
+
# single parameter
|
354
357
|
vals[sym] = vals[sym][0][0]
|
355
358
|
end
|
356
359
|
elsif opts.multi_arg? && !opts.multi?
|
357
|
-
vals[sym] = vals[sym][0]
|
360
|
+
vals[sym] = vals[sym][0] # single option, with multiple parameters
|
358
361
|
end
|
359
362
|
# else: multiple options, with multiple parameters
|
360
363
|
|
@@ -372,6 +375,7 @@ module Optimist
|
|
372
375
|
self[m] || self[m.to_s]
|
373
376
|
end
|
374
377
|
end
|
378
|
+
|
375
379
|
vals
|
376
380
|
end
|
377
381
|
|
@@ -429,9 +433,11 @@ module Optimist
|
|
429
433
|
rescue Errno::ENOENT
|
430
434
|
80
|
431
435
|
end
|
436
|
+
|
432
437
|
private :legacy_width
|
433
438
|
|
434
|
-
def wrap(str, opts = {})
|
439
|
+
def wrap(str, opts = {})
|
440
|
+
# :nodoc:
|
435
441
|
if str == ""
|
436
442
|
[""]
|
437
443
|
else
|
@@ -587,7 +593,10 @@ module Optimist
|
|
587
593
|
## instance_eval but with ability to handle block arguments
|
588
594
|
## thanks to _why: http://redhanded.hobix.com/inspect/aBlockCostume.html
|
589
595
|
def cloaker(&b)
|
590
|
-
(
|
596
|
+
(
|
597
|
+
class << self
|
598
|
+
self;
|
599
|
+
end).class_eval do
|
591
600
|
define_method :cloaker_, &b
|
592
601
|
meth = instance_method :cloaker_
|
593
602
|
remove_method :cloaker_
|
@@ -621,33 +630,55 @@ module Optimist
|
|
621
630
|
end
|
622
631
|
|
623
632
|
## Indicates a flag option, which is an option without an argument
|
624
|
-
def flag?
|
633
|
+
def flag?
|
634
|
+
false;
|
635
|
+
end
|
636
|
+
|
625
637
|
def single_arg?
|
626
638
|
!self.multi_arg? && !self.flag?
|
627
639
|
end
|
628
640
|
|
629
|
-
def multi
|
641
|
+
def multi
|
642
|
+
@multi_given;
|
643
|
+
end
|
644
|
+
|
630
645
|
alias multi? multi
|
631
646
|
|
632
647
|
## Indicates that this is a multivalued (Array type) argument
|
633
|
-
def multi_arg?
|
648
|
+
def multi_arg?
|
649
|
+
false;
|
650
|
+
end
|
651
|
+
|
634
652
|
## note: Option-Types with both multi_arg? and flag? false are single-parameter (normal) options.
|
635
653
|
|
636
|
-
def array_default?
|
654
|
+
def array_default?
|
655
|
+
self.default.kind_of?(Array);
|
656
|
+
end
|
637
657
|
|
638
|
-
def short?
|
658
|
+
def short?
|
659
|
+
short && short != :none;
|
660
|
+
end
|
661
|
+
|
662
|
+
def callback
|
663
|
+
opts(:callback);
|
664
|
+
end
|
639
665
|
|
640
|
-
def
|
641
|
-
|
666
|
+
def desc
|
667
|
+
opts(:desc);
|
668
|
+
end
|
642
669
|
|
643
|
-
def required?
|
670
|
+
def required?
|
671
|
+
opts(:required);
|
672
|
+
end
|
644
673
|
|
645
674
|
def parse(_paramlist, _neg_given)
|
646
675
|
raise NotImplementedError, "parse must be overridden for newly registered type"
|
647
676
|
end
|
648
677
|
|
649
678
|
# provide type-format string. default to empty, but user should probably override it
|
650
|
-
def type_format
|
679
|
+
def type_format
|
680
|
+
"";
|
681
|
+
end
|
651
682
|
|
652
683
|
def educate
|
653
684
|
(short? ? "-#{short}, " : " ") + "--#{long}" + type_format + (flag? && default ? ", --no-#{long}" : "")
|
@@ -664,9 +695,9 @@ module Optimist
|
|
664
695
|
## Generate the default value string for the educate line
|
665
696
|
private def default_description_str str
|
666
697
|
default_s = case default
|
667
|
-
when $stdout
|
668
|
-
when $stdin
|
669
|
-
when $stderr
|
698
|
+
when $stdout then '<stdout>'
|
699
|
+
when $stdin then '<stdin>'
|
700
|
+
when $stderr then '<stderr>'
|
670
701
|
when Array
|
671
702
|
default.join(', ')
|
672
703
|
else
|
@@ -680,9 +711,9 @@ module Optimist
|
|
680
711
|
private def permitted_description_str str
|
681
712
|
permitted_s = permitted.map do |p|
|
682
713
|
case p
|
683
|
-
when $stdout
|
684
|
-
when $stdin
|
685
|
-
when $stderr
|
714
|
+
when $stdout then '<stdout>'
|
715
|
+
when $stdin then '<stdin>'
|
716
|
+
when $stderr then '<stderr>'
|
686
717
|
else
|
687
718
|
p.to_s
|
688
719
|
end
|
@@ -705,7 +736,7 @@ module Optimist
|
|
705
736
|
# to +Optimist::opt+. This is trickier in Optimist, than other cmdline
|
706
737
|
# parsers (e.g. Slop) because we allow the +default:+ to be able to
|
707
738
|
# set the option's type.
|
708
|
-
def self.create(name, desc="", opts={}, settings={})
|
739
|
+
def self.create(name, desc = "", opts = {}, settings = {})
|
709
740
|
|
710
741
|
opttype = Optimist::Parser.registry_getopttype(opts[:type])
|
711
742
|
opttype_from_default = get_klass_from_default(opts, opttype)
|
@@ -775,17 +806,17 @@ module Optimist
|
|
775
806
|
lopt = lopt ? lopt.to_s : name.to_s.gsub("_", "-")
|
776
807
|
lopt = case lopt
|
777
808
|
when /^--([^-].*)$/ then $1
|
778
|
-
when /^[^-]/
|
779
|
-
else
|
809
|
+
when /^[^-]/ then lopt
|
810
|
+
else raise ArgumentError, "invalid long option name #{lopt.inspect}"
|
780
811
|
end
|
781
812
|
end
|
782
813
|
|
783
814
|
def self.handle_short_opt(sopt)
|
784
815
|
sopt = sopt.to_s if sopt && sopt != :none
|
785
816
|
sopt = case sopt
|
786
|
-
when /^-(.)$/
|
817
|
+
when /^-(.)$/ then $1
|
787
818
|
when nil, :none, /^.$/ then sopt
|
788
|
-
else
|
819
|
+
else raise ArgumentError, "invalid short option name '#{sopt.inspect}'"
|
789
820
|
end
|
790
821
|
|
791
822
|
if sopt
|
@@ -799,11 +830,16 @@ module Optimist
|
|
799
830
|
# Flag option. Has no arguments. Can be negated with "no-".
|
800
831
|
class BooleanOption < Option
|
801
832
|
register_alias :flag, :bool, :boolean, :trueclass, :falseclass
|
833
|
+
|
802
834
|
def initialize
|
803
835
|
super()
|
804
836
|
@default = false
|
805
837
|
end
|
806
|
-
|
838
|
+
|
839
|
+
def flag?
|
840
|
+
true;
|
841
|
+
end
|
842
|
+
|
807
843
|
def parse(_paramlist, neg_given)
|
808
844
|
return _paramlist[0] if @multi_given
|
809
845
|
return(self.name.to_s =~ /^no_/ ? neg_given : !neg_given)
|
@@ -813,7 +849,11 @@ module Optimist
|
|
813
849
|
# Floating point number option class.
|
814
850
|
class FloatOption < Option
|
815
851
|
register_alias :float, :double
|
816
|
-
|
852
|
+
|
853
|
+
def type_format
|
854
|
+
"=<f>";
|
855
|
+
end
|
856
|
+
|
817
857
|
def parse(paramlist, _neg_given)
|
818
858
|
paramlist.map do |pg|
|
819
859
|
pg.map do |param|
|
@@ -827,7 +867,11 @@ module Optimist
|
|
827
867
|
# Integer number option class.
|
828
868
|
class IntegerOption < Option
|
829
869
|
register_alias :int, :integer, :fixnum
|
830
|
-
|
870
|
+
|
871
|
+
def type_format
|
872
|
+
"=<i>";
|
873
|
+
end
|
874
|
+
|
831
875
|
def parse(paramlist, _neg_given)
|
832
876
|
paramlist.map do |pg|
|
833
877
|
pg.map do |param|
|
@@ -843,7 +887,11 @@ module Optimist
|
|
843
887
|
# in the case of file-paths given to it.
|
844
888
|
class IOOption < Option
|
845
889
|
register_alias :io
|
846
|
-
|
890
|
+
|
891
|
+
def type_format
|
892
|
+
"=<filename/uri>";
|
893
|
+
end
|
894
|
+
|
847
895
|
def parse(paramlist, _neg_given)
|
848
896
|
paramlist.map do |pg|
|
849
897
|
pg.map do |param|
|
@@ -865,7 +913,11 @@ module Optimist
|
|
865
913
|
# Option class for handling Strings.
|
866
914
|
class StringOption < Option
|
867
915
|
register_alias :string
|
868
|
-
|
916
|
+
|
917
|
+
def type_format
|
918
|
+
"=<s>";
|
919
|
+
end
|
920
|
+
|
869
921
|
def parse(paramlist, _neg_given)
|
870
922
|
paramlist.map { |pg| pg.map(&:to_s) }
|
871
923
|
end
|
@@ -874,7 +926,11 @@ module Optimist
|
|
874
926
|
# Option for dates. Uses Chronic if it exists.
|
875
927
|
class DateOption < Option
|
876
928
|
register_alias :date
|
877
|
-
|
929
|
+
|
930
|
+
def type_format
|
931
|
+
"=<date>";
|
932
|
+
end
|
933
|
+
|
878
934
|
def parse(paramlist, _neg_given)
|
879
935
|
paramlist.map do |pg|
|
880
936
|
pg.map do |param|
|
@@ -903,36 +959,66 @@ module Optimist
|
|
903
959
|
# Option class for handling multiple Integers
|
904
960
|
class IntegerArrayOption < IntegerOption
|
905
961
|
register_alias :fixnums, :ints, :integers
|
906
|
-
|
907
|
-
def
|
962
|
+
|
963
|
+
def type_format
|
964
|
+
"=<i+>";
|
965
|
+
end
|
966
|
+
|
967
|
+
def multi_arg?
|
968
|
+
true;
|
969
|
+
end
|
908
970
|
end
|
909
971
|
|
910
972
|
# Option class for handling multiple Floats
|
911
973
|
class FloatArrayOption < FloatOption
|
912
974
|
register_alias :doubles, :floats
|
913
|
-
|
914
|
-
def
|
975
|
+
|
976
|
+
def type_format
|
977
|
+
"=<f+>";
|
978
|
+
end
|
979
|
+
|
980
|
+
def multi_arg?
|
981
|
+
true;
|
982
|
+
end
|
915
983
|
end
|
916
984
|
|
917
985
|
# Option class for handling multiple Strings
|
918
986
|
class StringArrayOption < StringOption
|
919
987
|
register_alias :strings
|
920
|
-
|
921
|
-
def
|
988
|
+
|
989
|
+
def type_format
|
990
|
+
"=<s+>";
|
991
|
+
end
|
992
|
+
|
993
|
+
def multi_arg?
|
994
|
+
true;
|
995
|
+
end
|
922
996
|
end
|
923
997
|
|
924
998
|
# Option class for handling multiple dates
|
925
999
|
class DateArrayOption < DateOption
|
926
1000
|
register_alias :dates
|
927
|
-
|
928
|
-
def
|
1001
|
+
|
1002
|
+
def type_format
|
1003
|
+
"=<date+>";
|
1004
|
+
end
|
1005
|
+
|
1006
|
+
def multi_arg?
|
1007
|
+
true;
|
1008
|
+
end
|
929
1009
|
end
|
930
1010
|
|
931
1011
|
# Option class for handling Files/URLs via 'open'
|
932
1012
|
class IOArrayOption < IOOption
|
933
1013
|
register_alias :ios
|
934
|
-
|
935
|
-
def
|
1014
|
+
|
1015
|
+
def type_format
|
1016
|
+
"=<filename/uri+>";
|
1017
|
+
end
|
1018
|
+
|
1019
|
+
def multi_arg?
|
1020
|
+
true;
|
1021
|
+
end
|
936
1022
|
end
|
937
1023
|
|
938
1024
|
## The easy, syntactic-sugary entry method into Optimist. Creates a Parser,
|