@shopify/cli-kit 3.69.3 → 3.70.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.
- package/{assets/cli-ruby/LICENSE → LICENSE} +0 -2
- package/dist/cli/api/graphql/admin/generated/get_theme_file_bodies.d.ts +41 -0
- package/dist/cli/api/graphql/admin/generated/get_theme_file_bodies.js +165 -0
- package/dist/cli/api/graphql/admin/generated/get_theme_file_bodies.js.map +1 -0
- package/dist/cli/api/graphql/admin/generated/get_theme_file_checksums.d.ts +29 -0
- package/dist/cli/api/graphql/admin/generated/get_theme_file_checksums.js +100 -0
- package/dist/cli/api/graphql/admin/generated/get_theme_file_checksums.js.map +1 -0
- package/dist/cli/api/graphql/admin/generated/theme_delete.d.ts +17 -0
- package/dist/cli/api/graphql/admin/generated/theme_delete.js +53 -0
- package/dist/cli/api/graphql/admin/generated/theme_delete.js.map +1 -0
- package/dist/cli/api/graphql/admin/generated/theme_publish.d.ts +21 -0
- package/dist/cli/api/graphql/admin/generated/theme_publish.js +65 -0
- package/dist/cli/api/graphql/admin/generated/theme_publish.js.map +1 -0
- package/dist/cli/api/graphql/admin/generated/theme_update.d.ts +23 -0
- package/dist/cli/api/graphql/admin/generated/theme_update.js +75 -0
- package/dist/cli/api/graphql/admin/generated/theme_update.js.map +1 -0
- package/dist/private/node/api/graphql.d.ts +2 -2
- package/dist/private/node/api/graphql.js +4 -4
- package/dist/private/node/api/graphql.js.map +1 -1
- package/dist/private/node/api/headers.js +1 -1
- package/dist/private/node/api/headers.js.map +1 -1
- package/dist/private/node/api/rest.d.ts +1 -2
- package/dist/private/node/api/rest.js +2 -3
- package/dist/private/node/api/rest.js.map +1 -1
- package/dist/private/node/api.js +12 -1
- package/dist/private/node/api.js.map +1 -1
- package/dist/private/node/conf-store.d.ts +9 -4
- package/dist/private/node/conf-store.js +8 -6
- package/dist/private/node/conf-store.js.map +1 -1
- package/dist/private/node/constants.d.ts +1 -0
- package/dist/private/node/constants.js +1 -0
- package/dist/private/node/constants.js.map +1 -1
- package/dist/private/node/session/schema.d.ts +40 -40
- package/dist/private/node/ui/components/ConcurrentOutput.d.ts +1 -0
- package/dist/private/node/ui/components/ConcurrentOutput.js +4 -2
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
- package/dist/public/common/version.d.ts +1 -1
- package/dist/public/common/version.js +1 -1
- package/dist/public/common/version.js.map +1 -1
- package/dist/public/node/analytics.js +1 -2
- package/dist/public/node/analytics.js.map +1 -1
- package/dist/public/node/api/admin.d.ts +2 -1
- package/dist/public/node/api/admin.js +25 -9
- package/dist/public/node/api/admin.js.map +1 -1
- package/dist/public/node/api/graphql.js +1 -1
- package/dist/public/node/api/graphql.js.map +1 -1
- package/dist/public/node/base-command.js +4 -0
- package/dist/public/node/base-command.js.map +1 -1
- package/dist/public/node/cli.d.ts +4 -0
- package/dist/public/node/cli.js +7 -1
- package/dist/public/node/cli.js.map +1 -1
- package/dist/public/node/context/local.js +7 -0
- package/dist/public/node/context/local.js.map +1 -1
- package/dist/public/node/error-handler.js +1 -1
- package/dist/public/node/error-handler.js.map +1 -1
- package/dist/public/node/error.js +4 -13
- package/dist/public/node/error.js.map +1 -1
- package/dist/public/node/global-context.d.ts +15 -0
- package/dist/public/node/global-context.js +29 -0
- package/dist/public/node/global-context.js.map +1 -0
- package/dist/public/node/is-global.js +2 -1
- package/dist/public/node/is-global.js.map +1 -1
- package/dist/public/node/node-package-manager.js +1 -1
- package/dist/public/node/node-package-manager.js.map +1 -1
- package/dist/public/node/notifications-system.d.ts +191 -0
- package/dist/public/node/notifications-system.js +234 -0
- package/dist/public/node/notifications-system.js.map +1 -0
- package/dist/public/node/themes/api.d.ts +4 -12
- package/dist/public/node/themes/api.js +162 -32
- package/dist/public/node/themes/api.js.map +1 -1
- package/dist/public/node/themes/types.d.ts +1 -0
- package/dist/public/node/themes/types.js.map +1 -1
- package/dist/public/node/themes/utils.d.ts +2 -0
- package/dist/public/node/themes/utils.js +11 -0
- package/dist/public/node/themes/utils.js.map +1 -1
- package/dist/public/node/version.d.ts +13 -0
- package/dist/public/node/version.js +38 -0
- package/dist/public/node/version.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -5
- package/assets/cli-ruby/.devcontainer.json +0 -5
- package/assets/cli-ruby/.rubocop.yml +0 -102
- package/assets/cli-ruby/.rubocop_todo.yml +0 -24
- package/assets/cli-ruby/CHANGELOG.md +0 -634
- package/assets/cli-ruby/CONTRIBUTING.md +0 -3
- package/assets/cli-ruby/Codespace.dockerfile +0 -35
- package/assets/cli-ruby/Gemfile +0 -32
- package/assets/cli-ruby/README.md +0 -30
- package/assets/cli-ruby/Rakefile +0 -167
- package/assets/cli-ruby/SECURITY.md +0 -59
- package/assets/cli-ruby/Tests.dockerfile +0 -35
- package/assets/cli-ruby/assets/logo.png +0 -0
- package/assets/cli-ruby/bin/console +0 -11
- package/assets/cli-ruby/bin/load_shopify.rb +0 -22
- package/assets/cli-ruby/bin/shopify +0 -67
- package/assets/cli-ruby/bin/shopify.bat +0 -3
- package/assets/cli-ruby/dev.yml +0 -29
- package/assets/cli-ruby/docs/README.md +0 -13
- package/assets/cli-ruby/docs/contributors/testing.md +0 -27
- package/assets/cli-ruby/docs/users/installation.md +0 -3
- package/assets/cli-ruby/docs/users/migrate-from-themekit.md +0 -18
- package/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.2.0.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.2.1.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.3.0.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.2.0.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.2.1.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.3.0.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.2.0.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.2.1.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.3.0.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.2.0.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.2.1.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.3.0.gz.sha256 +0 -1
- package/assets/cli-ruby/ext/javy/javy.rb +0 -204
- package/assets/cli-ruby/ext/javy/version +0 -1
- package/assets/cli-ruby/ext/shopify-extensions/extconf.rb +0 -21
- package/assets/cli-ruby/ext/shopify-extensions/shopify_extensions.rb +0 -152
- package/assets/cli-ruby/ext/shopify-extensions/version +0 -1
- package/assets/cli-ruby/features/support/assertions.rb +0 -17
- package/assets/cli-ruby/features/support/cli.rb +0 -7
- package/assets/cli-ruby/features/support/process.rb +0 -27
- package/assets/cli-ruby/features/support/requires.rb +0 -3
- package/assets/cli-ruby/lib/docgen/class_template.md.erb +0 -81
- package/assets/cli-ruby/lib/docgen/index_template.md.erb +0 -5
- package/assets/cli-ruby/lib/docgen/markdown.rb +0 -101
- package/assets/cli-ruby/lib/graphql/admin_introspection.graphql +0 -87
- package/assets/cli-ruby/lib/graphql/all_organizations.graphql +0 -19
- package/assets/cli-ruby/lib/graphql/all_orgs_with_apps.graphql +0 -30
- package/assets/cli-ruby/lib/graphql/api_versions.graphql +0 -6
- package/assets/cli-ruby/lib/graphql/convert_dev_to_test_store.graphql +0 -10
- package/assets/cli-ruby/lib/graphql/create_app.graphql +0 -20
- package/assets/cli-ruby/lib/graphql/create_customer.graphql +0 -9
- package/assets/cli-ruby/lib/graphql/create_draft_order.graphql +0 -8
- package/assets/cli-ruby/lib/graphql/create_product.graphql +0 -9
- package/assets/cli-ruby/lib/graphql/extension_create.graphql +0 -37
- package/assets/cli-ruby/lib/graphql/extension_update_draft.graphql +0 -19
- package/assets/cli-ruby/lib/graphql/fetch_specifications.graphql +0 -14
- package/assets/cli-ruby/lib/graphql/find_organization.graphql +0 -18
- package/assets/cli-ruby/lib/graphql/find_organization_with_apps.graphql +0 -20
- package/assets/cli-ruby/lib/graphql/get_app_by_api_key.graphql +0 -9
- package/assets/cli-ruby/lib/graphql/get_app_urls.graphql +0 -6
- package/assets/cli-ruby/lib/graphql/get_extension_registrations.graphql +0 -28
- package/assets/cli-ruby/lib/graphql/get_variant_id.graphql +0 -16
- package/assets/cli-ruby/lib/graphql/update_dashboard_urls.graphql +0 -8
- package/assets/cli-ruby/lib/project_types/extension/cli.rb +0 -75
- package/assets/cli-ruby/lib/project_types/extension/commands/extension_command.rb +0 -29
- package/assets/cli-ruby/lib/project_types/extension/commands/serve.rb +0 -164
- package/assets/cli-ruby/lib/project_types/extension/errors.rb +0 -9
- package/assets/cli-ruby/lib/project_types/extension/extension_project.rb +0 -151
- package/assets/cli-ruby/lib/project_types/extension/extension_project_keys.rb +0 -12
- package/assets/cli-ruby/lib/project_types/extension/features/argo.rb +0 -50
- package/assets/cli-ruby/lib/project_types/extension/features/argo_config.rb +0 -59
- package/assets/cli-ruby/lib/project_types/extension/features/argo_dependencies.rb +0 -28
- package/assets/cli-ruby/lib/project_types/extension/features/argo_runtime.rb +0 -15
- package/assets/cli-ruby/lib/project_types/extension/features/argo_serve.rb +0 -115
- package/assets/cli-ruby/lib/project_types/extension/features/argo_setup.rb +0 -54
- package/assets/cli-ruby/lib/project_types/extension/features/argo_setup_step.rb +0 -31
- package/assets/cli-ruby/lib/project_types/extension/features/argo_setup_steps.rb +0 -51
- package/assets/cli-ruby/lib/project_types/extension/features/runtimes/admin.rb +0 -29
- package/assets/cli-ruby/lib/project_types/extension/features/runtimes/base.rb +0 -19
- package/assets/cli-ruby/lib/project_types/extension/features/runtimes/checkout_post_purchase.rb +0 -23
- package/assets/cli-ruby/lib/project_types/extension/features/runtimes/checkout_ui_extension.rb +0 -29
- package/assets/cli-ruby/lib/project_types/extension/loaders/project.rb +0 -50
- package/assets/cli-ruby/lib/project_types/extension/loaders/specification_handler.rb +0 -22
- package/assets/cli-ruby/lib/project_types/extension/messages/message_loading.rb +0 -34
- package/assets/cli-ruby/lib/project_types/extension/messages/messages.rb +0 -320
- package/assets/cli-ruby/lib/project_types/extension/models/app.rb +0 -14
- package/assets/cli-ruby/lib/project_types/extension/models/lazy_specification_handler.rb +0 -12
- package/assets/cli-ruby/lib/project_types/extension/models/specification.rb +0 -41
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/default.rb +0 -145
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +0 -134
- package/assets/cli-ruby/lib/project_types/extension/models/specifications.rb +0 -91
- package/assets/cli-ruby/lib/project_types/extension/models/validation_error.rb +0 -17
- package/assets/cli-ruby/lib/project_types/extension/models/version.rb +0 -15
- package/assets/cli-ruby/lib/project_types/extension/tasks/configure_features.rb +0 -73
- package/assets/cli-ruby/lib/project_types/extension/tasks/configure_options.rb +0 -21
- package/assets/cli-ruby/lib/project_types/extension/tasks/converters/validation_error_converter.rb +0 -25
- package/assets/cli-ruby/lib/project_types/extension/tasks/converters/version_converter.rb +0 -28
- package/assets/cli-ruby/lib/project_types/extension/tasks/fetch_specifications.rb +0 -21
- package/assets/cli-ruby/lib/project_types/node/cli.rb +0 -12
- package/assets/cli-ruby/lib/project_types/node/forms/create.rb +0 -45
- package/assets/cli-ruby/lib/project_types/node/messages/messages.rb +0 -33
- package/assets/cli-ruby/lib/project_types/php/cli.rb +0 -16
- package/assets/cli-ruby/lib/project_types/php/forms/create.rb +0 -44
- package/assets/cli-ruby/lib/project_types/php/messages/messages.rb +0 -29
- package/assets/cli-ruby/lib/project_types/rails/cli.rb +0 -15
- package/assets/cli-ruby/lib/project_types/rails/forms/create.rb +0 -75
- package/assets/cli-ruby/lib/project_types/rails/gem.rb +0 -110
- package/assets/cli-ruby/lib/project_types/rails/messages/messages.rb +0 -101
- package/assets/cli-ruby/lib/project_types/script/cli.rb +0 -27
- package/assets/cli-ruby/lib/project_types/script/commands/connect.rb +0 -16
- package/assets/cli-ruby/lib/project_types/script/commands/create.rb +0 -24
- package/assets/cli-ruby/lib/project_types/script/commands/javy.rb +0 -24
- package/assets/cli-ruby/lib/project_types/script/commands/push.rb +0 -26
- package/assets/cli-ruby/lib/project_types/script/loaders/project.rb +0 -46
- package/assets/cli-ruby/lib/project_types/script/loaders/specification_handler.rb +0 -22
- package/assets/cli-ruby/lib/project_types/script/messages/messages.rb +0 -11
- package/assets/cli-ruby/lib/project_types/theme/cli.rb +0 -33
- package/assets/cli-ruby/lib/project_types/theme/commands/common/root_helper.rb +0 -94
- package/assets/cli-ruby/lib/project_types/theme/commands/common/shop_helper.rb +0 -13
- package/assets/cli-ruby/lib/project_types/theme/commands/console.rb +0 -23
- package/assets/cli-ruby/lib/project_types/theme/commands/delete.rb +0 -70
- package/assets/cli-ruby/lib/project_types/theme/commands/init.rb +0 -46
- package/assets/cli-ruby/lib/project_types/theme/commands/list.rb +0 -33
- package/assets/cli-ruby/lib/project_types/theme/commands/open.rb +0 -73
- package/assets/cli-ruby/lib/project_types/theme/commands/package.rb +0 -73
- package/assets/cli-ruby/lib/project_types/theme/commands/publish.rb +0 -49
- package/assets/cli-ruby/lib/project_types/theme/commands/pull.rb +0 -118
- package/assets/cli-ruby/lib/project_types/theme/commands/push.rb +0 -160
- package/assets/cli-ruby/lib/project_types/theme/commands/serve.rb +0 -91
- package/assets/cli-ruby/lib/project_types/theme/commands/share.rb +0 -62
- package/assets/cli-ruby/lib/project_types/theme/commands/token.rb +0 -22
- package/assets/cli-ruby/lib/project_types/theme/conversions/base_glob.rb +0 -65
- package/assets/cli-ruby/lib/project_types/theme/conversions/ignore_glob.rb +0 -15
- package/assets/cli-ruby/lib/project_types/theme/conversions/include_glob.rb +0 -15
- package/assets/cli-ruby/lib/project_types/theme/forms/confirm_store.rb +0 -15
- package/assets/cli-ruby/lib/project_types/theme/forms/select.rb +0 -34
- package/assets/cli-ruby/lib/project_types/theme/messages/messages.rb +0 -429
- package/assets/cli-ruby/lib/project_types/theme/models/specification_handlers/theme.rb +0 -19
- package/assets/cli-ruby/lib/project_types/theme/presenters/theme_presenter.rb +0 -48
- package/assets/cli-ruby/lib/project_types/theme/presenters/themes_presenter.rb +0 -29
- package/assets/cli-ruby/lib/project_types/theme/ui/sync_progress_bar.rb +0 -20
- package/assets/cli-ruby/lib/rubygems_plugin.rb +0 -26
- package/assets/cli-ruby/lib/shopify_cli/admin_api.rb +0 -160
- package/assets/cli-ruby/lib/shopify_cli/api.rb +0 -130
- package/assets/cli-ruby/lib/shopify_cli/command/project_command.rb +0 -31
- package/assets/cli-ruby/lib/shopify_cli/command/sub_command.rb +0 -20
- package/assets/cli-ruby/lib/shopify_cli/command.rb +0 -166
- package/assets/cli-ruby/lib/shopify_cli/commands.rb +0 -21
- package/assets/cli-ruby/lib/shopify_cli/constants.rb +0 -101
- package/assets/cli-ruby/lib/shopify_cli/context.rb +0 -709
- package/assets/cli-ruby/lib/shopify_cli/core/cli_version.rb +0 -20
- package/assets/cli-ruby/lib/shopify_cli/core/entry_point.rb +0 -64
- package/assets/cli-ruby/lib/shopify_cli/core/executor.rb +0 -23
- package/assets/cli-ruby/lib/shopify_cli/core/finalize.rb +0 -13
- package/assets/cli-ruby/lib/shopify_cli/core/monorail.rb +0 -122
- package/assets/cli-ruby/lib/shopify_cli/core.rb +0 -8
- package/assets/cli-ruby/lib/shopify_cli/db.rb +0 -114
- package/assets/cli-ruby/lib/shopify_cli/environment.rb +0 -217
- package/assets/cli-ruby/lib/shopify_cli/exception_reporter.rb +0 -80
- package/assets/cli-ruby/lib/shopify_cli/feature.rb +0 -95
- package/assets/cli-ruby/lib/shopify_cli/file_system_listener.rb +0 -30
- package/assets/cli-ruby/lib/shopify_cli/form.rb +0 -42
- package/assets/cli-ruby/lib/shopify_cli/git.rb +0 -320
- package/assets/cli-ruby/lib/shopify_cli/github/issue_url_generator.rb +0 -30
- package/assets/cli-ruby/lib/shopify_cli/github.rb +0 -5
- package/assets/cli-ruby/lib/shopify_cli/helpers/haikunator.rb +0 -92
- package/assets/cli-ruby/lib/shopify_cli/helpers.rb +0 -5
- package/assets/cli-ruby/lib/shopify_cli/http_request.rb +0 -43
- package/assets/cli-ruby/lib/shopify_cli/identity_auth/env_auth_token.rb +0 -34
- package/assets/cli-ruby/lib/shopify_cli/identity_auth.rb +0 -332
- package/assets/cli-ruby/lib/shopify_cli/js_system.rb +0 -115
- package/assets/cli-ruby/lib/shopify_cli/lazy_delegator.rb +0 -55
- package/assets/cli-ruby/lib/shopify_cli/messages/messages.rb +0 -863
- package/assets/cli-ruby/lib/shopify_cli/method_object.rb +0 -123
- package/assets/cli-ruby/lib/shopify_cli/migrator/migration.rb +0 -27
- package/assets/cli-ruby/lib/shopify_cli/migrator/migrations/1631709766_noop.rb +0 -13
- package/assets/cli-ruby/lib/shopify_cli/migrator/migrations/1633691650_merge_reporting_configuration.rb +0 -41
- package/assets/cli-ruby/lib/shopify_cli/migrator.rb +0 -46
- package/assets/cli-ruby/lib/shopify_cli/options.rb +0 -40
- package/assets/cli-ruby/lib/shopify_cli/partners_api/app_extensions/job.rb +0 -36
- package/assets/cli-ruby/lib/shopify_cli/partners_api/app_extensions.rb +0 -46
- package/assets/cli-ruby/lib/shopify_cli/partners_api/organizations.rb +0 -45
- package/assets/cli-ruby/lib/shopify_cli/partners_api.rb +0 -91
- package/assets/cli-ruby/lib/shopify_cli/project.rb +0 -199
- package/assets/cli-ruby/lib/shopify_cli/project_type.rb +0 -66
- package/assets/cli-ruby/lib/shopify_cli/reporting_configuration_controller.rb +0 -29
- package/assets/cli-ruby/lib/shopify_cli/resolve_constant.rb +0 -25
- package/assets/cli-ruby/lib/shopify_cli/resources/env_file.rb +0 -108
- package/assets/cli-ruby/lib/shopify_cli/resources.rb +0 -5
- package/assets/cli-ruby/lib/shopify_cli/result.rb +0 -448
- package/assets/cli-ruby/lib/shopify_cli/shopifolk.rb +0 -82
- package/assets/cli-ruby/lib/shopify_cli/task.rb +0 -20
- package/assets/cli-ruby/lib/shopify_cli/tasks/confirm_store.rb +0 -18
- package/assets/cli-ruby/lib/shopify_cli/tasks/create_api_client.rb +0 -40
- package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_authenticated.rb +0 -19
- package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_dev_store.rb +0 -41
- package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_env.rb +0 -90
- package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_git_dependency.rb +0 -14
- package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_loopback_url.rb +0 -20
- package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_project_type.rb +0 -14
- package/assets/cli-ruby/lib/shopify_cli/tasks/select_org_and_shop.rb +0 -81
- package/assets/cli-ruby/lib/shopify_cli/tasks/update_dashboard_urls.rb +0 -57
- package/assets/cli-ruby/lib/shopify_cli/tasks.rb +0 -44
- package/assets/cli-ruby/lib/shopify_cli/theme/backoff_helper.rb +0 -47
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +0 -82
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/certificate_manager.rb +0 -79
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/errors.rb +0 -9
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/header_hash.rb +0 -98
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hooks/file_change_hook.rb +0 -77
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_deleter.rb +0 -62
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_reloader.rb +0 -63
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/hot-reload-no-script.html +0 -27
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/hot_reload.js +0 -48
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/sse_client.js +0 -43
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/theme.js +0 -114
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/theme_extension.js +0 -121
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/script_injector.rb +0 -57
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/sections_index.rb +0 -50
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload.rb +0 -75
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/local_assets.rb +0 -101
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/proxy.rb +0 -313
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/proxy_param_builder.rb +0 -84
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/reload_mode.rb +0 -34
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/remote_watcher/json_files_update_job.rb +0 -35
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/remote_watcher.rb +0 -44
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/sse.rb +0 -75
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/watcher.rb +0 -64
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/web_server.rb +0 -140
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server.rb +0 -332
- package/assets/cli-ruby/lib/shopify_cli/theme/development_theme.rb +0 -101
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/app_extension.rb +0 -40
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/hooks/file_change_hook.rb +0 -76
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/hot_reload/script_injector.rb +0 -30
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/hot_reload.rb +0 -13
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/local_assets.rb +0 -31
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/proxy_param_builder.rb +0 -94
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/watcher.rb +0 -49
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server.rb +0 -175
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/host_theme.rb +0 -109
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/ignore_helper.rb +0 -35
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/syncer/extension_serve_job.rb +0 -120
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/syncer/operation.rb +0 -25
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/syncer.rb +0 -100
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/ui/host_theme_progress_bar.rb +0 -35
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/ui/host_theme_raw_progress_bar.rb +0 -40
- package/assets/cli-ruby/lib/shopify_cli/theme/file.rb +0 -133
- package/assets/cli-ruby/lib/shopify_cli/theme/filter/path_matcher.rb +0 -38
- package/assets/cli-ruby/lib/shopify_cli/theme/ignore_filter.rb +0 -112
- package/assets/cli-ruby/lib/shopify_cli/theme/ignore_helper.rb +0 -37
- package/assets/cli-ruby/lib/shopify_cli/theme/include_filter.rb +0 -67
- package/assets/cli-ruby/lib/shopify_cli/theme/mime_type.rb +0 -34
- package/assets/cli-ruby/lib/shopify_cli/theme/notifier.rb +0 -52
- package/assets/cli-ruby/lib/shopify_cli/theme/repl/api.rb +0 -109
- package/assets/cli-ruby/lib/shopify_cli/theme/repl/auth_dev_server.rb +0 -93
- package/assets/cli-ruby/lib/shopify_cli/theme/repl/auth_middleware.rb +0 -97
- package/assets/cli-ruby/lib/shopify_cli/theme/repl/remote_evaluator.rb +0 -166
- package/assets/cli-ruby/lib/shopify_cli/theme/repl/resources/success.html +0 -78
- package/assets/cli-ruby/lib/shopify_cli/theme/repl/resources/template.liquid +0 -15
- package/assets/cli-ruby/lib/shopify_cli/theme/repl/snippet.rb +0 -81
- package/assets/cli-ruby/lib/shopify_cli/theme/repl.rb +0 -88
- package/assets/cli-ruby/lib/shopify_cli/theme/root.rb +0 -62
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/checksums.rb +0 -66
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/downloader.rb +0 -63
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/error_reporter.rb +0 -45
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/merger.rb +0 -53
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/operation.rb +0 -49
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/standard_reporter.rb +0 -32
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/unsupported_script_warning.rb +0 -90
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk.rb +0 -133
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk_item.rb +0 -64
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk_job.rb +0 -139
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk_request.rb +0 -30
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/apply_to_all.rb +0 -41
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/apply_to_all_form.rb +0 -37
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/base_strategy_form.rb +0 -64
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/select_delete_strategy.rb +0 -29
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/select_update_strategy.rb +0 -30
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/json_delete_handler.rb +0 -49
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/json_update_handler.rb +0 -71
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader.rb +0 -231
- package/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb +0 -391
- package/assets/cli-ruby/lib/shopify_cli/theme/theme.rb +0 -212
- package/assets/cli-ruby/lib/shopify_cli/theme/theme_access_api.rb +0 -89
- package/assets/cli-ruby/lib/shopify_cli/theme/theme_admin_api.rb +0 -101
- package/assets/cli-ruby/lib/shopify_cli/thread_pool/job.rb +0 -35
- package/assets/cli-ruby/lib/shopify_cli/thread_pool.rb +0 -49
- package/assets/cli-ruby/lib/shopify_cli/transform_data_structure.rb +0 -87
- package/assets/cli-ruby/lib/shopify_cli/utilities.rb +0 -21
- package/assets/cli-ruby/lib/shopify_cli/version.rb +0 -3
- package/assets/cli-ruby/lib/shopify_cli.rb +0 -182
- package/assets/cli-ruby/shipit.rubygems.yml +0 -3
- package/assets/cli-ruby/shopify-cli.gemspec +0 -46
- package/assets/cli-ruby/shopify-dev +0 -16
- package/assets/cli-ruby/test/minitest_ext.rb +0 -115
- package/assets/cli-ruby/test/project_types/extension/extension_test_helpers.rb +0 -70
- package/assets/cli-ruby/test/shopify-cli/migrator/migrations/migration_helper.rb +0 -20
- package/assets/cli-ruby/test/test_helpers.rb +0 -16
- package/assets/cli-ruby/utilities/constants.rb +0 -7
- package/assets/cli-ruby/utilities/docker/container.rb +0 -104
- package/assets/cli-ruby/utilities/docker.rb +0 -89
- package/assets/cli-ruby/utilities/utilities.rb +0 -6
- package/assets/cli-ruby/vendor/deps/cli-kit/REVISION +0 -1
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/autocall.rb +0 -21
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/base_command.rb +0 -49
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/command_registry.rb +0 -94
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/config.rb +0 -133
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +0 -123
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/executor.rb +0 -79
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/ini.rb +0 -102
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/levenshtein.rb +0 -82
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/logger.rb +0 -82
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/resolver.rb +0 -60
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/ruby_backports/enumerable.rb +0 -6
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/support/test_helper.rb +0 -244
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/support.rb +0 -9
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/system.rb +0 -243
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/util.rb +0 -193
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/version.rb +0 -5
- package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit.rb +0 -60
- package/assets/cli-ruby/vendor/deps/cli-ui/REVISION +0 -1
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +0 -157
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/color.rb +0 -84
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/formatter.rb +0 -193
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +0 -98
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +0 -166
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +0 -139
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +0 -120
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame.rb +0 -269
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +0 -84
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/os.rb +0 -73
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/printer.rb +0 -59
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/progress.rb +0 -90
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/progress_plain.rb +0 -50
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +0 -484
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/prompt/options_handler.rb +0 -29
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +0 -282
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/spinner/async.rb +0 -40
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +0 -263
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +0 -66
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb +0 -232
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +0 -46
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/truncater.rb +0 -102
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/version.rb +0 -5
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb +0 -27
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb +0 -61
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +0 -77
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +0 -56
- package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui.rb +0 -234
- package/assets/cli-ruby/vendor/deps/ruby2_keywords/LICENSE +0 -22
- package/assets/cli-ruby/vendor/deps/ruby2_keywords/README.md +0 -67
- package/assets/cli-ruby/vendor/deps/ruby2_keywords/Rakefile +0 -54
- package/assets/cli-ruby/vendor/deps/ruby2_keywords/lib/ruby2_keywords.rb +0 -57
- package/assets/cli-ruby/vendor/deps/ruby2_keywords/ruby2_keywords.gemspec +0 -18
- package/assets/cli-ruby/vendor/deps/ruby2_keywords/test/test_keyword.rb +0 -41
- package/assets/cli-ruby/vendor/deps/smart_properties/REVISION +0 -1
- package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/errors.rb +0 -114
- package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/property.rb +0 -168
- package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/property_collection.rb +0 -83
- package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/validations/ancestor.rb +0 -27
- package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/validations.rb +0 -8
- package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/version.rb +0 -3
- package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties.rb +0 -174
- package/assets/cli-ruby/vendor/deps/webrick/Gemfile +0 -3
- package/assets/cli-ruby/vendor/deps/webrick/LICENSE.txt +0 -22
- package/assets/cli-ruby/vendor/deps/webrick/README.md +0 -61
- package/assets/cli-ruby/vendor/deps/webrick/Rakefile +0 -10
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/accesslog.rb +0 -157
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/cgi.rb +0 -313
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/compat.rb +0 -36
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/config.rb +0 -158
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/cookie.rb +0 -172
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/htmlutils.rb +0 -30
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +0 -117
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +0 -116
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +0 -395
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +0 -132
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +0 -97
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +0 -158
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +0 -53
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth.rb +0 -96
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpproxy.rb +0 -354
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httprequest.rb +0 -636
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpresponse.rb +0 -564
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/https.rb +0 -152
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpserver.rb +0 -294
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +0 -152
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +0 -47
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +0 -126
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +0 -88
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +0 -552
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +0 -47
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet.rb +0 -23
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpstatus.rb +0 -194
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httputils.rb +0 -512
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpversion.rb +0 -76
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/log.rb +0 -156
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/server.rb +0 -381
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/ssl.rb +0 -215
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/utils.rb +0 -265
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/version.rb +0 -18
- package/assets/cli-ruby/vendor/deps/webrick/lib/webrick.rb +0 -232
- package/assets/cli-ruby/vendor/deps/webrick/webrick.gemspec +0 -74
- package/assets/cli-ruby/vendor/gen/lib/gen/commands/help.rb +0 -20
- package/assets/cli-ruby/vendor/gen/lib/gen/commands/new.rb +0 -21
- package/assets/cli-ruby/vendor/gen/lib/gen/commands.rb +0 -18
- package/assets/cli-ruby/vendor/gen/lib/gen/entry_point.rb +0 -10
- package/assets/cli-ruby/vendor/gen/lib/gen/generator.rb +0 -165
- package/assets/cli-ruby/vendor/gen/lib/gen.rb +0 -39
- package/assets/cli-ruby/vendor/gen/template/Gemfile +0 -10
- package/assets/cli-ruby/vendor/gen/template/README.md +0 -1
- package/assets/cli-ruby/vendor/gen/template/bin/testunit +0 -23
- package/assets/cli-ruby/vendor/gen/template/bin/update-deps +0 -97
- package/assets/cli-ruby/vendor/gen/template/dev-gems.yml +0 -3
- package/assets/cli-ruby/vendor/gen/template/dev-vendor.yml +0 -4
- package/assets/cli-ruby/vendor/gen/template/exe/__app__-gems +0 -17
- package/assets/cli-ruby/vendor/gen/template/exe/__app__-vendor +0 -18
- package/assets/cli-ruby/vendor/gen/template/lib/__app__/commands/example.rb +0 -19
- package/assets/cli-ruby/vendor/gen/template/lib/__app__/commands/help.rb +0 -21
- package/assets/cli-ruby/vendor/gen/template/lib/__app__/commands.rb +0 -18
- package/assets/cli-ruby/vendor/gen/template/lib/__app__/entry_point.rb +0 -10
- package/assets/cli-ruby/vendor/gen/template/lib/__app__.rb +0 -33
- package/assets/cli-ruby/vendor/gen/template/test/example_test.rb +0 -17
- package/assets/cli-ruby/vendor/gen/template/test/test_helper.rb +0 -22
- package/assets/cli-ruby/vendor/lib/semantic/LICENSE +0 -20
- package/assets/cli-ruby/vendor/lib/semantic/semantic.rb +0 -4
- package/assets/cli-ruby/vendor/lib/semantic/version.rb +0 -179
- package/dist/public/node/ruby.d.ts +0 -38
- package/dist/public/node/ruby.js +0 -327
- package/dist/public/node/ruby.js.map +0 -1
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
require 'cli/ui'
|
|
3
|
-
require 'readline'
|
|
4
|
-
|
|
5
|
-
module CLI
|
|
6
|
-
module UI
|
|
7
|
-
module Prompt
|
|
8
|
-
autoload :InteractiveOptions, 'cli/ui/prompt/interactive_options'
|
|
9
|
-
autoload :OptionsHandler, 'cli/ui/prompt/options_handler'
|
|
10
|
-
private_constant :InteractiveOptions, :OptionsHandler
|
|
11
|
-
|
|
12
|
-
class << self
|
|
13
|
-
# Ask a user a question with either free form answer or a set of answers (multiple choice)
|
|
14
|
-
# Can use arrows, y/n, numbers (1/2), and vim bindings to control multiple choice selection
|
|
15
|
-
# Do not use this method for yes/no questions. Use +confirm+
|
|
16
|
-
#
|
|
17
|
-
# * Handles free form answers (options are nil)
|
|
18
|
-
# * Handles default answers for free form text
|
|
19
|
-
# * Handles file auto completion for file input
|
|
20
|
-
# * Handles interactively choosing answers using +InteractiveOptions+
|
|
21
|
-
#
|
|
22
|
-
# https://user-images.githubusercontent.com/3074765/33799822-47f23302-dd01-11e7-82f3-9072a5a5f611.png
|
|
23
|
-
#
|
|
24
|
-
# ==== Attributes
|
|
25
|
-
#
|
|
26
|
-
# * +question+ - (required) The question to ask the user
|
|
27
|
-
#
|
|
28
|
-
# ==== Options
|
|
29
|
-
#
|
|
30
|
-
# * +:options+ - Options that the user may select from. Will use +InteractiveOptions+ to do so.
|
|
31
|
-
# * +:default+ - The default answer to the question (e.g. they just press enter and don't input anything)
|
|
32
|
-
# * +:is_file+ - Tells the input to use file auto-completion (tab completion)
|
|
33
|
-
# * +:allow_empty+ - Allows the answer to be empty
|
|
34
|
-
# * +:multiple+ - Allow multiple options to be selected
|
|
35
|
-
# * +:filter_ui+ - Enable option filtering (default: true)
|
|
36
|
-
# * +:select_ui+ - Enable long-form option selection (default: true)
|
|
37
|
-
#
|
|
38
|
-
# Note:
|
|
39
|
-
# * +:options+ or providing a +Block+ conflicts with +:default+ and +:is_file+,
|
|
40
|
-
# you cannot set options with either of these keywords
|
|
41
|
-
# * +:default+ conflicts with +:allow_empty:, you cannot set these together
|
|
42
|
-
# * +:options+ conflicts with providing a +Block+ , you may only set one
|
|
43
|
-
# * +:multiple+ can only be used with +:options+ or a +Block+; it is ignored, otherwise.
|
|
44
|
-
#
|
|
45
|
-
# ==== Block (optional)
|
|
46
|
-
#
|
|
47
|
-
# * A Proc that provides a +OptionsHandler+ and uses the public +:option+ method to add options and their
|
|
48
|
-
# respective handlers
|
|
49
|
-
#
|
|
50
|
-
# ==== Return Value
|
|
51
|
-
#
|
|
52
|
-
# * If a +Block+ was not provided, the selected option or response to the free form question will be returned
|
|
53
|
-
# * If a +Block+ was provided, the evaluated value of the +Block+ will be returned
|
|
54
|
-
#
|
|
55
|
-
# ==== Example Usage:
|
|
56
|
-
#
|
|
57
|
-
# Free form question
|
|
58
|
-
# CLI::UI::Prompt.ask('What color is the sky?')
|
|
59
|
-
#
|
|
60
|
-
# Free form question with a file answer
|
|
61
|
-
# CLI::UI::Prompt.ask('Where is your Gemfile located?', is_file: true)
|
|
62
|
-
#
|
|
63
|
-
# Free form question with a default answer
|
|
64
|
-
# CLI::UI::Prompt.ask('What color is the sky?', default: 'blue')
|
|
65
|
-
#
|
|
66
|
-
# Free form question when the answer can be empty
|
|
67
|
-
# CLI::UI::Prompt.ask('What is your opinion on this question?', allow_empty: true)
|
|
68
|
-
#
|
|
69
|
-
# Interactive (multiple choice) question
|
|
70
|
-
# CLI::UI::Prompt.ask('What kind of project is this?', options: %w(rails go ruby python))
|
|
71
|
-
#
|
|
72
|
-
# Interactive (multiple choice) question with defined handlers
|
|
73
|
-
# CLI::UI::Prompt.ask('What kind of project is this?') do |handler|
|
|
74
|
-
# handler.option('rails') { |selection| selection }
|
|
75
|
-
# handler.option('go') { |selection| selection }
|
|
76
|
-
# handler.option('ruby') { |selection| selection }
|
|
77
|
-
# handler.option('python') { |selection| selection }
|
|
78
|
-
# end
|
|
79
|
-
#
|
|
80
|
-
def ask(
|
|
81
|
-
question,
|
|
82
|
-
options: nil,
|
|
83
|
-
default: nil,
|
|
84
|
-
is_file: nil,
|
|
85
|
-
allow_empty: true,
|
|
86
|
-
multiple: false,
|
|
87
|
-
filter_ui: true,
|
|
88
|
-
select_ui: true,
|
|
89
|
-
&options_proc
|
|
90
|
-
)
|
|
91
|
-
if (options || block_given?) && ((default && !multiple) || is_file)
|
|
92
|
-
raise(ArgumentError, 'conflicting arguments: options provided with default or is_file')
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
if options && multiple && default && !(default - options).empty?
|
|
96
|
-
raise(ArgumentError, 'conflicting arguments: default should only include elements present in options')
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
if options || block_given?
|
|
100
|
-
ask_interactive(
|
|
101
|
-
question,
|
|
102
|
-
options,
|
|
103
|
-
multiple: multiple,
|
|
104
|
-
default: default,
|
|
105
|
-
filter_ui: filter_ui,
|
|
106
|
-
select_ui: select_ui,
|
|
107
|
-
&options_proc
|
|
108
|
-
)
|
|
109
|
-
else
|
|
110
|
-
ask_free_form(question, default, is_file, allow_empty)
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
# Asks the user for a single-line answer, without displaying the characters while typing.
|
|
115
|
-
# Typically used for password prompts
|
|
116
|
-
#
|
|
117
|
-
# ==== Return Value
|
|
118
|
-
#
|
|
119
|
-
# The password, without a trailing newline.
|
|
120
|
-
# If the user simply presses "Enter" without typing any password, this will return an empty string.
|
|
121
|
-
def ask_password(question)
|
|
122
|
-
require 'io/console'
|
|
123
|
-
|
|
124
|
-
CLI::UI.with_frame_color(:blue) do
|
|
125
|
-
STDOUT.print(CLI::UI.fmt('{{?}} ' + question)) # Do not use puts_question to avoid the new line.
|
|
126
|
-
|
|
127
|
-
# noecho interacts poorly with Readline under system Ruby, so do a manual `gets` here.
|
|
128
|
-
# No fancy Readline integration (like echoing back) is required for a password prompt anyway.
|
|
129
|
-
password = STDIN.noecho do
|
|
130
|
-
# Chomp will remove the one new line character added by `gets`, without touching potential extra spaces:
|
|
131
|
-
# " 123 \n".chomp => " 123 "
|
|
132
|
-
STDIN.gets.chomp
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
STDOUT.puts # Complete the line
|
|
136
|
-
|
|
137
|
-
password
|
|
138
|
-
end
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
# Asks the user a yes/no question.
|
|
142
|
-
# Can use arrows, y/n, numbers (1/2), and vim bindings to control
|
|
143
|
-
#
|
|
144
|
-
# ==== Example Usage:
|
|
145
|
-
#
|
|
146
|
-
# Confirmation question
|
|
147
|
-
# CLI::UI::Prompt.confirm('Is the sky blue?')
|
|
148
|
-
#
|
|
149
|
-
# CLI::UI::Prompt.confirm('Do a dangerous thing?', default: false)
|
|
150
|
-
#
|
|
151
|
-
def confirm(question, default: true)
|
|
152
|
-
ask_interactive(question, default ? %w(yes no) : %w(no yes), filter_ui: false) == 'yes'
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
private
|
|
156
|
-
|
|
157
|
-
def ask_free_form(question, default, is_file, allow_empty)
|
|
158
|
-
if default && !allow_empty
|
|
159
|
-
raise(ArgumentError, 'conflicting arguments: default enabled but allow_empty is false')
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
if default
|
|
163
|
-
puts_question("#{question} (empty = #{default})")
|
|
164
|
-
else
|
|
165
|
-
puts_question(question)
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
# Ask a free form question
|
|
169
|
-
loop do
|
|
170
|
-
line = readline(is_file: is_file)
|
|
171
|
-
|
|
172
|
-
if line.empty? && default
|
|
173
|
-
write_default_over_empty_input(default)
|
|
174
|
-
return default
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
if !line.empty? || allow_empty
|
|
178
|
-
return line
|
|
179
|
-
end
|
|
180
|
-
end
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
def ask_interactive(question, options = nil, multiple: false, default: nil, filter_ui: true, select_ui: true)
|
|
184
|
-
raise(ArgumentError, 'conflicting arguments: options and block given') if options && block_given?
|
|
185
|
-
|
|
186
|
-
options ||= if block_given?
|
|
187
|
-
handler = OptionsHandler.new
|
|
188
|
-
yield handler
|
|
189
|
-
handler.options
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
raise(ArgumentError, 'insufficient options') if options.nil? || options.empty?
|
|
193
|
-
navigate_text = if CLI::UI::OS.current.supports_arrow_keys?
|
|
194
|
-
"Choose with ↑ ↓ ⏎"
|
|
195
|
-
else
|
|
196
|
-
"Navigate up with 'k' and down with 'j', press Enter to select"
|
|
197
|
-
end
|
|
198
|
-
|
|
199
|
-
instructions = (multiple ? "Toggle options. " : "") + navigate_text
|
|
200
|
-
instructions += ", filter with 'f'" if filter_ui
|
|
201
|
-
instructions += ", enter option with 'e'" if select_ui && (options.size > 9)
|
|
202
|
-
puts_question("#{question} {{yellow:(#{instructions})}}")
|
|
203
|
-
resp = interactive_prompt(options, multiple: multiple, default: default)
|
|
204
|
-
|
|
205
|
-
# Clear the line
|
|
206
|
-
print(ANSI.previous_line + ANSI.clear_to_end_of_line)
|
|
207
|
-
# Force StdoutRouter to prefix
|
|
208
|
-
print(ANSI.previous_line + "\n")
|
|
209
|
-
|
|
210
|
-
# reset the question to include the answer
|
|
211
|
-
resp_text = resp
|
|
212
|
-
if multiple
|
|
213
|
-
resp_text = case resp.size
|
|
214
|
-
when 0
|
|
215
|
-
"<nothing>"
|
|
216
|
-
when 1..2
|
|
217
|
-
resp.join(" and ")
|
|
218
|
-
else
|
|
219
|
-
"#{resp.size} items"
|
|
220
|
-
end
|
|
221
|
-
end
|
|
222
|
-
puts_question("#{question} (You chose: {{italic:#{resp_text}}})")
|
|
223
|
-
|
|
224
|
-
return handler.call(resp) if block_given?
|
|
225
|
-
resp
|
|
226
|
-
end
|
|
227
|
-
|
|
228
|
-
# Useful for stubbing in tests
|
|
229
|
-
def interactive_prompt(options, multiple: false, default: nil)
|
|
230
|
-
InteractiveOptions.call(options, multiple: multiple, default: default)
|
|
231
|
-
end
|
|
232
|
-
|
|
233
|
-
def write_default_over_empty_input(default)
|
|
234
|
-
CLI::UI.raw do
|
|
235
|
-
STDERR.puts(
|
|
236
|
-
CLI::UI::ANSI.cursor_up(1) +
|
|
237
|
-
"\r" +
|
|
238
|
-
CLI::UI::ANSI.cursor_forward(4) + # TODO: width
|
|
239
|
-
default +
|
|
240
|
-
CLI::UI::Color::RESET.code
|
|
241
|
-
)
|
|
242
|
-
end
|
|
243
|
-
end
|
|
244
|
-
|
|
245
|
-
def puts_question(str)
|
|
246
|
-
CLI::UI.with_frame_color(:blue) do
|
|
247
|
-
STDOUT.puts(CLI::UI.fmt('{{?}} ' + str))
|
|
248
|
-
end
|
|
249
|
-
end
|
|
250
|
-
|
|
251
|
-
def readline(is_file: false)
|
|
252
|
-
if is_file
|
|
253
|
-
Readline.completion_proc = Readline::FILENAME_COMPLETION_PROC
|
|
254
|
-
Readline.completion_append_character = ""
|
|
255
|
-
else
|
|
256
|
-
Readline.completion_proc = proc { |*| nil }
|
|
257
|
-
Readline.completion_append_character = " "
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
# because Readline is a C library, CLI::UI's hooks into $stdout don't
|
|
261
|
-
# work. We could work around this by having CLI::UI use a pipe and a
|
|
262
|
-
# thread to manage output, but the current strategy feels like a
|
|
263
|
-
# better tradeoff.
|
|
264
|
-
prefix = CLI::UI.with_frame_color(:blue) { CLI::UI::Frame.prefix }
|
|
265
|
-
# If a prompt is interrupted on Windows it locks the colour of the terminal from that point on, so we should
|
|
266
|
-
# not change the colour here.
|
|
267
|
-
prompt = prefix + CLI::UI.fmt('{{blue:> }}')
|
|
268
|
-
prompt += CLI::UI::Color::YELLOW.code if CLI::UI::OS.current.supports_color_prompt?
|
|
269
|
-
|
|
270
|
-
begin
|
|
271
|
-
line = Readline.readline(prompt, true)
|
|
272
|
-
print(CLI::UI::Color::RESET.code)
|
|
273
|
-
line.to_s.chomp
|
|
274
|
-
rescue Interrupt
|
|
275
|
-
CLI::UI.raw { STDERR.puts('^C' + CLI::UI::Color::RESET.code) }
|
|
276
|
-
raise
|
|
277
|
-
end
|
|
278
|
-
end
|
|
279
|
-
end
|
|
280
|
-
end
|
|
281
|
-
end
|
|
282
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
module CLI
|
|
2
|
-
module UI
|
|
3
|
-
module Spinner
|
|
4
|
-
class Async
|
|
5
|
-
# Convenience method for +initialize+
|
|
6
|
-
#
|
|
7
|
-
def self.start(title)
|
|
8
|
-
new(title)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
# Initializes a new asynchronous spinner with no specific end.
|
|
12
|
-
# Must call +.stop+ to end the spinner
|
|
13
|
-
#
|
|
14
|
-
# ==== Attributes
|
|
15
|
-
#
|
|
16
|
-
# * +title+ - Title of the spinner to use
|
|
17
|
-
#
|
|
18
|
-
# ==== Example Usage:
|
|
19
|
-
#
|
|
20
|
-
# CLI::UI::Spinner::Async.new('Title')
|
|
21
|
-
#
|
|
22
|
-
def initialize(title)
|
|
23
|
-
require 'thread'
|
|
24
|
-
sg = CLI::UI::Spinner::SpinGroup.new
|
|
25
|
-
@m = Mutex.new
|
|
26
|
-
@cv = ConditionVariable.new
|
|
27
|
-
sg.add(title) { @m.synchronize { @cv.wait(@m) } }
|
|
28
|
-
@t = Thread.new { sg.wait }
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Stops an asynchronous spinner
|
|
32
|
-
#
|
|
33
|
-
def stop
|
|
34
|
-
@m.synchronize { @cv.signal }
|
|
35
|
-
@t.value
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
module CLI
|
|
2
|
-
module UI
|
|
3
|
-
module Spinner
|
|
4
|
-
class SpinGroup
|
|
5
|
-
# Initializes a new spin group
|
|
6
|
-
# This lets you add +Task+ objects to the group to multi-thread work
|
|
7
|
-
#
|
|
8
|
-
# ==== Options
|
|
9
|
-
#
|
|
10
|
-
# * +:auto_debrief+ - Automatically debrief exceptions? Default to true
|
|
11
|
-
#
|
|
12
|
-
# ==== Example Usage
|
|
13
|
-
#
|
|
14
|
-
# spin_group = CLI::UI::SpinGroup.new
|
|
15
|
-
# spin_group.add('Title') { |spinner| sleep 3.0 }
|
|
16
|
-
# spin_group.add('Title 2') { |spinner| sleep 3.0; spinner.update_title('New Title'); sleep 3.0 }
|
|
17
|
-
# spin_group.wait
|
|
18
|
-
#
|
|
19
|
-
# Output:
|
|
20
|
-
#
|
|
21
|
-
# https://user-images.githubusercontent.com/3074765/33798558-c452fa26-dce8-11e7-9e90-b4b34df21a46.gif
|
|
22
|
-
#
|
|
23
|
-
def initialize(auto_debrief: true)
|
|
24
|
-
@m = Mutex.new
|
|
25
|
-
@consumed_lines = 0
|
|
26
|
-
@tasks = []
|
|
27
|
-
@auto_debrief = auto_debrief
|
|
28
|
-
@start = Time.new
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
class Task
|
|
32
|
-
attr_reader :title, :exception, :success, :stdout, :stderr
|
|
33
|
-
|
|
34
|
-
# Initializes a new Task
|
|
35
|
-
# This is managed entirely internally by +SpinGroup+
|
|
36
|
-
#
|
|
37
|
-
# ==== Attributes
|
|
38
|
-
#
|
|
39
|
-
# * +title+ - Title of the task
|
|
40
|
-
# * +block+ - Block for the task, will be provided with an instance of the spinner
|
|
41
|
-
#
|
|
42
|
-
def initialize(title, &block)
|
|
43
|
-
@title = title
|
|
44
|
-
@always_full_render = title =~ Formatter::SCAN_WIDGET
|
|
45
|
-
@thread = Thread.new do
|
|
46
|
-
cap = CLI::UI::StdoutRouter::Capture.new(self, with_frame_inset: false, &block)
|
|
47
|
-
begin
|
|
48
|
-
cap.run
|
|
49
|
-
ensure
|
|
50
|
-
@stdout = cap.stdout
|
|
51
|
-
@stderr = cap.stderr
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
@m = Mutex.new
|
|
56
|
-
@force_full_render = false
|
|
57
|
-
@done = false
|
|
58
|
-
@exception = nil
|
|
59
|
-
@success = false
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
# Checks if a task is finished
|
|
63
|
-
#
|
|
64
|
-
def check
|
|
65
|
-
return true if @done
|
|
66
|
-
return false if @thread.alive?
|
|
67
|
-
|
|
68
|
-
@done = true
|
|
69
|
-
begin
|
|
70
|
-
status = @thread.join.status
|
|
71
|
-
@success = (status == false)
|
|
72
|
-
@success = false if @thread.value == TASK_FAILED
|
|
73
|
-
rescue => exc
|
|
74
|
-
@exception = exc
|
|
75
|
-
@success = false
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
@done
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
# Re-renders the task if required:
|
|
82
|
-
#
|
|
83
|
-
# We try to be as lazy as possible in re-rendering the full line. The
|
|
84
|
-
# spinner rune will change on each render for the most part, but the
|
|
85
|
-
# body text will rarely have changed. If the body text *has* changed,
|
|
86
|
-
# we set @force_full_render.
|
|
87
|
-
#
|
|
88
|
-
# Further, if the title string includes any CLI::UI::Widgets, we
|
|
89
|
-
# assume that it may change from render to render, since those
|
|
90
|
-
# evaluate more dynamically than the rest of our format codes, which
|
|
91
|
-
# are just text formatters. This is controlled by @always_full_render.
|
|
92
|
-
#
|
|
93
|
-
# ==== Attributes
|
|
94
|
-
#
|
|
95
|
-
# * +index+ - index of the task
|
|
96
|
-
# * +force+ - force rerender of the task
|
|
97
|
-
# * +width+ - current terminal width to format for
|
|
98
|
-
#
|
|
99
|
-
def render(index, force = true, width: CLI::UI::Terminal.width)
|
|
100
|
-
@m.synchronize do
|
|
101
|
-
if force || @always_full_render || @force_full_render
|
|
102
|
-
full_render(index, width)
|
|
103
|
-
else
|
|
104
|
-
partial_render(index)
|
|
105
|
-
end
|
|
106
|
-
ensure
|
|
107
|
-
@force_full_render = false
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
# Update the spinner title
|
|
112
|
-
#
|
|
113
|
-
# ==== Attributes
|
|
114
|
-
#
|
|
115
|
-
# * +title+ - title to change the spinner to
|
|
116
|
-
#
|
|
117
|
-
def update_title(new_title)
|
|
118
|
-
@m.synchronize do
|
|
119
|
-
@always_full_render = new_title =~ Formatter::SCAN_WIDGET
|
|
120
|
-
@title = new_title
|
|
121
|
-
@force_full_render = true
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
private
|
|
126
|
-
|
|
127
|
-
def full_render(index, terminal_width)
|
|
128
|
-
prefix = inset +
|
|
129
|
-
glyph(index) +
|
|
130
|
-
CLI::UI::Color::RESET.code +
|
|
131
|
-
' '
|
|
132
|
-
|
|
133
|
-
truncation_width = terminal_width - CLI::UI::ANSI.printing_width(prefix)
|
|
134
|
-
|
|
135
|
-
prefix +
|
|
136
|
-
CLI::UI.resolve_text(title, truncate_to: truncation_width) +
|
|
137
|
-
"\e[K"
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
def partial_render(index)
|
|
141
|
-
CLI::UI::ANSI.cursor_forward(inset_width) + glyph(index) + CLI::UI::Color::RESET.code
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
def glyph(index)
|
|
145
|
-
if @done
|
|
146
|
-
@success ? CLI::UI::Glyph::CHECK.to_s : CLI::UI::Glyph::X.to_s
|
|
147
|
-
else
|
|
148
|
-
GLYPHS[index]
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
def inset
|
|
153
|
-
@inset ||= CLI::UI::Frame.prefix
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
def inset_width
|
|
157
|
-
@inset_width ||= CLI::UI::ANSI.printing_width(inset)
|
|
158
|
-
end
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
# Add a new task
|
|
162
|
-
#
|
|
163
|
-
# ==== Attributes
|
|
164
|
-
#
|
|
165
|
-
# * +title+ - Title of the task
|
|
166
|
-
# * +block+ - Block for the task, will be provided with an instance of the spinner
|
|
167
|
-
#
|
|
168
|
-
# ==== Example Usage:
|
|
169
|
-
# spin_group = CLI::UI::SpinGroup.new
|
|
170
|
-
# spin_group.add('Title') { |spinner| sleep 1.0 }
|
|
171
|
-
# spin_group.wait
|
|
172
|
-
#
|
|
173
|
-
def add(title, &block)
|
|
174
|
-
@m.synchronize do
|
|
175
|
-
@tasks << Task.new(title, &block)
|
|
176
|
-
end
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
# Tells the group you're done adding tasks and to wait for all of them to finish
|
|
180
|
-
#
|
|
181
|
-
# ==== Example Usage:
|
|
182
|
-
# spin_group = CLI::UI::SpinGroup.new
|
|
183
|
-
# spin_group.add('Title') { |spinner| sleep 1.0 }
|
|
184
|
-
# spin_group.wait
|
|
185
|
-
#
|
|
186
|
-
def wait
|
|
187
|
-
idx = 0
|
|
188
|
-
|
|
189
|
-
loop do
|
|
190
|
-
all_done = true
|
|
191
|
-
|
|
192
|
-
width = CLI::UI::Terminal.width
|
|
193
|
-
|
|
194
|
-
@m.synchronize do
|
|
195
|
-
CLI::UI.raw do
|
|
196
|
-
@tasks.each.with_index do |task, int_index|
|
|
197
|
-
nat_index = int_index + 1
|
|
198
|
-
task_done = task.check
|
|
199
|
-
all_done = false unless task_done
|
|
200
|
-
|
|
201
|
-
if nat_index > @consumed_lines
|
|
202
|
-
print(task.render(idx, true, width: width) + "\n")
|
|
203
|
-
@consumed_lines += 1
|
|
204
|
-
else
|
|
205
|
-
offset = @consumed_lines - int_index
|
|
206
|
-
move_to = CLI::UI::ANSI.cursor_up(offset) + "\r"
|
|
207
|
-
move_from = "\r" + CLI::UI::ANSI.cursor_down(offset)
|
|
208
|
-
|
|
209
|
-
print(move_to + task.render(idx, idx.zero?, width: width) + move_from)
|
|
210
|
-
end
|
|
211
|
-
end
|
|
212
|
-
end
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
break if all_done
|
|
216
|
-
|
|
217
|
-
idx = (idx + 1) % GLYPHS.size
|
|
218
|
-
Spinner.index = idx
|
|
219
|
-
sleep(PERIOD)
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
if @auto_debrief
|
|
223
|
-
debrief
|
|
224
|
-
else
|
|
225
|
-
@m.synchronize do
|
|
226
|
-
@tasks.all?(&:success)
|
|
227
|
-
end
|
|
228
|
-
end
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
# Debriefs failed tasks is +auto_debrief+ is true
|
|
232
|
-
#
|
|
233
|
-
def debrief
|
|
234
|
-
@m.synchronize do
|
|
235
|
-
@tasks.each do |task|
|
|
236
|
-
next if task.success
|
|
237
|
-
|
|
238
|
-
e = task.exception
|
|
239
|
-
out = task.stdout
|
|
240
|
-
err = task.stderr
|
|
241
|
-
|
|
242
|
-
CLI::UI::Frame.open('Task Failed: ' + task.title, color: :red, timing: Time.new - @start) do
|
|
243
|
-
if e
|
|
244
|
-
puts "#{e.class}: #{e.message}"
|
|
245
|
-
puts "\tfrom #{e.backtrace.join("\n\tfrom ")}"
|
|
246
|
-
end
|
|
247
|
-
|
|
248
|
-
CLI::UI::Frame.divider('STDOUT')
|
|
249
|
-
out = "(empty)" if out.nil? || out.strip.empty?
|
|
250
|
-
puts out
|
|
251
|
-
|
|
252
|
-
CLI::UI::Frame.divider('STDERR')
|
|
253
|
-
err = "(empty)" if err.nil? || err.strip.empty?
|
|
254
|
-
puts err
|
|
255
|
-
end
|
|
256
|
-
end
|
|
257
|
-
@tasks.all?(&:success)
|
|
258
|
-
end
|
|
259
|
-
end
|
|
260
|
-
end
|
|
261
|
-
end
|
|
262
|
-
end
|
|
263
|
-
end
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# frozen-string-literal: true
|
|
2
|
-
require 'cli/ui'
|
|
3
|
-
|
|
4
|
-
module CLI
|
|
5
|
-
module UI
|
|
6
|
-
module Spinner
|
|
7
|
-
autoload :Async, 'cli/ui/spinner/async'
|
|
8
|
-
autoload :SpinGroup, 'cli/ui/spinner/spin_group'
|
|
9
|
-
|
|
10
|
-
PERIOD = 0.1 # seconds
|
|
11
|
-
TASK_FAILED = :task_failed
|
|
12
|
-
|
|
13
|
-
RUNES = CLI::UI::OS.current.supports_emoji? ? %w(⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏).freeze : %w(\\ | / - \\ | / -).freeze
|
|
14
|
-
|
|
15
|
-
colors = [CLI::UI::Color::CYAN.code] * (RUNES.size / 2).ceil +
|
|
16
|
-
[CLI::UI::Color::MAGENTA.code] * (RUNES.size / 2).to_i
|
|
17
|
-
GLYPHS = colors.zip(RUNES).map(&:join)
|
|
18
|
-
|
|
19
|
-
class << self
|
|
20
|
-
attr_accessor(:index)
|
|
21
|
-
|
|
22
|
-
# We use this from CLI::UI::Widgets::Status to render an additional
|
|
23
|
-
# spinner next to the "working" element. While this global state looks
|
|
24
|
-
# a bit repulsive at first, it's worth realizing that:
|
|
25
|
-
#
|
|
26
|
-
# * It's managed by the SpinGroup#wait method, not individual tasks; and
|
|
27
|
-
# * It would be complete insanity to run two separate but concurrent SpinGroups.
|
|
28
|
-
#
|
|
29
|
-
# While it would be possible to stitch through some connection between
|
|
30
|
-
# the SpinGroup and the Widgets included in its title, this is simpler
|
|
31
|
-
# in practice and seems unlikely to cause issues in practice.
|
|
32
|
-
def current_rune
|
|
33
|
-
RUNES[index || 0]
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# Adds a single spinner
|
|
38
|
-
# Uses an interactive session to allow the user to pick an answer
|
|
39
|
-
# Can use arrows, y/n, numbers (1/2), and vim bindings to control
|
|
40
|
-
#
|
|
41
|
-
# https://user-images.githubusercontent.com/3074765/33798295-d94fd822-dce3-11e7-819b-43e5502d490e.gif
|
|
42
|
-
#
|
|
43
|
-
# ==== Attributes
|
|
44
|
-
#
|
|
45
|
-
# * +title+ - Title of the spinner to use
|
|
46
|
-
#
|
|
47
|
-
# ==== Options
|
|
48
|
-
#
|
|
49
|
-
# * +:auto_debrief+ - Automatically debrief exceptions? Default to true
|
|
50
|
-
#
|
|
51
|
-
# ==== Block
|
|
52
|
-
#
|
|
53
|
-
# * *spinner+ - Instance of the spinner. Can call +update_title+ to update the user of changes
|
|
54
|
-
#
|
|
55
|
-
# ==== Example Usage:
|
|
56
|
-
#
|
|
57
|
-
# CLI::UI::Spinner.spin('Title') { sleep 1.0 }
|
|
58
|
-
#
|
|
59
|
-
def self.spin(title, auto_debrief: true, &block)
|
|
60
|
-
sg = SpinGroup.new(auto_debrief: auto_debrief)
|
|
61
|
-
sg.add(title, &block)
|
|
62
|
-
sg.wait
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|