mirror of
https://github.com/sharkdp/fd.git
synced 2024-09-28 13:01:30 +02:00
Move error macros to error.rs
This commit is contained in:
parent
65096a653e
commit
a3060f952e
10
src/error.rs
Normal file
10
src/error.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
macro_rules! print_error {
|
||||||
|
($($arg:tt)*) => (eprintln!("[fd error]: {}", format!($($arg)*)))
|
||||||
|
}
|
||||||
|
|
||||||
|
macro_rules! print_error_and_exit {
|
||||||
|
($($arg:tt)*) => {
|
||||||
|
print_error!($($arg)*);
|
||||||
|
::std::process::exit(1);
|
||||||
|
};
|
||||||
|
}
|
@ -4,17 +4,6 @@ use std::ffi::{OsStr, OsString};
|
|||||||
use regex_syntax::hir::Hir;
|
use regex_syntax::hir::Hir;
|
||||||
use regex_syntax::ParserBuilder;
|
use regex_syntax::ParserBuilder;
|
||||||
|
|
||||||
macro_rules! print_error {
|
|
||||||
($($arg:tt)*) => (eprintln!("[fd error]: {}", format!($($arg)*)))
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! print_error_and_exit {
|
|
||||||
($($arg:tt)*) => {
|
|
||||||
print_error!($($arg)*);
|
|
||||||
::std::process::exit(1);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(any(unix, target_os = "redox"))]
|
#[cfg(any(unix, target_os = "redox"))]
|
||||||
pub fn osstr_to_bytes(input: &OsStr) -> Cow<[u8]> {
|
pub fn osstr_to_bytes(input: &OsStr) -> Cow<[u8]> {
|
||||||
use std::os::unix::ffi::OsStrExt;
|
use std::os::unix::ffi::OsStrExt;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod internal;
|
mod error;
|
||||||
|
|
||||||
mod app;
|
mod app;
|
||||||
mod exec;
|
mod exec;
|
||||||
@ -7,6 +7,7 @@ mod exit_codes;
|
|||||||
mod filetypes;
|
mod filetypes;
|
||||||
mod filter;
|
mod filter;
|
||||||
mod fshelper;
|
mod fshelper;
|
||||||
|
mod internal;
|
||||||
mod options;
|
mod options;
|
||||||
mod output;
|
mod output;
|
||||||
mod walk;
|
mod walk;
|
||||||
|
Loading…
Reference in New Issue
Block a user