Class: FluidCLI::Commands::Theme::Navigate

Inherits:
FluidCLI::Command show all
Defined in:
lib/fluid_cli/commands/theme/navigate.rb

Constant Summary collapse

DEFAULT_HTTP_HOST =
"127.0.0.1"
DEFAULT_PORT =
9292

Instance Attribute Summary

Attributes inherited from FluidCLI::Command

#ctx, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FluidCLI::Command

call, call_help, #initialize, options, subcommand, subcommand_registry

Constructor Details

This class inherits a constructor from FluidCLI::Command

Class Method Details

.helpObject



31
32
33
# File 'lib/fluid_cli/commands/theme/navigate.rb', line 31

def self.help
  "Interactively select a route and resource to navigate to in the theme dev server."
end

Instance Method Details

#call(_args, _name) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fluid_cli/commands/theme/navigate.rb', line 18

def call(_args, _name)
  valid_authentication_method!

  flags = options.flags.dup
  host = flags[:host] || DEFAULT_HTTP_HOST
  port = flags[:port] || DEFAULT_PORT
  address = "http://#{host}:#{port}"

  theme_id = resolve_theme_id(flags[:theme])

  FluidCLI::Theme::Navigation::RouteNavigator.new(@ctx, address, theme_id).navigate
end