Class: AocCli::Components::DocsComponent

Inherits:
Kangaru::Component
  • Object
show all
Includes:
Helpers::ViewHelper
Defined in:
lib/aoc_cli/components/docs_component.rb

Constant Summary collapse

ENDPOINTS =
{
  event: {
    description: "Handle event directories",
    commands: {
      init: "Create and initialise an event directory",
      progress: "Check your progress for the current event"
    }
  },

  puzzle: {
    description: "Handle puzzle directories",
    commands: {
      init: "Fetch and initialise puzzles for the current event",
      solve: "Submit and evaluate a puzzle solution",
      sync: "Ensure puzzle files are up to date",
      attempts: "Review previous attempts for the current puzzle"
    }
  }
}.freeze

Instance Method Summary collapse

Methods included from Helpers::ViewHelper

#heading, #main_header, #success_tag, #table_for, #wrap_text

Instance Method Details

#commands_table(commands, indent: 0) ⇒ Object



34
35
36
37
38
# File 'lib/aoc_cli/components/docs_component.rb', line 34

def commands_table(commands, indent: 0)
  rows = commands.transform_keys(&:to_s).to_a

  table_for(*rows, gap: 4, indent:)
end

#endpointsObject



26
27
28
# File 'lib/aoc_cli/components/docs_component.rb', line 26

def endpoints
  ENDPOINTS
end

#titleObject



30
31
32
# File 'lib/aoc_cli/components/docs_component.rb', line 30

def title
  "Advent of Code CLI"
end