mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 08:23:24 +01:00
show the whole path in "missing mod.nu" errors (#10416)
This commit is contained in:
parent
b6d31e0e45
commit
6a2fd91a01
@ -1943,7 +1943,10 @@ pub fn parse_module_file_or_dir(
|
||||
let mod_nu_path = module_path.clone().join("mod.nu");
|
||||
|
||||
if !(mod_nu_path.exists() && mod_nu_path.is_file()) {
|
||||
working_set.error(ParseError::ModuleMissingModNuFile(path_span));
|
||||
working_set.error(ParseError::ModuleMissingModNuFile(
|
||||
module_path.path().to_string_lossy().to_string(),
|
||||
path_span,
|
||||
));
|
||||
return None;
|
||||
}
|
||||
|
||||
|
@ -212,9 +212,12 @@ pub enum ParseError {
|
||||
#[error("Missing mod.nu file.")]
|
||||
#[diagnostic(
|
||||
code(nu::parser::module_missing_mod_nu_file),
|
||||
help("When importing a directory as a Nushell module, it needs to contain a mod.nu file (can be empty). Alternatively, you can use .nu files in the directory as modules individually.")
|
||||
help("Directory {0} is missing a mod.nu file.\n\nWhen importing a directory as a Nushell module, it needs to contain a mod.nu file (can be empty). Alternatively, you can use .nu files in the directory as modules individually.")
|
||||
)]
|
||||
ModuleMissingModNuFile(#[label = "module directory is missing a mod.nu file"] Span),
|
||||
ModuleMissingModNuFile(
|
||||
String,
|
||||
#[label = "module directory is missing a mod.nu file"] Span,
|
||||
),
|
||||
|
||||
#[error("Cyclical module import.")]
|
||||
#[diagnostic(code(nu::parser::cyclical_module_import), help("{0}"))]
|
||||
@ -504,7 +507,7 @@ impl ParseError {
|
||||
ParseError::AliasNotValid(s) => *s,
|
||||
ParseError::CommandDefNotValid(s) => *s,
|
||||
ParseError::ModuleNotFound(s) => *s,
|
||||
ParseError::ModuleMissingModNuFile(s) => *s,
|
||||
ParseError::ModuleMissingModNuFile(_, s) => *s,
|
||||
ParseError::NamedAsModule(_, _, _, s) => *s,
|
||||
ParseError::ModuleDoubleMain(_, s) => *s,
|
||||
ParseError::InvalidModuleFileName(_, _, s) => *s,
|
||||
|
Loading…
Reference in New Issue
Block a user