Thursday, June 04, 2026 1:09:27 AM
> command_usage_docs_component.rb
# frozen_string_literal: true

class CommandUsageDocsComponent < ApplicationComponent
  include ArgumentFormatting

  def on_load(command:)
    @command = command
  end

  def call
    arguments =
      @command.arguments.join_map(" ") do |name, argument|
        semantic_class = argument_semantic_class(name, argument)

        format_argument(
          argument["display_name"],
          "arg #{semantic_class}",
          placeholder: argument["placeholder"]
        )
      end

    content_tag(:span, "#{@command.usage} #{arguments}".html_safe, class: "command")
  end
end
All opinions represented herein are my own
- © 2024 - 2026 itsthedevman
- build 4294fb2