mirror of
https://github.com/nushell/nushell.git
synced 2025-03-13 15:08:43 +01:00
Merge 301f2812a7
into 0f6996b70d
This commit is contained in:
commit
c730a7c88b
@ -103,7 +103,7 @@ impl Command for Describe {
|
|||||||
"category" => Value::test_string("default"),
|
"category" => Value::test_string("default"),
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
"first_commit" => Value::test_string("date"),
|
"first_commit" => Value::test_string("datetime"),
|
||||||
"my_duration" => Value::test_string("duration"),
|
"my_duration" => Value::test_string("duration"),
|
||||||
)),
|
)),
|
||||||
))),
|
))),
|
||||||
|
@ -120,7 +120,7 @@ impl<'a> StyleComputer<'a> {
|
|||||||
("int".to_string(), ComputableStyle::Static(Color::White.normal())),
|
("int".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||||
("filesize".to_string(), ComputableStyle::Static(Color::Cyan.normal())),
|
("filesize".to_string(), ComputableStyle::Static(Color::Cyan.normal())),
|
||||||
("duration".to_string(), ComputableStyle::Static(Color::White.normal())),
|
("duration".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||||
("date".to_string(), ComputableStyle::Static(Color::Purple.normal())),
|
("datetime".to_string(), ComputableStyle::Static(Color::Purple.normal())),
|
||||||
("range".to_string(), ComputableStyle::Static(Color::White.normal())),
|
("range".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||||
("float".to_string(), ComputableStyle::Static(Color::White.normal())),
|
("float".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||||
("string".to_string(), ComputableStyle::Static(Color::White.normal())),
|
("string".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||||
|
@ -208,7 +208,7 @@ fn process_cell(val: Value, display_as_filesizes: bool, span: Span) -> Result<Va
|
|||||||
}
|
}
|
||||||
} else if DATETIME_DMY_RE.is_match(&val_str).unwrap_or(false) {
|
} else if DATETIME_DMY_RE.is_match(&val_str).unwrap_or(false) {
|
||||||
let dt = parse_date_from_string(&val_str, span).map_err(|_| ShellError::CantConvert {
|
let dt = parse_date_from_string(&val_str, span).map_err(|_| ShellError::CantConvert {
|
||||||
to_type: "date".to_string(),
|
to_type: "datetime".to_string(),
|
||||||
from_type: "string".to_string(),
|
from_type: "string".to_string(),
|
||||||
span,
|
span,
|
||||||
help: Some(format!(
|
help: Some(format!(
|
||||||
@ -219,7 +219,7 @@ fn process_cell(val: Value, display_as_filesizes: bool, span: Span) -> Result<Va
|
|||||||
Ok(Value::date(dt, span))
|
Ok(Value::date(dt, span))
|
||||||
} else if DATETIME_YMD_RE.is_match(&val_str).unwrap_or(false) {
|
} else if DATETIME_YMD_RE.is_match(&val_str).unwrap_or(false) {
|
||||||
let dt = parse_date_from_string(&val_str, span).map_err(|_| ShellError::CantConvert {
|
let dt = parse_date_from_string(&val_str, span).map_err(|_| ShellError::CantConvert {
|
||||||
to_type: "date".to_string(),
|
to_type: "datetime".to_string(),
|
||||||
from_type: "string".to_string(),
|
from_type: "string".to_string(),
|
||||||
span,
|
span,
|
||||||
help: Some(format!(
|
help: Some(format!(
|
||||||
@ -230,7 +230,7 @@ fn process_cell(val: Value, display_as_filesizes: bool, span: Span) -> Result<Va
|
|||||||
Ok(Value::date(dt, span))
|
Ok(Value::date(dt, span))
|
||||||
} else if DATETIME_YMDZ_RE.is_match(&val_str).unwrap_or(false) {
|
} else if DATETIME_YMDZ_RE.is_match(&val_str).unwrap_or(false) {
|
||||||
let dt = parse_date_from_string(&val_str, span).map_err(|_| ShellError::CantConvert {
|
let dt = parse_date_from_string(&val_str, span).map_err(|_| ShellError::CantConvert {
|
||||||
to_type: "date".to_string(),
|
to_type: "datetime".to_string(),
|
||||||
from_type: "string".to_string(),
|
from_type: "string".to_string(),
|
||||||
span,
|
span,
|
||||||
help: Some(format!(
|
help: Some(format!(
|
||||||
|
File diff suppressed because one or more lines are too long
@ -303,7 +303,7 @@ fn from_nuon_datetime() {
|
|||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_eq!(actual.out, "date");
|
assert_eq!(actual.out, "datetime");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -135,7 +135,7 @@ impl Type {
|
|||||||
Type::Closure => String::from("closure"),
|
Type::Closure => String::from("closure"),
|
||||||
Type::Bool => String::from("bool"),
|
Type::Bool => String::from("bool"),
|
||||||
Type::CellPath => String::from("cell-path"),
|
Type::CellPath => String::from("cell-path"),
|
||||||
Type::Date => String::from("date"),
|
Type::Date => String::from("datetime"),
|
||||||
Type::Duration => String::from("duration"),
|
Type::Duration => String::from("duration"),
|
||||||
Type::Filesize => String::from("filesize"),
|
Type::Filesize => String::from("filesize"),
|
||||||
Type::Float => String::from("float"),
|
Type::Float => String::from("float"),
|
||||||
@ -162,7 +162,7 @@ impl Display for Type {
|
|||||||
Type::Closure => write!(f, "closure"),
|
Type::Closure => write!(f, "closure"),
|
||||||
Type::Bool => write!(f, "bool"),
|
Type::Bool => write!(f, "bool"),
|
||||||
Type::CellPath => write!(f, "cell-path"),
|
Type::CellPath => write!(f, "cell-path"),
|
||||||
Type::Date => write!(f, "date"),
|
Type::Date => write!(f, "datetime"),
|
||||||
Type::Duration => write!(f, "duration"),
|
Type::Duration => write!(f, "duration"),
|
||||||
Type::Filesize => write!(f, "filesize"),
|
Type::Filesize => write!(f, "filesize"),
|
||||||
Type::Float => write!(f, "float"),
|
Type::Float => write!(f, "float"),
|
||||||
|
@ -324,7 +324,7 @@ impl Value {
|
|||||||
if let Value::Date { val, .. } = self {
|
if let Value::Date { val, .. } = self {
|
||||||
Ok(*val)
|
Ok(*val)
|
||||||
} else {
|
} else {
|
||||||
self.cant_convert_to("date")
|
self.cant_convert_to("datetime")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ export def dark-theme [] {
|
|||||||
int: white
|
int: white
|
||||||
filesize: cyan
|
filesize: cyan
|
||||||
duration: white
|
duration: white
|
||||||
date: purple
|
datetime: purple
|
||||||
range: white
|
range: white
|
||||||
float: white
|
float: white
|
||||||
string: white
|
string: white
|
||||||
@ -81,7 +81,7 @@ export def light-theme [] {
|
|||||||
int: dark_gray
|
int: dark_gray
|
||||||
filesize: cyan_bold
|
filesize: cyan_bold
|
||||||
duration: dark_gray
|
duration: dark_gray
|
||||||
date: purple
|
datetime: purple
|
||||||
range: dark_gray
|
range: dark_gray
|
||||||
float: dark_gray
|
float: dark_gray
|
||||||
string: dark_gray
|
string: dark_gray
|
||||||
|
@ -10,7 +10,7 @@ $env.config.color_config = {
|
|||||||
int: white
|
int: white
|
||||||
filesize: cyan
|
filesize: cyan
|
||||||
duration: white
|
duration: white
|
||||||
date: purple
|
datetime: purple
|
||||||
range: white
|
range: white
|
||||||
float: white
|
float: white
|
||||||
string: white
|
string: white
|
||||||
|
Loading…
Reference in New Issue
Block a user