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, 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 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 |
# 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) available_commands = resolved_commands.select { |_name, c| !c.hidden? } available_commands.each do |name, klass| next if name == "help" @ctx.puts("{{command:#{name}}}: #{klass.help}\n") end end |