Class: Theme::Command::Delete
- Inherits:
-
ShopifyCLI::Command::SubCommand
- Object
- CLI::Kit::BaseCommand
- ShopifyCLI::Command
- ShopifyCLI::Command::SubCommand
- Theme::Command::Delete
- Includes:
- Common::ShopHelper
- Defined in:
- lib/project_types/theme/commands/delete.rb
Instance Attribute Summary
Attributes inherited from ShopifyCLI::Command
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Common::ShopHelper
Methods inherited from ShopifyCLI::Command::SubCommand
Methods inherited from ShopifyCLI::Command
call, call_help, check_node_version, check_ruby_version, check_version, #initialize, options, prerequisite_task, recommend_default_node_range, recommend_default_ruby_range, recommend_node, recommend_ruby, run_prerequisites, subcommand, subcommand_registry
Methods included from ShopifyCLI::Feature::Set
Constructor Details
This class inherits a constructor from ShopifyCLI::Command
Class Method Details
.help ⇒ Object
54 55 56 |
# File 'lib/project_types/theme/commands/delete.rb', line 54 def self.help ShopifyCLI::Context.("theme.delete.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME) end |
Instance Method Details
#call(args, _name) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/project_types/theme/commands/delete.rb', line 19 def call(args, _name) themes = if .flags[:development] [ShopifyCLI::Theme::DevelopmentTheme.new(@ctx)] elsif args.any? args.map { |id| ShopifyCLI::Theme::Theme.new(@ctx, id: id) } else form = Forms::Select.ask( @ctx, [], title: @ctx.("theme.delete.select", shop), exclude_roles: ["live"], include_foreign_developments: .flags[:show_all], cmd: :delete ) return unless form [form.theme] end deleted = 0 themes.each do |theme| if theme.live? @ctx.puts(@ctx.("theme.delete.live", theme.id)) next elsif !confirm?(theme) next end theme.delete deleted += 1 rescue ShopifyCLI::API::APIRequestNotFoundError @ctx.puts(@ctx.("theme.delete.not_found", theme.id)) end @ctx.done(@ctx.("theme.delete.done", deleted)) end |