mirror of
https://github.com/Llewellynvdm/exa.git
synced 2025-02-15 00:31:40 +00:00
commit
a58ad6487f
@ -121,9 +121,8 @@ impl<'dir, 'ig> Files<'dir, 'ig> {
|
|||||||
return Some(File::from_args(path.clone(), self.dir, filename)
|
return Some(File::from_args(path.clone(), self.dir, filename)
|
||||||
.map_err(|e| (path.clone(), e)))
|
.map_err(|e| (path.clone(), e)))
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return None
|
return None
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,8 +284,10 @@ impl SortField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn strip_dot(n: &str) -> &str {
|
fn strip_dot(n: &str) -> &str {
|
||||||
if n.starts_with('.') { &n[1..] }
|
match n.strip_prefix('.') {
|
||||||
else { n }
|
Some(s) => s,
|
||||||
|
None => n,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ impl FileExtensions {
|
|||||||
/// An “immediate” file is something that can be run or activated somehow
|
/// An “immediate” file is something that can be run or activated somehow
|
||||||
/// in order to kick off the build of a project. It’s usually only present
|
/// in order to kick off the build of a project. It’s usually only present
|
||||||
/// in directories full of source code.
|
/// in directories full of source code.
|
||||||
|
#[allow(clippy::case_sensitive_file_extension_comparisons)]
|
||||||
fn is_immediate(&self, file: &File<'_>) -> bool {
|
fn is_immediate(&self, file: &File<'_>) -> bool {
|
||||||
file.name.to_lowercase().starts_with("readme") ||
|
file.name.to_lowercase().starts_with("readme") ||
|
||||||
file.name.ends_with(".ninja") ||
|
file.name.ends_with(".ninja") ||
|
||||||
|
@ -8,17 +8,14 @@
|
|||||||
|
|
||||||
#![warn(clippy::all, clippy::pedantic)]
|
#![warn(clippy::all, clippy::pedantic)]
|
||||||
#![allow(clippy::enum_glob_use)]
|
#![allow(clippy::enum_glob_use)]
|
||||||
#![allow(clippy::find_map)]
|
|
||||||
#![allow(clippy::map_unwrap_or)]
|
#![allow(clippy::map_unwrap_or)]
|
||||||
#![allow(clippy::match_same_arms)]
|
#![allow(clippy::match_same_arms)]
|
||||||
#![allow(clippy::missing_const_for_fn)]
|
|
||||||
#![allow(clippy::missing_errors_doc)]
|
|
||||||
#![allow(clippy::module_name_repetitions)]
|
#![allow(clippy::module_name_repetitions)]
|
||||||
#![allow(clippy::must_use_candidate)]
|
|
||||||
#![allow(clippy::non_ascii_literal)]
|
#![allow(clippy::non_ascii_literal)]
|
||||||
#![allow(clippy::option_if_let_else)]
|
#![allow(clippy::option_if_let_else)]
|
||||||
#![allow(clippy::too_many_lines)]
|
#![allow(clippy::too_many_lines)]
|
||||||
#![allow(clippy::unused_self)]
|
#![allow(clippy::unused_self)]
|
||||||
|
#![allow(clippy::upper_case_acronyms)]
|
||||||
#![allow(clippy::wildcard_imports)]
|
#![allow(clippy::wildcard_imports)]
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
@ -155,6 +152,9 @@ fn git_options(options: &Options, args: &[&OsStr]) -> Option<GitCache> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'args> Exa<'args> {
|
impl<'args> Exa<'args> {
|
||||||
|
/// # Errors
|
||||||
|
///
|
||||||
|
/// Will return `Err` if printing to stderr fails.
|
||||||
pub fn run(mut self) -> io::Result<i32> {
|
pub fn run(mut self) -> io::Result<i32> {
|
||||||
debug!("Running with options: {:#?}", self.options);
|
debug!("Running with options: {:#?}", self.options);
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ impl Options {
|
|||||||
fn deduce<V: Vars>(matches: &MatchedFlags<'_>, vars: &V) -> Result<Self, OptionsError> {
|
fn deduce<V: Vars>(matches: &MatchedFlags<'_>, vars: &V) -> Result<Self, OptionsError> {
|
||||||
if cfg!(not(feature = "git")) &&
|
if cfg!(not(feature = "git")) &&
|
||||||
matches.has_where_any(|f| f.matches(&flags::GIT) || f.matches(&flags::GIT_IGNORE)).is_some() {
|
matches.has_where_any(|f| f.matches(&flags::GIT) || f.matches(&flags::GIT_IGNORE)).is_some() {
|
||||||
return Err(OptionsError::Unsupported(format!(
|
return Err(OptionsError::Unsupported(String::from(
|
||||||
"Options --git and --git-ignore can't be used because `git` feature was disabled in this build of exa"
|
"Options --git and --git-ignore can't be used because `git` feature was disabled in this build of exa"
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,9 @@ impl Mode {
|
|||||||
let grid_details = grid_details::Options { grid, details, row_threshold };
|
let grid_details = grid_details::Options { grid, details, row_threshold };
|
||||||
return Ok(Self::GridDetails(grid_details));
|
return Ok(Self::GridDetails(grid_details));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
// the --tree case is handled by the DirAction parser later
|
// the --tree case is handled by the DirAction parser later
|
||||||
return Ok(Self::Details(details));
|
return Ok(Self::Details(details));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Self::strict_check_long_flags(matches)?;
|
Self::strict_check_long_flags(matches)?;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use ansi_term::{ANSIString, Style};
|
use ansi_term::{ANSIString, Style};
|
||||||
|
|
||||||
|
|
||||||
pub fn escape<'a>(string: String, bits: &mut Vec<ANSIString<'a>>, good: Style, bad: Style) {
|
pub fn escape(string: String, bits: &mut Vec<ANSIString<'_>>, good: Style, bad: Style) {
|
||||||
if string.chars().all(|c| c >= 0x20 as char && c != 0x7f as char) {
|
if string.chars().all(|c| c >= 0x20 as char && c != 0x7f as char) {
|
||||||
bits.push(good.paint(string));
|
bits.push(good.paint(string));
|
||||||
return;
|
return;
|
||||||
|
@ -37,7 +37,7 @@ impl Icons {
|
|||||||
/// - If neither is set, just use the default style.
|
/// - If neither is set, just use the default style.
|
||||||
/// - Attributes such as bold or underline should not be used to paint the
|
/// - Attributes such as bold or underline should not be used to paint the
|
||||||
/// icon, as they can make it look weird.
|
/// icon, as they can make it look weird.
|
||||||
pub fn iconify_style<'a>(style: Style) -> Style {
|
pub fn iconify_style(style: Style) -> Style {
|
||||||
style.background.or(style.foreground)
|
style.background.or(style.foreground)
|
||||||
.map(Style::from)
|
.map(Style::from)
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
|
@ -35,6 +35,7 @@ impl f::GitStatus {
|
|||||||
|
|
||||||
pub trait Colours {
|
pub trait Colours {
|
||||||
fn not_modified(&self) -> Style;
|
fn not_modified(&self) -> Style;
|
||||||
|
#[allow(clippy::new_ret_no_self)]
|
||||||
fn new(&self) -> Style;
|
fn new(&self) -> Style;
|
||||||
fn modified(&self) -> Style;
|
fn modified(&self) -> Style;
|
||||||
fn deleted(&self) -> Style;
|
fn deleted(&self) -> Style;
|
||||||
|
@ -28,6 +28,7 @@ pub struct Options {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Extra columns to display in the table.
|
/// Extra columns to display in the table.
|
||||||
|
#[allow(clippy::struct_excessive_bools)]
|
||||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||||
pub struct Columns {
|
pub struct Columns {
|
||||||
|
|
||||||
@ -166,6 +167,7 @@ impl Column {
|
|||||||
|
|
||||||
|
|
||||||
/// Formatting options for file sizes.
|
/// Formatting options for file sizes.
|
||||||
|
#[allow(clippy::pub_enum_variant_names)]
|
||||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||||
pub enum SizeFormat {
|
pub enum SizeFormat {
|
||||||
|
|
||||||
@ -303,11 +305,11 @@ impl Environment {
|
|||||||
fn determine_time_zone() -> TZResult<TimeZone> {
|
fn determine_time_zone() -> TZResult<TimeZone> {
|
||||||
if let Ok(file) = env::var("TZ") {
|
if let Ok(file) = env::var("TZ") {
|
||||||
TimeZone::from_file({
|
TimeZone::from_file({
|
||||||
if file.starts_with("/") {
|
if file.starts_with('/') {
|
||||||
file
|
file
|
||||||
} else {
|
} else {
|
||||||
format!("/usr/share/zoneinfo/{}", {
|
format!("/usr/share/zoneinfo/{}", {
|
||||||
if file.starts_with(":") {
|
if file.starts_with(':') {
|
||||||
file.replacen(":", "", 1)
|
file.replacen(":", "", 1)
|
||||||
} else {
|
} else {
|
||||||
file
|
file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user