Home / Function/ help() — tailwindcss Function Reference

help() — tailwindcss Function Reference

Architecture documentation for the help() function in index.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  536d70f5_8cf8_3fe4_a1c5_0a1bd03cddb7["help()"]
  48860a26_2cb5_7783_52eb_1425db7e2b6a["index.ts"]
  536d70f5_8cf8_3fe4_a1c5_0a1bd03cddb7 -->|defined in| 48860a26_2cb5_7783_52eb_1425db7e2b6a
  f6a9bc09_432a_b5bb_eb44_bc4f13e8440c["println()"]
  536d70f5_8cf8_3fe4_a1c5_0a1bd03cddb7 -->|calls| f6a9bc09_432a_b5bb_eb44_bc4f13e8440c
  40879e7c_6052_5415_9e87_08e9d72485cc["header()"]
  536d70f5_8cf8_3fe4_a1c5_0a1bd03cddb7 -->|calls| 40879e7c_6052_5415_9e87_08e9d72485cc
  ae7c115f_7716_cd13_a2b3_1f18f0fb894b["wordWrap()"]
  536d70f5_8cf8_3fe4_a1c5_0a1bd03cddb7 -->|calls| ae7c115f_7716_cd13_a2b3_1f18f0fb894b
  b7302b8b_2a71_5858_7c85_180f6f8421ae["indent()"]
  536d70f5_8cf8_3fe4_a1c5_0a1bd03cddb7 -->|calls| b7302b8b_2a71_5858_7c85_180f6f8421ae
  2510a705_0f7b_6670_5f65_0e5ef7bde36c["highlight()"]
  536d70f5_8cf8_3fe4_a1c5_0a1bd03cddb7 -->|calls| 2510a705_0f7b_6670_5f65_0e5ef7bde36c
  style 536d70f5_8cf8_3fe4_a1c5_0a1bd03cddb7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-cli/src/commands/help/index.ts lines 5–174

export function help({
  invalid,
  usage,
  options,
}: {
  invalid?: string
  usage?: string[]
  options?: Arg
}) {
  // Available terminal width
  let width = process.stdout.columns

  // Render header
  println(header())

  // Render the invalid command
  if (invalid) {
    println()
    println(`${pc.dim('Invalid command:')} ${invalid}`)
  }

  // Render usage
  if (usage && usage.length > 0) {
    println()
    println(pc.dim('Usage:'))
    for (let [idx, example] of usage.entries()) {
      // Split the usage example into the command and its options. This allows
      // us to wrap the options based on the available width of the terminal.
      let command = example.slice(0, example.indexOf('['))
      let options = example.slice(example.indexOf('['))

      // Make the options dimmed, to make them stand out less than the command
      // itself.
      options = options.replace(/\[.*?\]/g, (option) => pc.dim(option))

      // The space between the command and the options.
      let space = 1

      // Wrap the options based on the available width of the terminal.
      let lines = wordWrap(options, width - UI.indent - command.length - space)

      // Print an empty line between the usage examples if we need to split due
      // to width constraints. This ensures that the usage examples are visually
      // separated.
      //
      // E.g.: when enough space is available
      //
      // ```
      //   Usage:
      //     tailwindcss build [--input input.css] [--output output.css] [--watch] [options...]
      //     tailwindcss other [--watch] [options...]
      // ```
      //
      // E.g.: when not enough space is available
      //
      // ```
      //   Usage:
      //     tailwindcss build [--input input.css] [--output output.css]
      //                       [--watch] [options...]
      //
      //     tailwindcss other [--watch] [options...]
      // ```
      if (lines.length > 1 && idx !== 0) {
        println()
      }

      // Print the usage examples based on available width of the terminal.
      //
      // E.g.: when enough space is available
      //
      // ```
      //   Usage:
      //     tailwindcss [--input input.css] [--output output.css] [--watch] [options...]
      // ```
      //
      // E.g.: when not enough space is available
      //
      // ```
      //   Usage:
      //     tailwindcss [--input input.css] [--output output.css]
      //                 [--watch] [options...]

Subdomains

Frequently Asked Questions

What does help() do?
help() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-cli/src/commands/help/index.ts.
Where is help() defined?
help() is defined in packages/@tailwindcss-cli/src/commands/help/index.ts at line 5.
What does help() call?
help() calls 5 function(s): header, highlight, indent, println, wordWrap.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free