forked from extern/nushell
@ -19,6 +19,7 @@ const GLOB_PARAMS: nu_glob::MatchOptions = nu_glob::MatchOptions {
|
||||
case_sensitive: true,
|
||||
require_literal_separator: false,
|
||||
require_literal_leading_dot: false,
|
||||
recursive_match_hidden_dir: true,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -3,6 +3,7 @@ use crate::DirInfo;
|
||||
use chrono::{DateTime, Local, LocalResult, TimeZone, Utc};
|
||||
use nu_engine::env::current_dir;
|
||||
use nu_engine::CallExt;
|
||||
use nu_glob::MatchOptions;
|
||||
use nu_path::expand_to_real_path;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
@ -128,7 +129,15 @@ impl Command for Ls {
|
||||
item: path.display().to_string(),
|
||||
span: p_tag,
|
||||
};
|
||||
let (prefix, paths) = nu_engine::glob_from(&glob_path, &cwd, call_span)?;
|
||||
|
||||
let glob_options = if all {
|
||||
None
|
||||
} else {
|
||||
let mut glob_options = MatchOptions::new();
|
||||
glob_options.recursive_match_hidden_dir = false;
|
||||
Some(glob_options)
|
||||
};
|
||||
let (prefix, paths) = nu_engine::glob_from(&glob_path, &cwd, call_span, glob_options)?;
|
||||
|
||||
let mut paths_peek = paths.peekable();
|
||||
if paths_peek.peek().is_none() {
|
||||
|
@ -14,6 +14,7 @@ const GLOB_PARAMS: nu_glob::MatchOptions = nu_glob::MatchOptions {
|
||||
case_sensitive: true,
|
||||
require_literal_separator: false,
|
||||
require_literal_leading_dot: false,
|
||||
recursive_match_hidden_dir: true,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -24,6 +24,7 @@ const GLOB_PARAMS: nu_glob::MatchOptions = nu_glob::MatchOptions {
|
||||
case_sensitive: true,
|
||||
require_literal_separator: false,
|
||||
require_literal_leading_dot: false,
|
||||
recursive_match_hidden_dir: true,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -14,6 +14,7 @@ const GLOB_PARAMS: MatchOptions = MatchOptions {
|
||||
case_sensitive: true,
|
||||
require_literal_separator: true,
|
||||
require_literal_leading_dot: false,
|
||||
recursive_match_hidden_dir: true,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -417,7 +417,9 @@ impl ExternalCommand {
|
||||
let cwd = PathBuf::from(cwd);
|
||||
|
||||
if arg.item.contains('*') {
|
||||
if let Ok((prefix, matches)) = nu_engine::glob_from(&arg, &cwd, self.name.span) {
|
||||
if let Ok((prefix, matches)) =
|
||||
nu_engine::glob_from(&arg, &cwd, self.name.span, None)
|
||||
{
|
||||
let matches: Vec<_> = matches.collect();
|
||||
|
||||
// FIXME: do we want to special-case this further? We might accidentally expand when they don't
|
||||
|
Reference in New Issue
Block a user