* Fork glob. Normalise license holder

* Fix more licenses

* unwraps

* bad doc test
This commit is contained in:
JT
2022-03-13 11:30:27 -07:00
committed by GitHub
parent 30bb090cd4
commit ff3dffd813
48 changed files with 1582 additions and 53 deletions

View File

@ -9,7 +9,7 @@ use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Spanne
use crate::filesystem::util::FileStructure;
const GLOB_PARAMS: glob::MatchOptions = glob::MatchOptions {
const GLOB_PARAMS: nu_glob::MatchOptions = nu_glob::MatchOptions {
case_sensitive: true,
require_literal_separator: false,
require_literal_leading_dot: false,
@ -58,7 +58,7 @@ impl Command for Cp {
let source = path.join(src.item.as_str());
let destination = path.join(dst.item.as_str());
let sources: Vec<_> = match glob::glob_with(&source.to_string_lossy(), GLOB_PARAMS) {
let sources: Vec<_> = match nu_glob::glob_with(&source.to_string_lossy(), GLOB_PARAMS) {
Ok(files) => files.collect(),
Err(e) => {
return Err(ShellError::SpannedLabeledError(
@ -193,7 +193,7 @@ impl Command for Cp {
}
// let mut sources =
// glob::glob(&source.to_string_lossy()).map_or_else(|_| Vec::new(), Iterator::collect);
// nu_glob::glob(&source.to_string_lossy()).map_or_else(|_| Vec::new(), Iterator::collect);
// if sources.is_empty() {
// return Err(ShellError::FileNotFound(call.positional[0].span));
// }

View File

@ -9,7 +9,7 @@ use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape,
};
const GLOB_PARAMS: glob::MatchOptions = glob::MatchOptions {
const GLOB_PARAMS: nu_glob::MatchOptions = nu_glob::MatchOptions {
case_sensitive: true,
require_literal_separator: false,
require_literal_leading_dot: false,
@ -62,7 +62,7 @@ impl Command for Mv {
let source = path.join(spanned_source.item.as_str());
let destination = path.join(spanned_destination.item.as_str());
let mut sources = glob::glob_with(&source.to_string_lossy(), GLOB_PARAMS)
let mut sources = nu_glob::glob_with(&source.to_string_lossy(), GLOB_PARAMS)
.map_or_else(|_| Vec::new(), Iterator::collect);
if sources.is_empty() {

View File

@ -16,7 +16,7 @@ use nu_protocol::{
Spanned, SyntaxShape, Type, Value,
};
const GLOB_PARAMS: glob::MatchOptions = glob::MatchOptions {
const GLOB_PARAMS: nu_glob::MatchOptions = nu_glob::MatchOptions {
case_sensitive: true,
require_literal_separator: false,
require_literal_leading_dot: false,
@ -165,9 +165,9 @@ fn rm(
}
let path = path.join(&target.item);
match glob::glob_with(
match nu_glob::glob_with(
&path.to_string_lossy(),
glob::MatchOptions {
nu_glob::MatchOptions {
require_literal_leading_dot: true,
..GLOB_PARAMS
},

View File

@ -1,5 +1,5 @@
use filesize::file_real_size_fast;
use glob::Pattern;
use nu_glob::Pattern;
use nu_protocol::{ShellError, Span, Value};
use std::path::PathBuf;
use std::sync::atomic::{AtomicBool, Ordering};

View File

@ -1,6 +1,6 @@
use crate::{DirBuilder, DirInfo, FileInfo};
use glob::{GlobError, MatchOptions, Pattern};
use nu_engine::CallExt;
use nu_glob::{GlobError, MatchOptions, Pattern};
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
@ -103,9 +103,9 @@ impl Command for Du {
let mut paths = match args.path {
Some(p) => {
let p = p.item.to_str().expect("Why isn't this encoded properly?");
glob::glob_with(p, GLOB_PARAMS)
nu_glob::glob_with(p, GLOB_PARAMS)
}
None => glob::glob_with("*", GLOB_PARAMS),
None => nu_glob::glob_with("*", GLOB_PARAMS),
}
.map_err(|e| {
ShellError::SpannedLabeledError(e.msg.to_string(), "glob error".to_string(), tag)