Module: Jenkins::CLI::Formatting::ClassMethods

Defined in:
lib/jenkins/cli/formatting.rb

Instance Method Summary collapse

Instance Method Details



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/jenkins/cli/formatting.rb', line 20

def print_options(shell, options, grp = nil)
  return if options.empty?
  table = options.map do |option|
    prototype = if option.default
      " [#{option.default}]"
    elsif option.boolean?
      ""
    elsif option.required?
      " #{option.banner}"
    else
      " [#{option.banner}]"
    end
    aliases = option.aliases.empty? ? "" : option.aliases.join(" ") + ","
    [aliases, "--#{option.name}#{prototype}", "\t",option.description]
  end
  shell.print_table(table, :ident => 2)
  shell.say
end

#task_help(shell, task_name) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/jenkins/cli/formatting.rb', line 7

def task_help(shell, task_name)
  meth = normalize_task_name(task_name)
  task = all_tasks[meth]
  handle_no_task_error(meth) unless task

  shell.say "usage: #{banner(task)}"
  shell.say
  class_options_help(shell, nil => task.options.map { |_, o| o })
  # shell.say task.description
  # shell.say
end