Documentation
¶
Overview ¶
Package deprecation provides the CLI deprecation warning system.
Usage:
reg, err := deprecation.LoadRegistry("internal/deprecation/registry.yaml")
if err != nil {
// warn in debug log, do not crash
}
if item, ok := reg.Lookup("nself old-cmd"); ok {
reg.Warn(os.Stderr, item)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Item ¶
type Item struct {
Name string `yaml:"name"`
Type ItemType `yaml:"type"`
Since string `yaml:"since"`
Replacement string `yaml:"replacement"`
DocsURL string `yaml:"docs_url"`
Phase int `yaml:"phase"`
}
Item represents a single deprecated CLI element.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds the loaded deprecation entries.
func LoadRegistry ¶
LoadRegistry reads the YAML registry file and returns a Registry. If the file does not exist or fails to parse, it returns an empty Registry and a non-nil error (caller should log in debug mode, not crash).
func (*Registry) IsDeprecated ¶
IsDeprecated returns true if the given name is in the registry.
Click to show internal directories.
Click to hide internal directories.