Class: ShopifyCli::Commands::Help
- Inherits:
-
ShopifyCli::Command
- Object
- CLI::Kit::BaseCommand
- ShopifyCli::Command
- ShopifyCli::Commands::Help
- Defined in:
- lib/shopify-cli/commands/help.rb
Instance Attribute Summary
Attributes inherited from ShopifyCli::Command
Instance Method Summary collapse
Methods inherited from ShopifyCli::Command
call, call_help, #initialize, options, prerequisite_task, run_prerequisites, subcommand, subcommand_registry
Methods included from Feature::Set
Constructor Details
This class inherits a constructor from ShopifyCli::Command
Instance Method Details
#call(args, _name) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/shopify-cli/commands/help.rb', line 6 def call(args, _name) command = args.shift if command && command != 'help' if Registry.exist?(command) cmd, _ = Registry.lookup_command(command) subcmd, _ = cmd.subcommand_registry.lookup_command(args.first) if subcmd display_help(subcmd) else display_help(cmd) end return else @ctx.puts(@ctx.('core.help.error.command_not_found', command)) end end preamble = @ctx.('core.help.preamble', ShopifyCli::TOOL_NAME) @ctx.puts(preamble) core_commands.each do |name, klass| next if name == 'help' @ctx.puts("{{command:#{name}}}: #{klass.help}\n") end return unless inside_supported_project? @ctx.puts("{{bold:Project: #{Project.project_name} (#{project_type_name})}}") @ctx.puts("{{bold:Available commands for #{project_type_name} projects:}}\n\n") local_commands.each do |name, klass| next if name == 'help' @ctx.puts("{{command:#{name}}}: #{klass.help}\n") end end |