mirror of
https://github.com/nushell/nushell.git
synced 2025-02-20 12:32:05 +01:00
rename the types with spaces in them to use -
(#9929)
# Description before this PR, ```nushell > $.a.b | describe cell path ``` which feels inconsistent with the `cell-path` type annotation, like in ```nushell > def foo [x: cell-path] { $x | describe }; foo $.a.b cell path ``` this PR changes the name of the "cell path" type from `cell path` to `cell-path` # User-Facing Changes `cell path` is now `cell-path` in the output of `describe`. this might be a breaking change in some scripts. same goes with - `list stream` -> `list-stream` - `match pattern` -> `match-pattern` # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - ⚫ `toolkit test` - ⚫ `toolkit test stdlib` this PR adds a new `cell_path_type` test to make sure it stays equal to `cell-path` in the future. # After Submitting --------- Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
This commit is contained in:
parent
bb06661d24
commit
7486850357
@ -161,7 +161,7 @@ impl<'a> StyleComputer<'a> {
|
|||||||
("string".to_string(), ComputableStyle::Static(Color::White.normal())),
|
("string".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||||
("nothing".to_string(), ComputableStyle::Static(Color::White.normal())),
|
("nothing".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||||
("binary".to_string(), ComputableStyle::Static(Color::White.normal())),
|
("binary".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||||
("cellpath".to_string(), ComputableStyle::Static(Color::White.normal())),
|
("cell-path".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||||
("row_index".to_string(), ComputableStyle::Static(Color::Green.bold())),
|
("row_index".to_string(), ComputableStyle::Static(Color::Green.bold())),
|
||||||
("record".to_string(), ComputableStyle::Static(Color::White.normal())),
|
("record".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||||
("list".to_string(), ComputableStyle::Static(Color::White.normal())),
|
("list".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||||
|
@ -161,7 +161,7 @@ pub fn value_to_string(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Value::CellPath { .. } => Err(ShellError::UnsupportedInput(
|
Value::CellPath { .. } => Err(ShellError::UnsupportedInput(
|
||||||
"cellpaths are currently not nuon-compatible".to_string(),
|
"cell-paths are currently not nuon-compatible".to_string(),
|
||||||
"value originates from here".into(),
|
"value originates from here".into(),
|
||||||
span,
|
span,
|
||||||
v.span(),
|
v.span(),
|
||||||
|
@ -36,7 +36,7 @@ impl Command for SubCommand {
|
|||||||
Signature::build("str replace")
|
Signature::build("str replace")
|
||||||
.input_output_types(vec![
|
.input_output_types(vec![
|
||||||
(Type::String, Type::String),
|
(Type::String, Type::String),
|
||||||
// TODO: clarify behavior with cellpath-rest argument
|
// TODO: clarify behavior with cell-path-rest argument
|
||||||
(Type::Table(vec![]), Type::Table(vec![])),
|
(Type::Table(vec![]), Type::Table(vec![])),
|
||||||
(Type::Record(vec![]), Type::Record(vec![])),
|
(Type::Record(vec![]), Type::Record(vec![])),
|
||||||
(
|
(
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1243,7 +1243,7 @@ fn collect_profiling_metadata(
|
|||||||
if profiling_config.collect_values {
|
if profiling_config.collect_values {
|
||||||
let value = match &eval_result {
|
let value = match &eval_result {
|
||||||
Ok((PipelineData::Value(val, ..), ..)) => val.clone(),
|
Ok((PipelineData::Value(val, ..), ..)) => val.clone(),
|
||||||
Ok((PipelineData::ListStream(..), ..)) => Value::string("list stream", element_span),
|
Ok((PipelineData::ListStream(..), ..)) => Value::string("list-stream", element_span),
|
||||||
Ok((PipelineData::ExternalStream { .. }, ..)) => {
|
Ok((PipelineData::ExternalStream { .. }, ..)) => {
|
||||||
Value::string("raw stream", element_span)
|
Value::string("raw stream", element_span)
|
||||||
}
|
}
|
||||||
|
@ -184,8 +184,8 @@ impl Display for SyntaxShape {
|
|||||||
}
|
}
|
||||||
SyntaxShape::Any => write!(f, "any"),
|
SyntaxShape::Any => write!(f, "any"),
|
||||||
SyntaxShape::String => write!(f, "string"),
|
SyntaxShape::String => write!(f, "string"),
|
||||||
SyntaxShape::CellPath => write!(f, "cellpath"),
|
SyntaxShape::CellPath => write!(f, "cell-path"),
|
||||||
SyntaxShape::FullCellPath => write!(f, "cellpath"),
|
SyntaxShape::FullCellPath => write!(f, "cell-path"),
|
||||||
SyntaxShape::Number => write!(f, "number"),
|
SyntaxShape::Number => write!(f, "number"),
|
||||||
SyntaxShape::Range => write!(f, "range"),
|
SyntaxShape::Range => write!(f, "range"),
|
||||||
SyntaxShape::Int => write!(f, "int"),
|
SyntaxShape::Int => write!(f, "int"),
|
||||||
@ -229,8 +229,8 @@ impl Display for SyntaxShape {
|
|||||||
SyntaxShape::Variable => write!(f, "var"),
|
SyntaxShape::Variable => write!(f, "var"),
|
||||||
SyntaxShape::VarWithOptType => write!(f, "vardecl"),
|
SyntaxShape::VarWithOptType => write!(f, "vardecl"),
|
||||||
SyntaxShape::Signature => write!(f, "signature"),
|
SyntaxShape::Signature => write!(f, "signature"),
|
||||||
SyntaxShape::MatchPattern => write!(f, "matchpattern"),
|
SyntaxShape::MatchPattern => write!(f, "match-pattern"),
|
||||||
SyntaxShape::MatchBlock => write!(f, "matchblock"),
|
SyntaxShape::MatchBlock => write!(f, "match-block"),
|
||||||
SyntaxShape::Expression => write!(f, "expression"),
|
SyntaxShape::Expression => write!(f, "expression"),
|
||||||
SyntaxShape::Boolean => write!(f, "bool"),
|
SyntaxShape::Boolean => write!(f, "bool"),
|
||||||
SyntaxShape::Error => write!(f, "error"),
|
SyntaxShape::Error => write!(f, "error"),
|
||||||
|
@ -121,7 +121,7 @@ impl Type {
|
|||||||
Type::Block => String::from("block"),
|
Type::Block => String::from("block"),
|
||||||
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("date"),
|
||||||
Type::Duration => String::from("duration"),
|
Type::Duration => String::from("duration"),
|
||||||
Type::Filesize => String::from("filesize"),
|
Type::Filesize => String::from("filesize"),
|
||||||
@ -131,11 +131,11 @@ impl Type {
|
|||||||
Type::Record(_) => String::from("record"),
|
Type::Record(_) => String::from("record"),
|
||||||
Type::Table(_) => String::from("table"),
|
Type::Table(_) => String::from("table"),
|
||||||
Type::List(_) => String::from("list"),
|
Type::List(_) => String::from("list"),
|
||||||
Type::MatchPattern => String::from("match pattern"),
|
Type::MatchPattern => String::from("match-pattern"),
|
||||||
Type::Nothing => String::from("nothing"),
|
Type::Nothing => String::from("nothing"),
|
||||||
Type::Number => String::from("number"),
|
Type::Number => String::from("number"),
|
||||||
Type::String => String::from("string"),
|
Type::String => String::from("string"),
|
||||||
Type::ListStream => String::from("list stream"),
|
Type::ListStream => String::from("list-stream"),
|
||||||
Type::Any => String::from("any"),
|
Type::Any => String::from("any"),
|
||||||
Type::Error => String::from("error"),
|
Type::Error => String::from("error"),
|
||||||
Type::Binary => String::from("binary"),
|
Type::Binary => String::from("binary"),
|
||||||
@ -151,7 +151,7 @@ impl Display for Type {
|
|||||||
Type::Block => write!(f, "block"),
|
Type::Block => write!(f, "block"),
|
||||||
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, "date"),
|
||||||
Type::Duration => write!(f, "duration"),
|
Type::Duration => write!(f, "duration"),
|
||||||
Type::Filesize => write!(f, "filesize"),
|
Type::Filesize => write!(f, "filesize"),
|
||||||
@ -192,13 +192,13 @@ impl Display for Type {
|
|||||||
Type::Nothing => write!(f, "nothing"),
|
Type::Nothing => write!(f, "nothing"),
|
||||||
Type::Number => write!(f, "number"),
|
Type::Number => write!(f, "number"),
|
||||||
Type::String => write!(f, "string"),
|
Type::String => write!(f, "string"),
|
||||||
Type::ListStream => write!(f, "list stream"),
|
Type::ListStream => write!(f, "list-stream"),
|
||||||
Type::Any => write!(f, "any"),
|
Type::Any => write!(f, "any"),
|
||||||
Type::Error => write!(f, "error"),
|
Type::Error => write!(f, "error"),
|
||||||
Type::Binary => write!(f, "binary"),
|
Type::Binary => write!(f, "binary"),
|
||||||
Type::Custom(custom) => write!(f, "{custom}"),
|
Type::Custom(custom) => write!(f, "{custom}"),
|
||||||
Type::Signature => write!(f, "signature"),
|
Type::Signature => write!(f, "signature"),
|
||||||
Type::MatchPattern => write!(f, "match pattern"),
|
Type::MatchPattern => write!(f, "match-pattern"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -518,7 +518,7 @@ impl Value {
|
|||||||
match self {
|
match self {
|
||||||
Value::MatchPattern { val, .. } => Ok(val.as_ref()),
|
Value::MatchPattern { val, .. } => Ok(val.as_ref()),
|
||||||
x => Err(ShellError::CantConvert {
|
x => Err(ShellError::CantConvert {
|
||||||
to_type: "match pattern".into(),
|
to_type: "match-pattern".into(),
|
||||||
from_type: x.get_type().to_string(),
|
from_type: x.get_type().to_string(),
|
||||||
span: self.span(),
|
span: self.span(),
|
||||||
help: None,
|
help: None,
|
||||||
|
@ -25,7 +25,7 @@ let dark_theme = {
|
|||||||
string: white
|
string: white
|
||||||
nothing: white
|
nothing: white
|
||||||
binary: white
|
binary: white
|
||||||
cellpath: white
|
cell-path: white
|
||||||
row_index: green_bold
|
row_index: green_bold
|
||||||
record: white
|
record: white
|
||||||
list: white
|
list: white
|
||||||
@ -88,7 +88,7 @@ let light_theme = {
|
|||||||
string: dark_gray
|
string: dark_gray
|
||||||
nothing: dark_gray
|
nothing: dark_gray
|
||||||
binary: dark_gray
|
binary: dark_gray
|
||||||
cellpath: dark_gray
|
cell-path: dark_gray
|
||||||
row_index: green_bold
|
row_index: green_bold
|
||||||
record: white
|
record: white
|
||||||
list: white
|
list: white
|
||||||
|
@ -504,7 +504,7 @@ pub fn hover(engine_state: &mut EngineState, file_path: &String, location: &Valu
|
|||||||
FlatShape::MatchPattern => println!(
|
FlatShape::MatchPattern => println!(
|
||||||
"{}",
|
"{}",
|
||||||
json!({
|
json!({
|
||||||
"hover": "match pattern",
|
"hover": "match-pattern",
|
||||||
"span": {
|
"span": {
|
||||||
"start": span.start - offset,
|
"start": span.start - offset,
|
||||||
"end": span.end - offset
|
"end": span.end - offset
|
||||||
|
@ -149,3 +149,8 @@ fn deeply_nested_cell_path_short_circuits() -> TestResult {
|
|||||||
"null",
|
"null",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn cell_path_type() -> TestResult {
|
||||||
|
run_test("$.a.b | describe", "cell-path")
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user