nu_protocol/errors/
parse_warning.rs

1use crate::Span;
2use miette::Diagnostic;
3use serde::{Deserialize, Serialize};
4use thiserror::Error;
5
6#[derive(Clone, Debug, Error, Diagnostic, Serialize, Deserialize)]
7pub enum ParseWarning {
8    #[error("Deprecated: {old_command}")]
9    #[diagnostic(help("for more info see {url}"))]
10    DeprecatedWarning {
11        old_command: String,
12        new_suggestion: String,
13        #[label("`{old_command}` is deprecated and will be removed in a future release. Please {new_suggestion} instead.")]
14        span: Span,
15        url: String,
16    },
17}
18
19impl ParseWarning {
20    pub fn span(&self) -> Span {
21        match self {
22            ParseWarning::DeprecatedWarning { span, .. } => *span,
23        }
24    }
25}