Home / Function/ show() — astro Function Reference

show() — astro Function Reference

Architecture documentation for the show() function in logger-help-display.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  c66d7c9c_8d90_fc5e_a585_c97f780f3c9d["show()"]
  e9da6ffc_2f74_41ea_1bcb_58b6a2429c73["LoggerHelpDisplay"]
  c66d7c9c_8d90_fc5e_a585_c97f780f3c9d -->|defined in| e9da6ffc_2f74_41ea_1bcb_58b6a2429c73
  style c66d7c9c_8d90_fc5e_a585_c97f780f3c9d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/cli/infra/logger-help-display.ts lines 35–88

	show({ commandName, description, headline, tables, usage }: HelpPayload): void {
		const linebreak = () => '';
		const title = (label: string) =>
			`  ${this.#textStyler.bgWhite(this.#textStyler.black(` ${label} `))}`;
		const table = (rows: [string, string][], { padding }: { padding: number }) => {
			const split = process.stdout.columns < 60;
			let raw = '';

			for (const row of rows) {
				if (split) {
					raw += `    ${row[0]}\n    `;
				} else {
					raw += `${`${row[0]}`.padStart(padding)}`;
				}
				raw += '  ' + this.#textStyler.dim(row[1]) + '\n';
			}

			return raw.slice(0, -1); // remove latest \n
		};

		let message = [];

		if (headline) {
			message.push(
				linebreak(),
				`${formatVersion({ name: commandName, textStyler: this.#textStyler, astroVersionProvider: this.#astroVersionProvider })} ${headline}`,
			);
		}

		if (usage) {
			message.push(
				linebreak(),
				`  ${this.#textStyler.green(commandName)} ${this.#textStyler.bold(usage)}`,
			);
		}

		if (tables) {
			function calculateTablePadding(rows: [string, string][]) {
				return rows.reduce((val, [first]) => Math.max(val, first.length), 0) + 2;
			}

			const tableEntries = Object.entries(tables);
			const padding = Math.max(...tableEntries.map(([, rows]) => calculateTablePadding(rows)));
			for (const [tableTitle, tableRows] of tableEntries) {
				message.push(linebreak(), title(tableTitle), table(tableRows, { padding }));
			}
		}

		if (description) {
			message.push(linebreak(), `${description}`);
		}

		this.#logger.info('SKIP_FORMAT', message.join('\n') + '\n');
	}

Domain

Subdomains

Frequently Asked Questions

What does show() do?
show() is a function in the astro codebase, defined in packages/astro/src/cli/infra/logger-help-display.ts.
Where is show() defined?
show() is defined in packages/astro/src/cli/infra/logger-help-display.ts at line 35.

Analyze Your Own Codebase

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

Try Supermodel Free