general fmt

i18n
Michal S 2 years ago
parent dd11ea2c68
commit 40a342dd3c
No known key found for this signature in database
GPG Key ID: A6A1A4DCB22279B9

@ -3,11 +3,13 @@
use args::Args; use args::Args;
use clap::Parser; use clap::Parser;
use clap_complete::{Generator, Shell};
use internal::commands::ShellCommand; use internal::commands::ShellCommand;
use internal::error::SilentUnwrap; use internal::error::SilentUnwrap;
use std::fs; use std::fs;
use std::path::Path; use std::path::Path;
use std::str::FromStr; use std::str::FromStr;
use textwrap::{termwidth, wrap};
use crate::args::{ use crate::args::{
GenCompArgs, InfoArgs, InstallArgs, Operation, QueryArgs, RemoveArgs, SearchArgs, UpgradeArgs, GenCompArgs, InfoArgs, InstallArgs, Operation, QueryArgs, RemoveArgs, SearchArgs, UpgradeArgs,
@ -16,9 +18,6 @@ use crate::internal::exit_code::AppExitCode;
use crate::internal::utils::pager; use crate::internal::utils::pager;
use crate::internal::{detect, init, sort, start_sudoloop, structs::Options}; use crate::internal::{detect, init, sort, start_sudoloop, structs::Options};
use clap_complete::{Generator, Shell};
use textwrap::{termwidth, wrap};
#[global_allocator] #[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
@ -178,7 +177,7 @@ fn cmd_search(args: &SearchArgs, options: Options) {
"".to_string() "".to_string()
}; };
let opts = textwrap::Options::new(termwidth())t ; let opts = textwrap::Options::new(termwidth());
// Attempt to wrap result text // Attempt to wrap result text
let results = wrap(&(repo_results + "\n" + &aur_results), opts).join("\n"); let results = wrap(&(repo_results + "\n" + &aur_results), opts).join("\n");

@ -1,10 +1,9 @@
use chrono::{Local, TimeZone};
use std::env::set_current_dir; use std::env::set_current_dir;
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
use std::{env, fs}; use std::{env, fs};
use chrono::{Local, TimeZone};
use crate::internal::commands::ShellCommand; use crate::internal::commands::ShellCommand;
use crate::internal::config; use crate::internal::config;
use crate::internal::error::SilentUnwrap; use crate::internal::error::SilentUnwrap;

@ -1,13 +1,13 @@
use chrono::{Local, TimeZone};
use colored::Colorize;
use textwrap::wrap;
use crate::internal::commands::ShellCommand; use crate::internal::commands::ShellCommand;
use crate::internal::error::SilentUnwrap; use crate::internal::error::SilentUnwrap;
use crate::internal::exit_code::AppExitCode; use crate::internal::exit_code::AppExitCode;
use crate::internal::rpc::rpcsearch; use crate::internal::rpc::rpcsearch;
use crate::{log, Options}; use crate::{log, Options};
use chrono::{Local, TimeZone};
use colored::Colorize;
use textwrap::wrap;
#[allow(clippy::module_name_repetitions)] #[allow(clippy::module_name_repetitions)]
pub fn aur_search(query: &str, options: Options) -> String { pub fn aur_search(query: &str, options: Options) -> String {
// Query AUR for package info // Query AUR for package info
@ -45,7 +45,7 @@ pub fn aur_search(query: &str, options: Options) -> String {
.description .description
.as_ref() .as_ref()
.unwrap_or(&"No description".to_string()), .unwrap_or(&"No description".to_string()),
opts opts,
) )
.join("\n"), .join("\n"),
); );

Loading…
Cancel
Save