use serde::Deserialize;
use std::fmt::Display;
#[derive(Debug, Clone, Deserialize)]
pub enum NuPath {
Quoted(String),
UnQuoted(String),
}
impl NuPath {
pub fn strip_ansi_string_unlikely(self) -> Self {
match self {
NuPath::Quoted(s) => NuPath::Quoted(nu_utils::strip_ansi_string_unlikely(s)),
NuPath::UnQuoted(s) => NuPath::UnQuoted(nu_utils::strip_ansi_string_unlikely(s)),
}
}
}
impl AsRef<str> for NuPath {
fn as_ref(&self) -> &str {
match self {
NuPath::Quoted(s) | NuPath::UnQuoted(s) => s,
}
}
}
impl Display for NuPath {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.as_ref())
}
}