Class: Pipely::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/pipely/options.rb

Overview

Options for running the CLI

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#automatic_openObject

Returns the value of attribute automatic_open.



9
10
11
# File 'lib/pipely/options.rb', line 9

def automatic_open
  @automatic_open
end

#input_pathObject

Returns the value of attribute input_path.



9
10
11
# File 'lib/pipely/options.rb', line 9

def input_path
  @input_path
end

#json_outputObject

Returns the value of attribute json_output.



9
10
11
# File 'lib/pipely/options.rb', line 9

def json_output
  @json_output
end

#latest_runObject

Returns the value of attribute latest_run.



9
10
11
# File 'lib/pipely/options.rb', line 9

def latest_run
  @latest_run
end

#output_pathObject

Returns the value of attribute output_path.



9
10
11
# File 'lib/pipely/options.rb', line 9

def output_path
  @output_path
end

#pipeline_idObject

Returns the value of attribute pipeline_id.



9
10
11
# File 'lib/pipely/options.rb', line 9

def pipeline_id
  @pipeline_id
end

#verboseObject

Returns the value of attribute verbose.



9
10
11
# File 'lib/pipely/options.rb', line 9

def verbose
  @verbose
end

Class Method Details

.parseObject



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
41
42
43
# File 'lib/pipely/options.rb', line 12

def self.parse
  options = Pipely::Options.new

  OptionParser.new do |opts|
    opts.banner = "Usage: pipely [options]"

    opts.on("-p", "--pipeline-id PIPELINE_ID",
      "ID of a live pipeline to visualize with live statuses") do |id|
      options.pipeline_id = id
    end

    opts.on("-l", "--latest", "Graph only the latest run") do |latest|
      options.latest_run = latest
    end

    opts.on("-i", "--input PATH",
      "Path to a JSON pipeline definition file to visualize") do |input|
      options.input_path = input
    end

    opts.on("-o", "--output PATH",
      "Local or S3 path to write Graphviz PNG file(s)") do |output|
      options.output_path = output
    end

    opts.on("-j", "--json", "Write STDOUT formatted as JSON") do |json|
      options.json_output = json
    end
  end.parse!

  options
end