Class: Wiq::Commands::Workflows
- Defined in:
- lib/wiq/commands/workflows.rb
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#list ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/wiq/commands/workflows.rb', line 30 def list rows = Wiq::Workflows::ALL.values.map { |w| summary_row(w) } render_index( rows, summary: "#{rows.size} documented workflows across #{Wiq::Workflows::CATEGORIES.size} categories.", breadcrumbs: [ { "cmd" => "wiq workflows show <name>", "description" => "Detail for one workflow" }, { "cmd" => "wiq commands", "description" => "Full command tree (for ad-hoc composition)" } ] ) end |
#show(name) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/wiq/commands/workflows.rb', line 50 def show(name) workflow = Wiq::Workflows::ALL[name] unless workflow available = Wiq::Workflows::ALL.keys.sort.join(", ") raise Wiq::Error.new( "Unknown workflow #{name.inspect}.", code: "workflow_not_found", hint: "Available: #{available}" ) end render(workflow, summary: "#{workflow[:name]} — #{workflow[:question]}", breadcrumbs: workflow[:recipe].map do |cmd| { "cmd" => cmd, "description" => "Run this step" } end) end |