Skip to main content
function Task.alias
def Task.alias(
*,
defaults: dict[str, typing.Any] = …,
summary: str = …,
description: str = …,
friendly_kind: str = …,
group: list[str] = [],
kind: str = …
) -> Task
Define an alias of this task with overridden arg defaults. The alias is a new top-level CLI command that shares this task’s implementation, traits and show_task_options, but exposes overridden defaults for one or more of its args. The base task is undisturbed — both commands coexist, and a CLI flag still wins over the alias’s default (so aspect buildifier --formatter-target=X overrides the alias default).

Naming

Assign the result to a snake_case variable; the task kind (CLI command name) is derived from the variable. The base task’s kind is never inherited. Use kind = "explicit-kind" to override.

Constraints

  • defaults keys must already exist on the base task.
  • The value type must match the base arg’s variant (args.string → str, args.int → int, args.string_list → list[str], etc.). args.string(values = [...]) re-checks membership on the new default.
  • args.trailing_var_args carries no default in the schema and cannot be overridden via defaults.
  • Aliases cannot add args beyond the base. Use task() if you need to.

Example