mirror of
https://github.com/nushell/nushell
synced 2024-12-28 14:03:09 +00:00
Add file not found error for nu cmd args (#3627)
This commit is contained in:
parent
0eae9c49b0
commit
7a4d6d64fd
2 changed files with 13 additions and 10 deletions
|
@ -110,16 +110,19 @@ impl App {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(scripts) = self.scripts() {
|
if let Some(scripts) = self.scripts() {
|
||||||
let source_files = scripts
|
let mut source_files = vec![];
|
||||||
.into_iter()
|
for script in scripts {
|
||||||
.filter_map(Result::ok)
|
let script_name = script?;
|
||||||
.map(|path| {
|
let path = std::ffi::OsString::from(&script_name);
|
||||||
let path = std::ffi::OsString::from(path);
|
|
||||||
|
|
||||||
NuScript::source_file(path.as_os_str())
|
match NuScript::source_file(path.as_os_str()) {
|
||||||
})
|
Ok(file) => source_files.push(file),
|
||||||
.filter_map(Result::ok)
|
Err(_) => {
|
||||||
.collect::<Vec<_>>();
|
eprintln!("File not found: {}", script_name);
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for file in source_files {
|
for file in source_files {
|
||||||
let mut opts = opts.clone();
|
let mut opts = opts.clone();
|
||||||
|
|
|
@ -50,7 +50,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||||
let tag = args.call_info.name_tag.clone();
|
let tag = args.call_info.name_tag.clone();
|
||||||
let value: Value = args.req(1)?;
|
let value: Value = args.req(1)?;
|
||||||
|
|
||||||
let series_span = value.tag.span.clone();
|
let series_span = value.tag.span;
|
||||||
let series = match value.value {
|
let series = match value.value {
|
||||||
UntaggedValue::DataFrame(PolarsData::Series(series)) => Ok(series),
|
UntaggedValue::DataFrame(PolarsData::Series(series)) => Ok(series),
|
||||||
_ => Err(ShellError::labeled_error(
|
_ => Err(ShellError::labeled_error(
|
||||||
|
|
Loading…
Reference in a new issue