Compare commits

..

2 Commits

Author SHA1 Message Date
andy.boot 79cacd1b3b completions: autoregen completions 2025-03-31 23:08:11 +01:00
Pavel Kulyov 94affb6a41 cli: unify long arguments (dashes instead of underscores) 2025-03-31 23:07:52 +01:00
6 changed files with 15 additions and 18 deletions
Generated
+1 -1
View File
@@ -309,7 +309,7 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
name = "du-dust"
version = "1.2.0"
version = "1.1.2"
dependencies = [
"ansi_term",
"assert_cmd",
+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "du-dust"
description = "A more intuitive version of du"
version = "1.2.0"
version = "1.1.2"
authors = ["bootandy <bootandy@gmail.com>", "nebkor <code@ardent.nebcorp.com>"]
edition = "2024"
readme = "README.md"
+2 -2
View File
@@ -1,6 +1,6 @@
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH Dust 1 "Dust 1.2.0"
.TH Dust 1 "Dust 1.1.2"
.SH NAME
Dust \- Like du but more intuitive
.SH SYNOPSIS
@@ -137,4 +137,4 @@ Print version
[\fIPATH\fR]
.SH VERSION
v1.2.0
v1.1.2
+4 -1
View File
@@ -4,6 +4,7 @@ use clap::ArgMatches;
use config_file::FromConfigFile;
use regex::Regex;
use serde::Deserialize;
use std::io::IsTerminal;
use std::path::Path;
use std::path::PathBuf;
@@ -53,7 +54,9 @@ impl Config {
Some(true) == self.force_colors || options.get_flag("force_colors")
}
pub fn get_disable_progress(&self, options: &ArgMatches) -> bool {
Some(true) == self.disable_progress || options.get_flag("disable_progress")
Some(true) == self.disable_progress
|| options.get_flag("disable_progress")
|| !std::io::stdout().is_terminal()
}
pub fn get_apparent_size(&self, options: &ArgMatches) -> bool {
Some(true) == self.display_apparent_size || options.get_flag("display_apparent_size")
+7 -10
View File
@@ -118,7 +118,7 @@ impl PIndicator {
let time_info_thread = std::thread::spawn(move || {
let mut progress_char_i: usize = 0;
let mut stderr = std::io::stderr();
let mut stdout = std::io::stdout();
let mut msg = "".to_string();
// While the timeout triggers we go round the loop
@@ -127,8 +127,7 @@ impl PIndicator {
receiver.recv_timeout(Duration::from_millis(SPINNER_SLEEP_TIME))
{
// Clear the text written by 'write!'& Return at the start of line
let clear = format!("\r{:width$}", " ", width = msg.len());
write!(stderr, "{clear}").unwrap();
print!("\r{:width$}", " ", width = msg.len());
let prog_char = PROGRESS_CHARS[progress_char_i];
msg = match data.state.load(ORDERING) {
@@ -137,17 +136,15 @@ impl PIndicator {
_ => panic!("Unknown State"),
};
write!(stderr, "\r{msg}").unwrap();
stderr.flush().unwrap();
write!(stdout, "\r{msg}").unwrap();
stdout.flush().unwrap();
progress_char_i += 1;
progress_char_i %= PROGRESS_CHARS_LEN;
}
let clear = format!("\r{:width$}", " ", width = msg.len());
write!(stderr, "{clear}").unwrap();
write!(stderr, "\r").unwrap();
stderr.flush().unwrap();
print!("\r{:width$}", " ", width = msg.len());
print!("\r");
stdout.flush().unwrap();
});
self.thread = Some((stop_handler, time_info_thread))
}
-3
View File
@@ -10,9 +10,6 @@ use std::str;
fn build_command<T: AsRef<OsStr>>(command_args: Vec<T>) -> String {
let mut cmd = &mut Command::cargo_bin("dust").unwrap();
// Hide progress bar
cmd = cmd.arg("-P");
for p in command_args {
cmd = cmd.arg(p);
}