| title | attr deprecated |
|---|---|
| categories | core |
| version | 0.109.0 |
| core | Attribute for marking a command or flag as deprecated. |
| usage | Attribute for marking a command or flag as deprecated. |
| editLink | false |
| contributors | false |
attr deprecated for core
Attribute for marking a command or flag as deprecated.
> attr deprecated {flags} (message)
--flag {string}: Mark a flag as deprecated rather than the command--since, -s {string}: Denote a version when this item was deprecated--remove, -r {string}: Denote a version when this item will be removed--report {string}: How to warn about this item. One of: first (default), every
message: Help message to include with deprecation warning.
| input | output |
|---|---|
| nothing | record |
Add a deprecation warning to a custom command
> @deprecated
def outdated [] {}
Add a deprecation warning with a custom message
> @deprecated "Use my-new-command instead."
@category deprecated
def my-old-command [] {}
Use my-new-command instead.Mark a command (default) or flag/switch (--flag) as deprecated. By default, only the first usage will trigger a deprecation warning.
A help message can be included to provide more context for the deprecation, such as what to use as a replacement.
Also consider setting the category to deprecated with @category deprecated