|
|
@ -95,13 +95,23 @@ impl Args {
|
|
|
|
_ => args.files.push(parse_file(arg)),
|
|
|
|
_ => args.files.push(parse_file(arg)),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
arg => args.files.push(parse_file(arg)),
|
|
|
|
arg => {
|
|
|
|
|
|
|
|
let file = parse_file(arg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if is_proper_file(&file) {
|
|
|
|
|
|
|
|
args.files.push(file)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// push the remaining args, if any to the files
|
|
|
|
// push the remaining args, if any to the files
|
|
|
|
for arg in argv {
|
|
|
|
for arg in argv {
|
|
|
|
args.files.push(parse_file(&arg));
|
|
|
|
let file = parse_file(&arg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if is_proper_file(&file) {
|
|
|
|
|
|
|
|
args.files.push(file);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if let Some(file) = args.files.first_mut() {
|
|
|
|
if let Some(file) = args.files.first_mut() {
|
|
|
@ -125,6 +135,11 @@ pub(crate) fn parse_file(s: &str) -> (PathBuf, Position) {
|
|
|
|
.unwrap_or_else(def)
|
|
|
|
.unwrap_or_else(def)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Ensure file is not a pipe or random
|
|
|
|
|
|
|
|
fn is_proper_file(f: &(PathBuf, Position)) -> bool {
|
|
|
|
|
|
|
|
f.0.is_file() || f.0.is_symlink()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Split file.rs:10:2 into [`PathBuf`], row and col.
|
|
|
|
/// Split file.rs:10:2 into [`PathBuf`], row and col.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// Does not validate if file.rs is a file or directory.
|
|
|
|
/// Does not validate if file.rs is a file or directory.
|
|
|
|