attributes

package
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package attributes holds metadata a command applies to itself.

Go has no attributes and no reflection over declarations, so metadata that would otherwise be read back off a class is instead a value with an Apply method: the declaration stays next to the type it describes, and it is checked by the compiler rather than read back at some later point.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Description

type Description struct {
	// Description is the sentence. One line, imperative, no full stop.
	Description string
}

Description is the line a listing prints beside a command name.

func (Description) Apply

func (d Description) Apply(c *console.Command)

Apply writes the description onto a command.

type Signature

type Signature struct {
	// Signature is the expression Parse reads: "mail:send {user} {--queue=}".
	Signature string

	// Aliases are the other names the command answers to. Nil leaves whatever
	// the command already had.
	Aliases []string
}

Signature is the name, arguments and options of a command, with its aliases.

func (Signature) Apply

func (s Signature) Apply(c *console.Command)

Apply writes the signature onto a command.

The aliases are set too, but only when this carries some.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL