Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

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:

inputoutput
nothingnothing
nothingstring

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