diff --git a/crates/nu-cli/src/commands/autoview/command.rs b/crates/nu-cli/src/commands/autoview/command.rs index 24a9a7d13..4e50287fe 100644 --- a/crates/nu-cli/src/commands/autoview/command.rs +++ b/crates/nu-cli/src/commands/autoview/command.rs @@ -134,7 +134,7 @@ pub async fn autoview(context: RunnableContext) -> Result { out!("{}", s.display()); diff --git a/crates/nu-cli/src/commands/cd.rs b/crates/nu-cli/src/commands/cd.rs index 779fd9abb..a08850146 100644 --- a/crates/nu-cli/src/commands/cd.rs +++ b/crates/nu-cli/src/commands/cd.rs @@ -23,7 +23,7 @@ impl WholeStreamCommand for Cd { fn signature(&self) -> Signature { Signature::build("cd").optional( "directory", - SyntaxShape::Path, + SyntaxShape::FilePath, "the directory to change to", ) } diff --git a/crates/nu-cli/src/commands/config/load.rs b/crates/nu-cli/src/commands/config/load.rs index 4489624b4..10b333a76 100644 --- a/crates/nu-cli/src/commands/config/load.rs +++ b/crates/nu-cli/src/commands/config/load.rs @@ -21,7 +21,7 @@ impl WholeStreamCommand for SubCommand { fn signature(&self) -> Signature { Signature::build("config load").required( "load", - SyntaxShape::Path, + SyntaxShape::FilePath, "Path to load the config from", ) } diff --git a/crates/nu-cli/src/commands/config/path.rs b/crates/nu-cli/src/commands/config/path.rs index 5b5e6787a..68d92c167 100644 --- a/crates/nu-cli/src/commands/config/path.rs +++ b/crates/nu-cli/src/commands/config/path.rs @@ -36,6 +36,6 @@ pub async fn path(args: CommandArgs) -> Result { let path = config::default_path()?; Ok(OutputStream::one(ReturnSuccess::value( - UntaggedValue::Primitive(Primitive::Path(path)).into_value(args.call_info.name_tag), + UntaggedValue::Primitive(Primitive::FilePath(path)).into_value(args.call_info.name_tag), ))) } diff --git a/crates/nu-cli/src/commands/cp.rs b/crates/nu-cli/src/commands/cp.rs index 68140253b..5d2bbebbb 100644 --- a/crates/nu-cli/src/commands/cp.rs +++ b/crates/nu-cli/src/commands/cp.rs @@ -22,8 +22,8 @@ impl WholeStreamCommand for Cpy { fn signature(&self) -> Signature { Signature::build("cp") - .required("src", SyntaxShape::Pattern, "the place to copy from") - .required("dst", SyntaxShape::Path, "the place to copy to") + .required("src", SyntaxShape::GlobPattern, "the place to copy from") + .required("dst", SyntaxShape::FilePath, "the place to copy to") .switch( "recursive", "copy recursively through subdirectories", diff --git a/crates/nu-cli/src/commands/du.rs b/crates/nu-cli/src/commands/du.rs index 873041563..763012b1d 100644 --- a/crates/nu-cli/src/commands/du.rs +++ b/crates/nu-cli/src/commands/du.rs @@ -38,7 +38,7 @@ impl WholeStreamCommand for Du { fn signature(&self) -> Signature { Signature::build(NAME) - .optional("path", SyntaxShape::Pattern, "starting directory") + .optional("path", SyntaxShape::GlobPattern, "starting directory") .switch( "all", "Output file sizes as well as directory sizes", @@ -51,7 +51,7 @@ impl WholeStreamCommand for Du { ) .named( "exclude", - SyntaxShape::Pattern, + SyntaxShape::GlobPattern, "Exclude these file names", Some('x'), ) @@ -347,7 +347,7 @@ impl From for Value { r.insert( "path".to_string(), - UntaggedValue::path(d.path).into_value(&d.tag), + UntaggedValue::filepath(d.path).into_value(&d.tag), ); r.insert( @@ -389,7 +389,7 @@ impl From for Value { r.insert( "path".to_string(), - UntaggedValue::path(f.path).into_value(&f.tag), + UntaggedValue::filepath(f.path).into_value(&f.tag), ); r.insert( diff --git a/crates/nu-cli/src/commands/enter.rs b/crates/nu-cli/src/commands/enter.rs index a706127b0..06ac7ee07 100644 --- a/crates/nu-cli/src/commands/enter.rs +++ b/crates/nu-cli/src/commands/enter.rs @@ -27,7 +27,7 @@ impl WholeStreamCommand for Enter { Signature::build("enter") .required( "location", - SyntaxShape::Path, + SyntaxShape::FilePath, "the location to create a new shell from", ) .named( diff --git a/crates/nu-cli/src/commands/exec.rs b/crates/nu-cli/src/commands/exec.rs index 1347c6f8e..71009df4d 100644 --- a/crates/nu-cli/src/commands/exec.rs +++ b/crates/nu-cli/src/commands/exec.rs @@ -21,8 +21,11 @@ impl WholeStreamCommand for Exec { fn signature(&self) -> Signature { Signature::build("exec") - .required("command", SyntaxShape::Path, "the command to execute") - .rest(SyntaxShape::Pattern, "any additional arguments for command") + .required("command", SyntaxShape::FilePath, "the command to execute") + .rest( + SyntaxShape::GlobPattern, + "any additional arguments for command", + ) } fn usage(&self) -> &str { diff --git a/crates/nu-cli/src/commands/ls.rs b/crates/nu-cli/src/commands/ls.rs index c6a0387c1..b355b1fca 100644 --- a/crates/nu-cli/src/commands/ls.rs +++ b/crates/nu-cli/src/commands/ls.rs @@ -28,7 +28,7 @@ impl WholeStreamCommand for Ls { Signature::build("ls") .optional( "path", - SyntaxShape::Pattern, + SyntaxShape::GlobPattern, "a path to get the directory contents from", ) .switch("all", "Show hidden files", Some('a')) diff --git a/crates/nu-cli/src/commands/mkdir.rs b/crates/nu-cli/src/commands/mkdir.rs index 160660750..4a34d1073 100644 --- a/crates/nu-cli/src/commands/mkdir.rs +++ b/crates/nu-cli/src/commands/mkdir.rs @@ -22,7 +22,10 @@ impl WholeStreamCommand for Mkdir { fn signature(&self) -> Signature { Signature::build("mkdir") - .rest(SyntaxShape::Path, "the name(s) of the path(s) to create") + .rest( + SyntaxShape::FilePath, + "the name(s) of the path(s) to create", + ) .switch("show-created-paths", "show the path(s) created.", Some('s')) } diff --git a/crates/nu-cli/src/commands/move_/mv.rs b/crates/nu-cli/src/commands/move_/mv.rs index 2c0757d61..44562b5ca 100644 --- a/crates/nu-cli/src/commands/move_/mv.rs +++ b/crates/nu-cli/src/commands/move_/mv.rs @@ -23,12 +23,12 @@ impl WholeStreamCommand for Mv { Signature::build("mv") .required( "source", - SyntaxShape::Pattern, + SyntaxShape::GlobPattern, "the location to move files/directories from", ) .required( "destination", - SyntaxShape::Path, + SyntaxShape::FilePath, "the location to move files/directories to", ) } diff --git a/crates/nu-cli/src/commands/nu/plugin.rs b/crates/nu-cli/src/commands/nu/plugin.rs index 7ab1a6126..acf7fb0a4 100644 --- a/crates/nu-cli/src/commands/nu/plugin.rs +++ b/crates/nu-cli/src/commands/nu/plugin.rs @@ -28,7 +28,7 @@ impl WholeStreamCommand for SubCommand { fn signature(&self) -> Signature { Signature::build("nu plugin").named( "load", - SyntaxShape::Path, + SyntaxShape::FilePath, "a path to load the plugins from", Some('l'), ) diff --git a/crates/nu-cli/src/commands/open.rs b/crates/nu-cli/src/commands/open.rs index 1d9512627..b77db75fb 100644 --- a/crates/nu-cli/src/commands/open.rs +++ b/crates/nu-cli/src/commands/open.rs @@ -29,7 +29,7 @@ impl WholeStreamCommand for Open { Signature::build(self.name()) .required( "path", - SyntaxShape::Path, + SyntaxShape::FilePath, "the file path to load values from", ) .switch( diff --git a/crates/nu-cli/src/commands/path/basename.rs b/crates/nu-cli/src/commands/path/basename.rs index 3631dc6f5..fdadb208a 100644 --- a/crates/nu-cli/src/commands/path/basename.rs +++ b/crates/nu-cli/src/commands/path/basename.rs @@ -59,7 +59,7 @@ impl WholeStreamCommand for PathBasename { Example { description: "Replace basename of a path", example: "echo 'C:\\Users\\joe\\test.txt' | path basename -r 'spam.png'", - result: Some(vec![Value::from(UntaggedValue::path( + result: Some(vec![Value::from(UntaggedValue::filepath( "C:\\Users\\joe\\spam.png", ))]), }, @@ -77,7 +77,9 @@ impl WholeStreamCommand for PathBasename { Example { description: "Replace basename of a path", example: "echo '/home/joe/test.txt' | path basename -r 'spam.png'", - result: Some(vec![Value::from(UntaggedValue::path("/home/joe/spam.png"))]), + result: Some(vec![Value::from(UntaggedValue::filepath( + "/home/joe/spam.png", + ))]), }, ] } @@ -85,7 +87,7 @@ impl WholeStreamCommand for PathBasename { fn action(path: &Path, args: Arc) -> UntaggedValue { match args.replace { - Some(ref basename) => UntaggedValue::path(path.with_file_name(basename)), + Some(ref basename) => UntaggedValue::filepath(path.with_file_name(basename)), None => UntaggedValue::string(match path.file_name() { Some(filename) => filename.to_string_lossy(), None => "".into(), diff --git a/crates/nu-cli/src/commands/path/dirname.rs b/crates/nu-cli/src/commands/path/dirname.rs index 6abafe970..ac0eafbb6 100644 --- a/crates/nu-cli/src/commands/path/dirname.rs +++ b/crates/nu-cli/src/commands/path/dirname.rs @@ -69,20 +69,20 @@ impl WholeStreamCommand for PathDirname { Example { description: "Get dirname of a path", example: "echo 'C:\\Users\\joe\\code\\test.txt' | path dirname", - result: Some(vec![Value::from(UntaggedValue::path( + result: Some(vec![Value::from(UntaggedValue::filepath( "C:\\Users\\joe\\code", ))]), }, Example { description: "Set how many levels up to skip", example: "echo 'C:\\Users\\joe\\code\\test.txt' | path dirname -n 2", - result: Some(vec![Value::from(UntaggedValue::path("C:\\Users\\joe"))]), + result: Some(vec![Value::from(UntaggedValue::filepath("C:\\Users\\joe"))]), }, Example { description: "Replace the part that would be returned with custom string", example: "echo 'C:\\Users\\joe\\code\\test.txt' | path dirname -n 2 -r C:\\Users\\viking", - result: Some(vec![Value::from(UntaggedValue::path( + result: Some(vec![Value::from(UntaggedValue::filepath( "C:\\Users\\viking\\code\\test.txt", ))]), }, @@ -95,17 +95,17 @@ impl WholeStreamCommand for PathDirname { Example { description: "Get dirname of a path", example: "echo '/home/joe/code/test.txt' | path dirname", - result: Some(vec![Value::from(UntaggedValue::path("/home/joe/code"))]), + result: Some(vec![Value::from(UntaggedValue::filepath("/home/joe/code"))]), }, Example { description: "Set how many levels up to skip", example: "echo '/home/joe/code/test.txt' | path dirname -n 2", - result: Some(vec![Value::from(UntaggedValue::path("/home/joe"))]), + result: Some(vec![Value::from(UntaggedValue::filepath("/home/joe"))]), }, Example { description: "Replace the part that would be returned with custom string", example: "echo '/home/joe/code/test.txt' | path dirname -n 2 -r /home/viking", - result: Some(vec![Value::from(UntaggedValue::path( + result: Some(vec![Value::from(UntaggedValue::filepath( "/home/viking/code/test.txt", ))]), }, @@ -132,12 +132,12 @@ fn action(path: &Path, args: Arc) -> UntaggedValue { Some(ref newdir) => { let remainder = path.strip_prefix(dirname).unwrap_or(dirname); if !remainder.as_os_str().is_empty() { - UntaggedValue::path(Path::new(newdir).join(remainder)) + UntaggedValue::filepath(Path::new(newdir).join(remainder)) } else { - UntaggedValue::path(Path::new(newdir)) + UntaggedValue::filepath(Path::new(newdir)) } } - None => UntaggedValue::path(dirname), + None => UntaggedValue::filepath(dirname), } } diff --git a/crates/nu-cli/src/commands/path/expand.rs b/crates/nu-cli/src/commands/path/expand.rs index d5836fd44..5ee42d182 100644 --- a/crates/nu-cli/src/commands/path/expand.rs +++ b/crates/nu-cli/src/commands/path/expand.rs @@ -65,7 +65,7 @@ fn action(path: &Path, _args: Arc) -> UntaggedValue { let ps = path.to_string_lossy(); let expanded = shellexpand::tilde(&ps); let path: &Path = expanded.as_ref().as_ref(); - UntaggedValue::path(dunce::canonicalize(path).unwrap_or_else(|_| PathBuf::from(path))) + UntaggedValue::filepath(dunce::canonicalize(path).unwrap_or_else(|_| PathBuf::from(path))) } #[cfg(test)] diff --git a/crates/nu-cli/src/commands/path/extension.rs b/crates/nu-cli/src/commands/path/extension.rs index 7a44a53ae..04247f8a7 100644 --- a/crates/nu-cli/src/commands/path/extension.rs +++ b/crates/nu-cli/src/commands/path/extension.rs @@ -63,12 +63,12 @@ impl WholeStreamCommand for PathExtension { Example { description: "Replace an extension with a custom string", example: "echo 'test.txt' | path extension -r md", - result: Some(vec![Value::from(UntaggedValue::path("test.md"))]), + result: Some(vec![Value::from(UntaggedValue::filepath("test.md"))]), }, Example { description: "To replace more complex extensions:", example: "echo 'test.tar.gz' | path extension -r '' | path extension -r txt", - result: Some(vec![Value::from(UntaggedValue::path("test.txt"))]), + result: Some(vec![Value::from(UntaggedValue::filepath("test.txt"))]), }, ] } @@ -76,7 +76,7 @@ impl WholeStreamCommand for PathExtension { fn action(path: &Path, args: Arc) -> UntaggedValue { match args.replace { - Some(ref extension) => UntaggedValue::path(path.with_extension(extension)), + Some(ref extension) => UntaggedValue::filepath(path.with_extension(extension)), None => UntaggedValue::string(match path.extension() { Some(extension) => extension.to_string_lossy(), None => "".into(), diff --git a/crates/nu-cli/src/commands/path/filestem.rs b/crates/nu-cli/src/commands/path/filestem.rs index 5db3be218..006d7450b 100644 --- a/crates/nu-cli/src/commands/path/filestem.rs +++ b/crates/nu-cli/src/commands/path/filestem.rs @@ -86,7 +86,7 @@ impl WholeStreamCommand for PathFilestem { Example { description: "Replace the filestem that would be returned", example: "echo 'C:\\Users\\joe\\bacon_lettuce.egg.gz' | path filestem -p bacon_ -s .egg.gz -r spam", - result: Some(vec![Value::from(UntaggedValue::path("C:\\Users\\joe\\bacon_spam.egg.gz"))]), + result: Some(vec![Value::from(UntaggedValue::filepath("C:\\Users\\joe\\bacon_spam.egg.gz"))]), }, ] } @@ -107,7 +107,7 @@ impl WholeStreamCommand for PathFilestem { Example { description: "Replace the filestem that would be returned", example: "echo '/home/joe/bacon_lettuce.egg.gz' | path filestem -p bacon_ -s .egg.gz -r spam", - result: Some(vec![Value::from(UntaggedValue::path("/home/joe/bacon_spam.egg.gz"))]), + result: Some(vec![Value::from(UntaggedValue::filepath("/home/joe/bacon_spam.egg.gz"))]), }, ] } @@ -152,7 +152,7 @@ fn action(path: &Path, args: Arc) -> UntaggedValue { match args.replace { Some(ref replace) => { let new_name = prefix + replace + &suffix; - UntaggedValue::path(path.with_file_name(&new_name)) + UntaggedValue::filepath(path.with_file_name(&new_name)) } None => UntaggedValue::string(stem), } diff --git a/crates/nu-cli/src/commands/path/mod.rs b/crates/nu-cli/src/commands/path/mod.rs index c88c0fb4c..cc8d0d2f5 100644 --- a/crates/nu-cli/src/commands/path/mod.rs +++ b/crates/nu-cli/src/commands/path/mod.rs @@ -46,7 +46,7 @@ where F: Fn(&Path, Arc) -> UntaggedValue + Send + 'static, { let v = match &v.value { - UntaggedValue::Primitive(Primitive::Path(buf)) => action(buf, args).into_value(v.tag()), + UntaggedValue::Primitive(Primitive::FilePath(buf)) => action(buf, args).into_value(v.tag()), UntaggedValue::Primitive(Primitive::String(s)) => { action(s.as_ref(), args).into_value(v.tag()) } diff --git a/crates/nu-cli/src/commands/rm.rs b/crates/nu-cli/src/commands/rm.rs index 775010c4c..5e31a487b 100644 --- a/crates/nu-cli/src/commands/rm.rs +++ b/crates/nu-cli/src/commands/rm.rs @@ -38,7 +38,7 @@ impl WholeStreamCommand for Remove { ) .switch("recursive", "delete subdirectories recursively", Some('r')) .switch("force", "suppress error when no file", Some('f')) - .rest(SyntaxShape::Pattern, "the file path(s) to remove") + .rest(SyntaxShape::GlobPattern, "the file path(s) to remove") } fn usage(&self) -> &str { diff --git a/crates/nu-cli/src/commands/save.rs b/crates/nu-cli/src/commands/save.rs index d1f4f1549..76e973480 100644 --- a/crates/nu-cli/src/commands/save.rs +++ b/crates/nu-cli/src/commands/save.rs @@ -140,7 +140,11 @@ impl WholeStreamCommand for Save { fn signature(&self) -> Signature { Signature::build("save") - .optional("path", SyntaxShape::Path, "the path to save contents to") + .optional( + "path", + SyntaxShape::FilePath, + "the path to save contents to", + ) .switch( "raw", "treat values as-is rather than auto-converting based on file extension", diff --git a/crates/nu-cli/src/commands/to_delimited_data.rs b/crates/nu-cli/src/commands/to_delimited_data.rs index e1871ee8f..f4fb58d2f 100644 --- a/crates/nu-cli/src/commands/to_delimited_data.rs +++ b/crates/nu-cli/src/commands/to_delimited_data.rs @@ -112,8 +112,8 @@ pub fn clone_tagged_value(v: &Value) -> Value { UntaggedValue::Primitive(Primitive::Int(i)) => { UntaggedValue::Primitive(Primitive::Int(i.clone())) } - UntaggedValue::Primitive(Primitive::Path(x)) => { - UntaggedValue::Primitive(Primitive::Path(x.clone())) + UntaggedValue::Primitive(Primitive::FilePath(x)) => { + UntaggedValue::Primitive(Primitive::FilePath(x.clone())) } UntaggedValue::Primitive(Primitive::Filesize(b)) => { UntaggedValue::Primitive(Primitive::Filesize(*b)) @@ -136,7 +136,7 @@ fn to_string_tagged_value(v: &Value) -> Result { | UntaggedValue::Primitive(Primitive::Filesize(_)) | UntaggedValue::Primitive(Primitive::Boolean(_)) | UntaggedValue::Primitive(Primitive::Decimal(_)) - | UntaggedValue::Primitive(Primitive::Path(_)) + | UntaggedValue::Primitive(Primitive::FilePath(_)) | UntaggedValue::Primitive(Primitive::Int(_)) => as_string(v), UntaggedValue::Primitive(Primitive::Date(d)) => Ok(d.to_string()), UntaggedValue::Primitive(Primitive::Nothing) => Ok(String::new()), diff --git a/crates/nu-cli/src/commands/to_json.rs b/crates/nu-cli/src/commands/to_json.rs index 4bce07e38..e95ff64ce 100644 --- a/crates/nu-cli/src/commands/to_json.rs +++ b/crates/nu-cli/src/commands/to_json.rs @@ -96,7 +96,7 @@ pub fn value_to_json_value(v: &Value) -> Result { )?)) } UntaggedValue::Primitive(Primitive::Nothing) => serde_json::Value::Null, - UntaggedValue::Primitive(Primitive::Pattern(s)) => serde_json::Value::String(s.clone()), + UntaggedValue::Primitive(Primitive::GlobPattern(s)) => serde_json::Value::String(s.clone()), UntaggedValue::Primitive(Primitive::String(s)) => serde_json::Value::String(s.clone()), UntaggedValue::Primitive(Primitive::ColumnPath(path)) => serde_json::Value::Array( path.iter() @@ -113,7 +113,7 @@ pub fn value_to_json_value(v: &Value) -> Result { }) .collect::, ShellError>>()?, ), - UntaggedValue::Primitive(Primitive::Path(s)) => { + UntaggedValue::Primitive(Primitive::FilePath(s)) => { serde_json::Value::String(s.display().to_string()) } diff --git a/crates/nu-cli/src/commands/to_toml.rs b/crates/nu-cli/src/commands/to_toml.rs index 77e090768..7dbaa7760 100644 --- a/crates/nu-cli/src/commands/to_toml.rs +++ b/crates/nu-cli/src/commands/to_toml.rs @@ -58,9 +58,9 @@ fn helper(v: &Value) -> Result { UntaggedValue::Primitive(Primitive::Nothing) => { toml::Value::String("".to_string()) } - UntaggedValue::Primitive(Primitive::Pattern(s)) => toml::Value::String(s.clone()), + UntaggedValue::Primitive(Primitive::GlobPattern(s)) => toml::Value::String(s.clone()), UntaggedValue::Primitive(Primitive::String(s)) => toml::Value::String(s.clone()), - UntaggedValue::Primitive(Primitive::Path(s)) => { + UntaggedValue::Primitive(Primitive::FilePath(s)) => { toml::Value::String(s.display().to_string()) } UntaggedValue::Primitive(Primitive::ColumnPath(path)) => toml::Value::Array( diff --git a/crates/nu-cli/src/commands/to_yaml.rs b/crates/nu-cli/src/commands/to_yaml.rs index 932277c9e..12fe760cf 100644 --- a/crates/nu-cli/src/commands/to_yaml.rs +++ b/crates/nu-cli/src/commands/to_yaml.rs @@ -58,7 +58,7 @@ pub fn value_to_yaml_value(v: &Value) -> Result { )?)) } UntaggedValue::Primitive(Primitive::Nothing) => serde_yaml::Value::Null, - UntaggedValue::Primitive(Primitive::Pattern(s)) => serde_yaml::Value::String(s.clone()), + UntaggedValue::Primitive(Primitive::GlobPattern(s)) => serde_yaml::Value::String(s.clone()), UntaggedValue::Primitive(Primitive::String(s)) => serde_yaml::Value::String(s.clone()), UntaggedValue::Primitive(Primitive::ColumnPath(path)) => { let mut out = vec![]; @@ -79,7 +79,7 @@ pub fn value_to_yaml_value(v: &Value) -> Result { serde_yaml::Value::Sequence(out) } - UntaggedValue::Primitive(Primitive::Path(s)) => { + UntaggedValue::Primitive(Primitive::FilePath(s)) => { serde_yaml::Value::String(s.display().to_string()) } diff --git a/crates/nu-cli/src/commands/touch.rs b/crates/nu-cli/src/commands/touch.rs index 28ced4af5..4e38757b9 100644 --- a/crates/nu-cli/src/commands/touch.rs +++ b/crates/nu-cli/src/commands/touch.rs @@ -23,10 +23,10 @@ impl WholeStreamCommand for Touch { Signature::build("touch") .required( "filename", - SyntaxShape::Path, + SyntaxShape::FilePath, "the path of the file you want to create", ) - .rest(SyntaxShape::Path, "additional files to create") + .rest(SyntaxShape::FilePath, "additional files to create") } fn usage(&self) -> &str { "creates one or more files" diff --git a/crates/nu-cli/src/commands/which_.rs b/crates/nu-cli/src/commands/which_.rs index ff07833d6..19d7e7f32 100644 --- a/crates/nu-cli/src/commands/which_.rs +++ b/crates/nu-cli/src/commands/which_.rs @@ -60,7 +60,7 @@ macro_rules! entry_path { ($arg:expr, $path:expr, $tag:expr) => { entry( $arg.clone(), - UntaggedValue::Primitive(Primitive::Path($path)).into_value($tag.clone()), + UntaggedValue::Primitive(Primitive::FilePath($path)).into_value($tag.clone()), false, $tag, ) diff --git a/crates/nu-cli/src/deserializer.rs b/crates/nu-cli/src/deserializer.rs index 62eeb8910..763de1b31 100644 --- a/crates/nu-cli/src/deserializer.rs +++ b/crates/nu-cli/src/deserializer.rs @@ -425,7 +425,7 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut ConfigDeserializer<'de> { .. } => visit::, _>(false.tagged(tag), name, fields, visitor), Value { - value: UntaggedValue::Primitive(Primitive::Path(p)), + value: UntaggedValue::Primitive(Primitive::FilePath(p)), .. } => visit::, _>(p.tagged(tag), name, fields, visitor), Value { diff --git a/crates/nu-cli/src/evaluate/evaluator.rs b/crates/nu-cli/src/evaluate/evaluator.rs index 9e5665e94..2e336d3c1 100644 --- a/crates/nu-cli/src/evaluate/evaluator.rs +++ b/crates/nu-cli/src/evaluate/evaluator.rs @@ -29,7 +29,7 @@ pub(crate) async fn evaluate_baseline_expr( "Invalid external word".spanned(tag.span), ArgumentError::InvalidExternalWord, )), - Expression::FilePath(path) => Ok(UntaggedValue::path(path.clone()).into_value(tag)), + Expression::FilePath(path) => Ok(UntaggedValue::filepath(path.clone()).into_value(tag)), Expression::Synthetic(hir::Synthetic::String(s)) => { Ok(UntaggedValue::string(s).into_untagged_value()) } @@ -213,7 +213,7 @@ fn evaluate_literal(literal: &hir::Literal, span: Span) -> Value { }, hir::Literal::Size(int, unit) => unit.compute(&int).into_value(span), hir::Literal::String(string) => UntaggedValue::string(string).into_value(span), - hir::Literal::GlobPattern(pattern) => UntaggedValue::pattern(pattern).into_value(span), + hir::Literal::GlobPattern(pattern) => UntaggedValue::glob_pattern(pattern).into_value(span), hir::Literal::Bare(bare) => UntaggedValue::string(bare.clone()).into_value(span), hir::Literal::Operator(_) => unimplemented!("Not sure what to do with operator yet"), } diff --git a/crates/nu-cli/src/evaluate/variables.rs b/crates/nu-cli/src/evaluate/variables.rs index 59915ae54..6cf908cb8 100644 --- a/crates/nu-cli/src/evaluate/variables.rs +++ b/crates/nu-cli/src/evaluate/variables.rs @@ -23,30 +23,33 @@ pub fn nu(env: &IndexMap, tag: impl Into) -> Result, tag: impl Into) -> Result Option { Expression::Boolean(_) => Some(SyntaxShape::String), Expression::Path(_) => Some(SyntaxShape::ColumnPath), - Expression::FilePath(_) => Some(SyntaxShape::Path), + Expression::FilePath(_) => Some(SyntaxShape::FilePath), Expression::Block(_) => Some(SyntaxShape::Block), Expression::ExternalCommand(_) => Some(SyntaxShape::String), Expression::Table(_, _) => Some(SyntaxShape::Table), diff --git a/crates/nu-data/src/base.rs b/crates/nu-data/src/base.rs index c9384d10a..e5bb45059 100644 --- a/crates/nu-data/src/base.rs +++ b/crates/nu-data/src/base.rs @@ -149,10 +149,10 @@ pub fn coerce_compare_primitive( (Date(left), Date(right)) => CompareValues::Date(*left, *right), (Date(left), Duration(right)) => CompareValues::DateDuration(*left, right.clone()), (Boolean(left), Boolean(right)) => CompareValues::Booleans(*left, *right), - (Path(left), String(right)) => { + (FilePath(left), String(right)) => { CompareValues::String(left.as_path().display().to_string(), right.clone()) } - (String(left), Path(right)) => { + (String(left), FilePath(right)) => { CompareValues::String(left.clone(), right.as_path().display().to_string()) } _ => return Err((left.type_name(), right.type_name())), diff --git a/crates/nu-data/src/base/shape.rs b/crates/nu-data/src/base/shape.rs index 23cff8acf..f453d23e4 100644 --- a/crates/nu-data/src/base/shape.rs +++ b/crates/nu-data/src/base/shape.rs @@ -29,11 +29,11 @@ pub enum InlineShape { String(String), Line(String), ColumnPath(ColumnPath), - Pattern(String), + GlobPattern(String), Boolean(bool), Date(DateTime), Duration(BigInt), - Path(PathBuf), + FilePath(PathBuf), Binary(usize), Row(Row), @@ -72,11 +72,11 @@ impl InlineShape { Primitive::Filesize(bytesize) => InlineShape::Bytesize(*bytesize), Primitive::String(string) => InlineShape::String(string.clone()), Primitive::ColumnPath(path) => InlineShape::ColumnPath(path.clone()), - Primitive::Pattern(pattern) => InlineShape::Pattern(pattern.clone()), + Primitive::GlobPattern(pattern) => InlineShape::GlobPattern(pattern.clone()), Primitive::Boolean(boolean) => InlineShape::Boolean(*boolean), Primitive::Date(date) => InlineShape::Date(*date), Primitive::Duration(duration) => InlineShape::Duration(duration.clone()), - Primitive::Path(path) => InlineShape::Path(path.clone()), + Primitive::FilePath(path) => InlineShape::FilePath(path.clone()), Primitive::Binary(b) => InlineShape::Binary(b.len()), Primitive::BeginningOfStream => InlineShape::BeginningOfStream, Primitive::EndOfStream => InlineShape::EndOfStream, @@ -208,7 +208,7 @@ impl PrettyDebug for FormatInlineShape { InlineShape::ColumnPath(path) => { b::intersperse(path.iter().map(|member| member.pretty()), b::keyword(".")) } - InlineShape::Pattern(pattern) => b::primitive(pattern), + InlineShape::GlobPattern(pattern) => b::primitive(pattern), InlineShape::Boolean(boolean) => b::primitive( match (boolean, column) { (true, None) => "Yes", @@ -225,7 +225,7 @@ impl PrettyDebug for FormatInlineShape { &Primitive::Duration(duration.clone()), None, )), - InlineShape::Path(path) => b::primitive(path.display()), + InlineShape::FilePath(path) => b::primitive(path.display()), InlineShape::Binary(length) => b::opaque(format!("", length)), InlineShape::Row(row) => b::delimit( "[", diff --git a/crates/nu-data/src/config.rs b/crates/nu-data/src/config.rs index 69f030f79..42f0daf94 100644 --- a/crates/nu-data/src/config.rs +++ b/crates/nu-data/src/config.rs @@ -81,9 +81,9 @@ fn helper(v: &Value) -> Result { UntaggedValue::Primitive(Primitive::Nothing) => { toml::Value::String("".to_string()) } - UntaggedValue::Primitive(Primitive::Pattern(s)) => toml::Value::String(s.clone()), + UntaggedValue::Primitive(Primitive::GlobPattern(s)) => toml::Value::String(s.clone()), UntaggedValue::Primitive(Primitive::String(s)) => toml::Value::String(s.clone()), - UntaggedValue::Primitive(Primitive::Path(s)) => { + UntaggedValue::Primitive(Primitive::FilePath(s)) => { toml::Value::String(s.display().to_string()) } UntaggedValue::Primitive(Primitive::ColumnPath(path)) => toml::Value::Array( diff --git a/crates/nu-data/src/primitive.rs b/crates/nu-data/src/primitive.rs index c4fcb5017..017bdf2a9 100644 --- a/crates/nu-data/src/primitive.rs +++ b/crates/nu-data/src/primitive.rs @@ -91,12 +91,12 @@ pub fn string_to_lookup_value(str_prim: &str) -> String { "primitive_string" => "Primitive::String".to_string(), "primitive_line" => "Primitive::Line".to_string(), "primitive_columnpath" => "Primitive::ColumnPath".to_string(), - "primitive_pattern" => "Primitive::Pattern".to_string(), + "primitive_pattern" => "Primitive::GlobPattern".to_string(), "primitive_boolean" => "Primitive::Boolean".to_string(), "primitive_date" => "Primitive::Date".to_string(), "primitive_duration" => "Primitive::Duration".to_string(), "primitive_range" => "Primitive::Range".to_string(), - "primitive_path" => "Primitive::Path".to_string(), + "primitive_path" => "Primitive::FilePath".to_string(), "primitive_binary" => "Primitive::Binary".to_string(), "separator_color" => "separator_color".to_string(), "header_align" => "header_align".to_string(), @@ -269,8 +269,8 @@ pub fn style_primitive(primitive: &str, color_hm: &HashMap) -> Te None => TextStyle::basic_left(), } } - "Pattern" => { - let style = color_hm.get("Primitive::Pattern"); + "GlobPattern" => { + let style = color_hm.get("Primitive::GlobPattern"); match style { Some(s) => TextStyle::with_style(Alignment::Left, *s), None => TextStyle::basic_left(), @@ -304,8 +304,8 @@ pub fn style_primitive(primitive: &str, color_hm: &HashMap) -> Te None => TextStyle::basic_left(), } } - "Path" => { - let style = color_hm.get("Primitive::Path"); + "FilePath" => { + let style = color_hm.get("Primitive::FilePath"); match style { Some(s) => TextStyle::with_style(Alignment::Left, *s), None => TextStyle::basic_left(), diff --git a/crates/nu-data/src/types.rs b/crates/nu-data/src/types.rs index e98fdc056..2236a6e69 100644 --- a/crates/nu-data/src/types.rs +++ b/crates/nu-data/src/types.rs @@ -36,7 +36,7 @@ impl ExtractType for std::path::PathBuf { match &value { Value { - value: UntaggedValue::Primitive(Primitive::Path(p)), + value: UntaggedValue::Primitive(Primitive::FilePath(p)), .. } => Ok(p.clone()), other => Err(ShellError::type_error("Path", other.spanned_type_name())), diff --git a/crates/nu-parser/src/parse.rs b/crates/nu-parser/src/parse.rs index e7d848a9c..47b7e59a7 100644 --- a/crates/nu-parser/src/parse.rs +++ b/crates/nu-parser/src/parse.rs @@ -816,11 +816,11 @@ fn parse_arg( ) } } - SyntaxShape::Pattern => { + SyntaxShape::GlobPattern => { let trimmed = trim_quotes(&lite_arg.item); let expanded = expand_path(&trimmed).to_string(); ( - SpannedExpression::new(Expression::pattern(expanded), lite_arg.span), + SpannedExpression::new(Expression::glob_pattern(expanded), lite_arg.span), None, ) } @@ -828,7 +828,7 @@ fn parse_arg( SyntaxShape::Range => parse_range(&lite_arg, scope), SyntaxShape::Operator => parse_operator(&lite_arg), SyntaxShape::Unit => parse_unit(&lite_arg), - SyntaxShape::Path => { + SyntaxShape::FilePath => { let trimmed = trim_quotes(&lite_arg.item); let expanded = expand_path(&trimmed).to_string(); let path = Path::new(&expanded); @@ -2077,11 +2077,11 @@ fn parse_signature( let shape = match parts[1] { "int" => SyntaxShape::Int, "string" => SyntaxShape::String, - "path" => SyntaxShape::Path, + "path" => SyntaxShape::FilePath, "table" => SyntaxShape::Table, "unit" => SyntaxShape::Unit, "number" => SyntaxShape::Number, - "pattern" => SyntaxShape::Pattern, + "pattern" => SyntaxShape::GlobPattern, "range" => SyntaxShape::Range, "block" => SyntaxShape::Block, "any" => SyntaxShape::Any, @@ -2105,11 +2105,11 @@ fn parse_signature( let shape = match parts[1] { "int" => SyntaxShape::Int, "string" => SyntaxShape::String, - "path" => SyntaxShape::Path, + "path" => SyntaxShape::FilePath, "table" => SyntaxShape::Table, "unit" => SyntaxShape::Unit, "number" => SyntaxShape::Number, - "pattern" => SyntaxShape::Pattern, + "pattern" => SyntaxShape::GlobPattern, "range" => SyntaxShape::Range, "block" => SyntaxShape::Block, "any" => SyntaxShape::Any, diff --git a/crates/nu-protocol/src/hir.rs b/crates/nu-protocol/src/hir.rs index de489ec5f..23cc445f4 100644 --- a/crates/nu-protocol/src/hir.rs +++ b/crates/nu-protocol/src/hir.rs @@ -1092,7 +1092,7 @@ impl Expression { })) } - pub fn pattern(p: String) -> Expression { + pub fn glob_pattern(p: String) -> Expression { Expression::Literal(Literal::GlobPattern(p)) } diff --git a/crates/nu-protocol/src/syntax_shape.rs b/crates/nu-protocol/src/syntax_shape.rs index 16aca72cf..d581a2588 100644 --- a/crates/nu-protocol/src/syntax_shape.rs +++ b/crates/nu-protocol/src/syntax_shape.rs @@ -19,9 +19,9 @@ pub enum SyntaxShape { /// Only an integer value is allowed Int, /// A filepath is allowed - Path, + FilePath, /// A glob pattern is allowed, eg `foo*` - Pattern, + GlobPattern, /// A block is allowed, eg `{start this thing}` Block, /// A table is allowed, eg `[first second]` @@ -48,8 +48,8 @@ impl PrettyDebug for SyntaxShape { SyntaxShape::Number => "number", SyntaxShape::Range => "range", SyntaxShape::Int => "integer", - SyntaxShape::Path => "file path", - SyntaxShape::Pattern => "pattern", + SyntaxShape::FilePath => "file path", + SyntaxShape::GlobPattern => "pattern", SyntaxShape::Block => "block", SyntaxShape::Table => "table", SyntaxShape::Unit => "unit", diff --git a/crates/nu-protocol/src/type_shape.rs b/crates/nu-protocol/src/type_shape.rs index 9eb0dce11..a8fde26c0 100644 --- a/crates/nu-protocol/src/type_shape.rs +++ b/crates/nu-protocol/src/type_shape.rs @@ -43,7 +43,7 @@ pub enum Type { /// A path through a table ColumnPath, /// A glob pattern (like foo*) - Pattern, + GlobPattern, /// A boolean value Boolean, /// A date value (in UTC) @@ -51,7 +51,7 @@ pub enum Type { /// A data duration value Duration, /// A filepath value - Path, + FilePath, /// A binary (non-text) buffer value Binary, @@ -141,11 +141,11 @@ impl Type { Primitive::Filesize(_) => Type::Filesize, Primitive::String(_) => Type::String, Primitive::ColumnPath(_) => Type::ColumnPath, - Primitive::Pattern(_) => Type::Pattern, + Primitive::GlobPattern(_) => Type::GlobPattern, Primitive::Boolean(_) => Type::Boolean, Primitive::Date(_) => Type::Date, Primitive::Duration(_) => Type::Duration, - Primitive::Path(_) => Type::Path, + Primitive::FilePath(_) => Type::FilePath, Primitive::Binary(_) => Type::Binary, Primitive::BeginningOfStream => Type::BeginningOfStream, Primitive::EndOfStream => Type::EndOfStream, @@ -223,11 +223,11 @@ impl PrettyDebug for Type { Type::String => ty("string"), Type::Line => ty("line"), Type::ColumnPath => ty("column-path"), - Type::Pattern => ty("pattern"), + Type::GlobPattern => ty("pattern"), Type::Boolean => ty("boolean"), Type::Date => ty("date"), Type::Duration => ty("duration"), - Type::Path => ty("path"), + Type::FilePath => ty("path"), Type::Binary => ty("binary"), Type::Error => b::error("error"), Type::BeginningOfStream => b::keyword("beginning-of-stream"), diff --git a/crates/nu-protocol/src/value.rs b/crates/nu-protocol/src/value.rs index 69d48f7d8..2c2fd5d4c 100644 --- a/crates/nu-protocol/src/value.rs +++ b/crates/nu-protocol/src/value.rs @@ -175,13 +175,13 @@ impl UntaggedValue { } /// Helper for creating glob pattern values - pub fn pattern(s: impl Into) -> UntaggedValue { + pub fn glob_pattern(s: impl Into) -> UntaggedValue { UntaggedValue::Primitive(Primitive::String(s.into())) } /// Helper for creating filepath values - pub fn path(s: impl Into) -> UntaggedValue { - UntaggedValue::Primitive(Primitive::Path(s.into())) + pub fn filepath(s: impl Into) -> UntaggedValue { + UntaggedValue::Primitive(Primitive::FilePath(s.into())) } /// Helper for creating filesize values @@ -312,7 +312,7 @@ impl Value { pub fn as_string(&self) -> Result { match &self.value { UntaggedValue::Primitive(Primitive::String(string)) => Ok(string.clone()), - UntaggedValue::Primitive(Primitive::Path(path)) => { + UntaggedValue::Primitive(Primitive::FilePath(path)) => { Ok(path.to_string_lossy().to_string()) } _ => Err(ShellError::type_error("string", self.spanned_type_name())), @@ -327,7 +327,7 @@ impl Value { UntaggedValue::Primitive(Primitive::Decimal(x)) => format!("{}", x), UntaggedValue::Primitive(Primitive::Int(x)) => format!("{}", x), UntaggedValue::Primitive(Primitive::Filesize(x)) => format!("{}", x), - UntaggedValue::Primitive(Primitive::Path(x)) => format!("{}", x.display()), + UntaggedValue::Primitive(Primitive::FilePath(x)) => format!("{}", x.display()), UntaggedValue::Primitive(Primitive::ColumnPath(path)) => { let joined: String = path .iter() @@ -364,7 +364,7 @@ impl Value { /// View the Value as a path, if possible pub fn as_path(&self) -> Result { match &self.value { - UntaggedValue::Primitive(Primitive::Path(path)) => Ok(path.clone()), + UntaggedValue::Primitive(Primitive::FilePath(path)) => Ok(path.clone()), UntaggedValue::Primitive(Primitive::String(path_str)) => Ok(PathBuf::from(&path_str)), _ => Err(ShellError::type_error("Path", self.spanned_type_name())), } @@ -623,13 +623,13 @@ impl StringExt for String { fn to_pattern_value(&self, the_tag: Tag) -> Value { Value { - value: UntaggedValue::Primitive(Primitive::Pattern(self.to_string())), + value: UntaggedValue::Primitive(Primitive::GlobPattern(self.to_string())), tag: the_tag, } } fn to_pattern_untagged_value(&self) -> UntaggedValue { - UntaggedValue::pattern(self) + UntaggedValue::glob_pattern(self) } } @@ -682,13 +682,13 @@ impl StrExt for &str { fn to_pattern_value(&self, the_tag: Tag) -> Value { Value { - value: UntaggedValue::Primitive(Primitive::Pattern(self.to_string())), + value: UntaggedValue::Primitive(Primitive::GlobPattern(self.to_string())), tag: the_tag, } } fn to_pattern_untagged_value(&self) -> UntaggedValue { - UntaggedValue::pattern(*self) + UntaggedValue::glob_pattern(*self) } } @@ -830,7 +830,7 @@ impl PathBufExt for PathBuf { fn to_value(&self, the_tag: Tag) -> Value { let pb = self.clone(); Value { - value: UntaggedValue::Primitive(Primitive::Path(pb)), + value: UntaggedValue::Primitive(Primitive::FilePath(pb)), tag: the_tag, } } @@ -842,7 +842,7 @@ impl PathBufExt for PathBuf { .len(); let pb = self.clone(); Value { - value: UntaggedValue::Primitive(Primitive::Path(pb)), + value: UntaggedValue::Primitive(Primitive::FilePath(pb)), tag: Tag { anchor: None, span: Span::new(0, end), @@ -852,7 +852,7 @@ impl PathBufExt for PathBuf { fn to_untagged_value(&self) -> UntaggedValue { let pb = self.clone(); - UntaggedValue::path(pb) + UntaggedValue::filepath(pb) } } @@ -988,7 +988,7 @@ mod tests { let a_pattern = r"[a-zA-Z0-9 ]"; assert_eq!( a_pattern.to_pattern_untagged_value(), - UntaggedValue::pattern(a_pattern) + UntaggedValue::glob_pattern(a_pattern) ); } diff --git a/crates/nu-protocol/src/value/debug.rs b/crates/nu-protocol/src/value/debug.rs index 3c7766cc4..7a9aa5ed9 100644 --- a/crates/nu-protocol/src/value/debug.rs +++ b/crates/nu-protocol/src/value/debug.rs @@ -36,11 +36,11 @@ impl PrettyType for Primitive { Primitive::Filesize(_) => ty("filesize"), Primitive::String(_) => ty("string"), Primitive::ColumnPath(_) => ty("column-path"), - Primitive::Pattern(_) => ty("pattern"), + Primitive::GlobPattern(_) => ty("pattern"), Primitive::Boolean(_) => ty("boolean"), Primitive::Date(_) => ty("date"), Primitive::Duration(_) => ty("duration"), - Primitive::Path(_) => ty("path"), + Primitive::FilePath(_) => ty("path"), Primitive::Binary(_) => ty("binary"), Primitive::BeginningOfStream => b::keyword("beginning-of-stream"), Primitive::EndOfStream => b::keyword("end-of-stream"), @@ -73,14 +73,14 @@ impl PrettyDebug for Primitive { Primitive::Filesize(bytes) => primitive_doc(bytes, "filesize"), Primitive::String(string) => prim(string), Primitive::ColumnPath(path) => path.pretty(), - Primitive::Pattern(pattern) => primitive_doc(pattern, "pattern"), + Primitive::GlobPattern(pattern) => primitive_doc(pattern, "pattern"), Primitive::Boolean(boolean) => match boolean { true => b::primitive("$yes"), false => b::primitive("$no"), }, Primitive::Date(date) => primitive_doc(date, "date"), Primitive::Duration(duration) => primitive_doc(duration, "nanoseconds"), - Primitive::Path(path) => primitive_doc(path, "path"), + Primitive::FilePath(path) => primitive_doc(path, "path"), Primitive::Binary(_) => b::opaque("binary"), Primitive::BeginningOfStream => b::keyword("beginning-of-stream"), Primitive::EndOfStream => b::keyword("end-of-stream"), diff --git a/crates/nu-protocol/src/value/primitive.rs b/crates/nu-protocol/src/value/primitive.rs index ea4d25303..04be5326d 100644 --- a/crates/nu-protocol/src/value/primitive.rs +++ b/crates/nu-protocol/src/value/primitive.rs @@ -37,7 +37,7 @@ pub enum Primitive { /// A path to travel to reach a value in a table ColumnPath(ColumnPath), /// A glob pattern, eg foo* - Pattern(String), + GlobPattern(String), /// A boolean value Boolean(bool), /// A date value @@ -48,7 +48,7 @@ pub enum Primitive { /// A range of values Range(Box), /// A file path - Path(PathBuf), + FilePath(PathBuf), /// A vector of raw binary data #[serde(with = "serde_bytes")] Binary(Vec), @@ -234,11 +234,11 @@ impl ShellTypeName for Primitive { Primitive::Filesize(_) => "filesize(in bytes)", Primitive::String(_) => "string", Primitive::ColumnPath(_) => "column path", - Primitive::Pattern(_) => "pattern", + Primitive::GlobPattern(_) => "pattern", Primitive::Boolean(_) => "boolean", Primitive::Date(_) => "date", Primitive::Duration(_) => "duration", - Primitive::Path(_) => "file path", + Primitive::FilePath(_) => "file path", Primitive::Binary(_) => "binary", Primitive::BeginningOfStream => "marker", Primitive::EndOfStream => "marker", @@ -252,7 +252,7 @@ pub fn format_primitive(primitive: &Primitive, field_name: Option<&String>) -> S Primitive::Nothing => String::new(), Primitive::BeginningOfStream => String::new(), Primitive::EndOfStream => String::new(), - Primitive::Path(p) => format!("{}", p.display()), + Primitive::FilePath(p) => format!("{}", p.display()), Primitive::Filesize(num_bytes) => { let byte = byte_unit::Byte::from_bytes(*num_bytes as u128); @@ -289,7 +289,7 @@ pub fn format_primitive(primitive: &Primitive, field_name: Option<&String>) -> S }, format_primitive(&range.to.0.item, None) ), - Primitive::Pattern(s) => s.to_string(), + Primitive::GlobPattern(s) => s.to_string(), Primitive::String(s) => s.to_owned(), Primitive::ColumnPath(p) => { let mut members = p.iter(); diff --git a/crates/nu-value-ext/src/lib.rs b/crates/nu-value-ext/src/lib.rs index d08501869..1384bf88b 100644 --- a/crates/nu-value-ext/src/lib.rs +++ b/crates/nu-value-ext/src/lib.rs @@ -680,7 +680,7 @@ pub fn as_string(value: &Value) -> Result { UntaggedValue::Primitive(Primitive::Decimal(x)) => Ok(format!("{}", x)), UntaggedValue::Primitive(Primitive::Int(x)) => Ok(format!("{}", x)), UntaggedValue::Primitive(Primitive::Filesize(x)) => Ok(format!("{}", x)), - UntaggedValue::Primitive(Primitive::Path(x)) => Ok(format!("{}", x.display())), + UntaggedValue::Primitive(Primitive::FilePath(x)) => Ok(format!("{}", x.display())), UntaggedValue::Primitive(Primitive::ColumnPath(path)) => Ok(path .iter() .map(|member| match &member.unspanned { diff --git a/crates/nu_plugin_post/src/post.rs b/crates/nu_plugin_post/src/post.rs index 112cf134a..84f36e0ec 100644 --- a/crates/nu_plugin_post/src/post.rs +++ b/crates/nu_plugin_post/src/post.rs @@ -378,7 +378,7 @@ pub fn value_to_json_value(v: &Value) -> Result { )?)) } UntaggedValue::Primitive(Primitive::Nothing) => serde_json::Value::Null, - UntaggedValue::Primitive(Primitive::Pattern(s)) => serde_json::Value::String(s.clone()), + UntaggedValue::Primitive(Primitive::GlobPattern(s)) => serde_json::Value::String(s.clone()), UntaggedValue::Primitive(Primitive::String(s)) => serde_json::Value::String(s.clone()), UntaggedValue::Primitive(Primitive::ColumnPath(path)) => serde_json::Value::Array( path.iter() @@ -395,7 +395,7 @@ pub fn value_to_json_value(v: &Value) -> Result { }) .collect::, ShellError>>()?, ), - UntaggedValue::Primitive(Primitive::Path(s)) => { + UntaggedValue::Primitive(Primitive::FilePath(s)) => { serde_json::Value::String(s.display().to_string()) } diff --git a/crates/nu_plugin_to_bson/src/to_bson.rs b/crates/nu_plugin_to_bson/src/to_bson.rs index 4b963a429..5edf850cc 100644 --- a/crates/nu_plugin_to_bson/src/to_bson.rs +++ b/crates/nu_plugin_to_bson/src/to_bson.rs @@ -56,8 +56,8 @@ pub fn value_to_bson_value(v: &Value) -> Result { }) .collect::, ShellError>>()?, ), - UntaggedValue::Primitive(Primitive::Pattern(p)) => Bson::String(p.clone()), - UntaggedValue::Primitive(Primitive::Path(s)) => Bson::String(s.display().to_string()), + UntaggedValue::Primitive(Primitive::GlobPattern(p)) => Bson::String(p.clone()), + UntaggedValue::Primitive(Primitive::FilePath(s)) => Bson::String(s.display().to_string()), UntaggedValue::Table(l) => Bson::Array( l.iter() .map(|x| value_to_bson_value(x)) diff --git a/crates/nu_plugin_to_sqlite/src/to_sqlite.rs b/crates/nu_plugin_to_sqlite/src/to_sqlite.rs index d9760fedd..8874dc285 100644 --- a/crates/nu_plugin_to_sqlite/src/to_sqlite.rs +++ b/crates/nu_plugin_to_sqlite/src/to_sqlite.rs @@ -45,12 +45,12 @@ fn nu_value_to_sqlite_string(v: Value) -> String { Primitive::Duration(i) => format!("{}", i), Primitive::Decimal(f) => format!("{}", f), Primitive::Filesize(u) => format!("{}", u), - Primitive::Pattern(s) => format!("'{}'", s.replace("'", "''")), + Primitive::GlobPattern(s) => format!("'{}'", s.replace("'", "''")), Primitive::String(s) => format!("'{}'", s.replace("'", "''")), Primitive::Boolean(true) => "1".into(), Primitive::Boolean(_) => "0".into(), Primitive::Date(d) => format!("'{}'", d), - Primitive::Path(p) => format!("'{}'", p.display().to_string().replace("'", "''")), + Primitive::FilePath(p) => format!("'{}'", p.display().to_string().replace("'", "''")), Primitive::Binary(u) => format!("x'{}'", encode(u)), Primitive::BeginningOfStream | Primitive::EndOfStream