Home / Function/ resolveCommand() — astro Function Reference

resolveCommand() — astro Function Reference

Architecture documentation for the resolveCommand() function in index.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  6302ee25_0719_bd98_a65a_ef18d03c4616["resolveCommand()"]
  77e94539_cbbc_447e_0bb6_d3977c1fa5b1["index.ts"]
  6302ee25_0719_bd98_a65a_ef18d03c4616 -->|defined in| 77e94539_cbbc_447e_0bb6_d3977c1fa5b1
  7bca0dcc_def0_4a57_f212_a606fe44f550["cli()"]
  7bca0dcc_def0_4a57_f212_a606fe44f550 -->|calls| 6302ee25_0719_bd98_a65a_ef18d03c4616
  style 6302ee25_0719_bd98_a65a_ef18d03c4616 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/cli/index.ts lines 20–46

function resolveCommand(flags: yargs.Arguments): CLICommand {
	const cmd = flags._[2] as string;
	if (flags.version) return 'version';

	const supportedCommands = new Set([
		'add',
		'sync',
		'telemetry',
		'preferences',
		'dev',
		'build',
		'preview',
		'check',
		'create-key',
		'docs',
		'db',
		'info',
		'login',
		'logout',
		'link',
		'init',
	]);
	if (supportedCommands.has(cmd)) {
		return cmd as CLICommand;
	}
	return 'help';
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does resolveCommand() do?
resolveCommand() is a function in the astro codebase, defined in packages/astro/src/cli/index.ts.
Where is resolveCommand() defined?
resolveCommand() is defined in packages/astro/src/cli/index.ts at line 20.
What calls resolveCommand()?
resolveCommand() is called by 1 function(s): cli.

Analyze Your Own Codebase

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

Try Supermodel Free