mirror of
https://github.com/eza-community/eza
synced 2024-09-29 20:54:59 +00:00
fix: fixed build error
This commit is contained in:
parent
de2e5337a0
commit
f2476cbd24
|
@ -28,6 +28,7 @@ use std::path::{Component, PathBuf};
|
|||
use std::process::exit;
|
||||
|
||||
use nu_ansi_term::{AnsiStrings as ANSIStrings, Style};
|
||||
use output::OutputType;
|
||||
|
||||
use crate::fs::feature::git::GitCache;
|
||||
use crate::fs::filter::GitIgnore;
|
||||
|
|
|
@ -110,8 +110,8 @@ impl TextCell {
|
|||
let new_contents = self
|
||||
.contents
|
||||
.iter()
|
||||
.filter(|w| !w.as_str().is_empty() && !w.as_str().trim().is_empty())
|
||||
.cloned()
|
||||
.filter(|w| !w.is_empty() && !w.trim().is_empty())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
TextCell {
|
||||
|
|
|
@ -267,14 +267,14 @@ impl<'a> Render<'a> {
|
|||
None,
|
||||
);
|
||||
|
||||
write!(w, "{{\"files\":[")?;
|
||||
write!(w, "\"files\":[")?;
|
||||
for (i, row) in self.iterate(rows).enumerate() {
|
||||
write!(w, "\"{}\"", row.strings())?;
|
||||
if (i + 1) < self.files.len() {
|
||||
write!(w, ", ")?;
|
||||
}
|
||||
}
|
||||
writeln!(w, "]}}")
|
||||
writeln!(w, "]")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ impl<'a> Render<'a> {
|
|||
// and treat it as just printing *quite* the same as lines
|
||||
pub fn render_json<W: Write>(mut self, w: &mut W) -> io::Result<()> {
|
||||
self.filter.sort_files(&mut self.files);
|
||||
writeln!(w, "{{\"files\":[")?;
|
||||
write!(w, "\"files\":[")?;
|
||||
for (i, file) in self.files.iter().enumerate() {
|
||||
let name_cell = self.file_style.for_file(file, self.theme).paint();
|
||||
write!(w, "\"{}\"", name_cell.strings())?;
|
||||
|
@ -71,7 +71,7 @@ impl<'a> Render<'a> {
|
|||
write!(w, ",")?;
|
||||
}
|
||||
}
|
||||
writeln!(w, "]}}")?;
|
||||
writeln!(w, "]")?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ impl<'a> Render<'a> {
|
|||
// because grid-details has no tree view.
|
||||
|
||||
pub fn render_json<W: Write>(self, _w: &mut W) -> io::Result<()> {
|
||||
todo!("Implement json rendering");
|
||||
unimplemented!("As it is made to be piped json with grid view, will not be implemented");
|
||||
}
|
||||
|
||||
pub fn render<W: Write>(mut self, w: &mut W) -> io::Result<()> {
|
||||
|
|
|
@ -4,7 +4,7 @@ This file is a special renderer for json
|
|||
|
||||
use std::io::{self, Write};
|
||||
|
||||
use super::{details::TableIter, TextCell};
|
||||
use super::{cell::TextCell, details::TableIter};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct JsonFile {
|
||||
|
@ -35,7 +35,7 @@ impl JsonFile {
|
|||
writeln!(w, "[")?;
|
||||
}
|
||||
for (i, cell) in self.cell.contents.iter().enumerate() {
|
||||
if cell.is_empty() || cell.trim().is_empty() {
|
||||
if cell.as_str().is_empty() || cell.as_str().trim().is_empty() {
|
||||
continue;
|
||||
};
|
||||
if let Some(ref header) = header {
|
||||
|
|
|
@ -37,7 +37,7 @@ impl<'a> Render<'a> {
|
|||
|
||||
pub fn render_json<W: Write>(mut self, w: &mut W) -> io::Result<()> {
|
||||
self.filter.sort_files(&mut self.files);
|
||||
write!(w, "{{\"files\":[")?;
|
||||
write!(w, "\"files\":[")?;
|
||||
for (i, file) in self.files.iter().enumerate() {
|
||||
let name_cell = self.render_file(file);
|
||||
write!(w, "\"{}\"", ANSIStrings(&name_cell))?;
|
||||
|
@ -45,7 +45,7 @@ impl<'a> Render<'a> {
|
|||
write!(w, ",")?;
|
||||
}
|
||||
}
|
||||
writeln!(w, "]}}")?;
|
||||
writeln!(w, "]")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue