fix: resolve compilation errors and warnings in keep crate
Co-authored-by: aider (openai/andrew.openrouter.qwen.qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -36,6 +36,24 @@ impl CompressionEngineProgram {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_program_path(program: &str) -> Result<String> {
|
||||
debug!("COMPRESSION: Looking for executable: {}", program);
|
||||
if let Ok(path) = env::var("PATH") {
|
||||
for p in path.split(':') {
|
||||
let p_str = format!("{}/{}", p, program);
|
||||
let stat = fs::metadata(p_str.clone());
|
||||
if let Ok(stat) = stat {
|
||||
let md = stat;
|
||||
let permissions = md.permissions();
|
||||
if md.is_file() && permissions.mode() & 0o111 != 0 {
|
||||
return Ok(p_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(anyhow!("Unable to find binary {} in PATH", program))
|
||||
}
|
||||
|
||||
impl CompressionEngine for CompressionEngineProgram {
|
||||
fn is_supported(&self) -> bool {
|
||||
self.supported
|
||||
|
||||
@@ -9,13 +9,10 @@ extern crate directories;
|
||||
use directories::ProjectDirs;
|
||||
|
||||
extern crate prettytable;
|
||||
use prettytable::format;
|
||||
use prettytable::format::consts::FORMAT_NO_BORDER_LINE_SEPARATOR;
|
||||
use prettytable::format::{Alignment, TableFormat};
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
pub mod compression_engine;
|
||||
|
||||
@@ -8,8 +8,9 @@ use crate::compression_engine::COMPRESSION_PROGRAMS;
|
||||
use crate::compression_engine::CompressionType;
|
||||
use crate::compression_engine::program::CompressionEngineProgram;
|
||||
|
||||
use crate::FORMAT_BOX_CHARS_NO_BORDER_LINE_SEPARATOR;
|
||||
use crate::FORMAT_NO_BORDER_LINE_SEPARATOR;
|
||||
use prettytable::format::TableFormat;
|
||||
use crate::modes::common::get_format_box_chars_no_border_line_separator;
|
||||
use prettytable::format::consts::FORMAT_NO_BORDER_LINE_SEPARATOR;
|
||||
use prettytable::color;
|
||||
use prettytable::row;
|
||||
use prettytable::{Attr, Cell, Row, Table};
|
||||
@@ -21,7 +22,7 @@ fn build_path_table(data_path: PathBuf, db_path: PathBuf) -> Table {
|
||||
let mut path_table = Table::new();
|
||||
|
||||
if std::io::stdout().is_terminal() {
|
||||
path_table.set_format(*FORMAT_BOX_CHARS_NO_BORDER_LINE_SEPARATOR);
|
||||
path_table.set_format(get_format_box_chars_no_border_line_separator());
|
||||
} else {
|
||||
path_table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR);
|
||||
}
|
||||
@@ -57,7 +58,7 @@ fn build_path_table(data_path: PathBuf, db_path: PathBuf) -> Table {
|
||||
fn build_compression_table() -> Table {
|
||||
let mut compression_table = Table::new();
|
||||
if std::io::stdout().is_terminal() {
|
||||
compression_table.set_format(*FORMAT_BOX_CHARS_NO_BORDER_LINE_SEPARATOR);
|
||||
compression_table.set_format(get_format_box_chars_no_border_line_separator());
|
||||
} else {
|
||||
compression_table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR);
|
||||
}
|
||||
@@ -114,7 +115,7 @@ fn build_compression_table() -> Table {
|
||||
fn build_meta_plugin_table(enabled_meta_plugins: &Vec<MetaPluginType>) -> Table {
|
||||
let mut meta_plugin_table = Table::new();
|
||||
if std::io::stdout().is_terminal() {
|
||||
meta_plugin_table.set_format(*FORMAT_BOX_CHARS_NO_BORDER_LINE_SEPARATOR);
|
||||
meta_plugin_table.set_format(get_format_box_chars_no_border_line_separator());
|
||||
} else {
|
||||
meta_plugin_table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ mod tests {
|
||||
cmd.args(args)
|
||||
.env("KEEP_DIR", keep_dir);
|
||||
|
||||
if let Some(data) = stdin_data {
|
||||
if let Some(_data) = stdin_data {
|
||||
cmd.stdin(std::process::Stdio::piped());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user