attr deprecated
for core
Attribute for marking a command or flag as deprecated.
Signature
> attr deprecated {flags} (message)
Flags
--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
Parameters
message
: Help message to include with deprecation warning.
Input/output types:
input | output |
---|---|
nothing | nothing |
nothing | string |
Examples
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.
Notes
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