module BranchIOCLI::Format::MarkdownFormat
Public Instance Methods
header(text, level = 1)
click to toggle source
# File lib/branch_io_cli/format/markdown_format.rb, line 6 def header(text, level = 1) "#" * level + " #{text}" end
highlight(text)
click to toggle source
# File lib/branch_io_cli/format/markdown_format.rb, line 10 def highlight(text) "`#{text}`" end
italics(text)
click to toggle source
# File lib/branch_io_cli/format/markdown_format.rb, line 14 def italics(text) "_#{text}_" end
render_command(name)
click to toggle source
# File lib/branch_io_cli/format/markdown_format.rb, line 56 def render_command(name) @command = BranchIOCLI::Command.const_get("#{name.to_s.capitalize}Command") render :command end
table_option(option)
click to toggle source
# File lib/branch_io_cli/format/markdown_format.rb, line 22 def table_option(option) text = "|#{option.aliases.join(', ')}" text += ", " unless option.aliases.blank? text += "--" text += "[no-]" if option.negatable text += option.name.to_s.gsub(/_/, '-') if option.example text += " " text += "[" if option.argument_optional text += option.example text += "]" if option.argument_optional end text += "|#{option.description}" if option.type.nil? default_value = option.default_value ? "yes" : "no" else default_value = option.default_value end if default_value text += " (default: #{default_value})" end text += "|" text += option.env_name if option.env_name text += "|" text end
table_options()
click to toggle source
# File lib/branch_io_cli/format/markdown_format.rb, line 18 def table_options @command.available_options.map { |o| table_option o }.join("\n") end