Module: DocOpsLab::Dev::Help

Defined in:
lib/docopslab/dev/help.rb

Class Method Summary collapse

Class Method Details

.show_task_help(task_string = nil) ⇒ Object



10
11
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
44
45
46
47
# File 'lib/docopslab/dev/help.rb', line 10

def show_task_help task_string=nil
  tasks_def_path = File.join(GEM_ROOT, 'specs/data/tasks-def.yml')

  unless File.exist?(tasks_def_path)
    puts '❌ Tasks definition file not found'
    return
  end

  tasks_def = YAML.load_file(tasks_def_path)

  if task_string.nil?
    show_general_help
    return
  end

  # Normalize task string (allow with or without labdev: prefix)
  task_string = "labdev:#{task_string}" unless task_string.start_with?('labdev:')

  # Parse task path
  task_parts = task_string.sub('labdev:', '').split(':')

  # Navigate to task in YAML structure
  current = tasks_def['labdev']
  found = true
  task_parts.each do |part|
    if current.is_a?(Hash) && current[part]
      current = current[part]
    else
      puts "❌ Task not found: #{task_string}"
      found = false
      break
    end
  end

  return unless found

  show_task_details(task_string, current)
end