Class: Fp::Commands::Surfaces
Overview
fp surfaces --project
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Fp::Commands::Base
Instance Method Details
#run(args) ⇒ Object
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 |
# File 'lib/fp/commands/surfaces.rb', line 7 def run(args) opts, = parse_flags(args) require_flag(opts, :project) workspace_id = resolve_workspace_id(opts[:project]) result = client.get_project(workspace_id) unless result[:ok] output.error(result[:error], status: result[:status]) exit 1 end workspace = result[:data]['workspace'] surfaces = workspace['available_surfaces'] || [] output.success({ surfaces: surfaces, project: opts[:project] }) do if surfaces.empty? puts "No surfaces configured for project '#{opts[:project]}'." puts 'Configure available_surfaces in the web app.' else puts "Surfaces for '#{opts[:project]}':" surfaces.each { |s| puts " - #{s}" } end end end |