渲染zh-Hans

可选项

Translation status: 简体中文 reader-locale proof. Term names and code fences follow the zh-Hans pack; supporting prose may still be English.

Binds CLI options metadata to a function declaration.

Syntax: 函数 <name>(...) 可选项 <ident> → <type>

Category#

entry

Examples#

radix/corpus/optiones/optiones.fab (canonical · keyword)#

Binds CLI options metadata to a function declaration.

# =============================================================================
# 可选项 — Binds CLI options metadata to a function declaration.
# =============================================================================
#
# What this teaches:
#   • Options bundle — The `可选项 <ident> → <type>` syntax attaches a CLI options struct to a function.
#   • Declaration syntax — Options are declared as a modifier on the function signature, after the parameter list.
#
# Common mistakes:
#   • Duplicate flag definitions in 可选项 — each short and long flag must be unique within the CLI surface.
#
# See also: 参数, 调用
# =============================================================================

# 可选项 — CLI options bundle on 函数
#
# GRAMMAR:
#   funcModifier :← ')' '可选项' ident '→' type
#
# EXPECTED OUTPUT:
#   No 入口 — declaration or test-runner surface only.
#
# BACKEND:
#   declaration-only CLI binding (whitelist: 可选项/optiones.fab).
#

fn mitte() options Opts → string {
    return "ok"
}