Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
529 changes: 370 additions & 159 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,25 @@ cli-completions = ["cli"]
[dependencies]
pipe-trait = "^0.4.0"
smart-default = "^0.7.1"
derive_more = { version = "^1.0.0", features = ["full"] }
derive_more = { version = "^2.0.1", features = ["full"] }
rayon = "^1.10.0"
text-block-macros = "^0.2.0"
rounded-div = "^0.1.2"
fmt-iter = "^0.2.1"
itertools = "^0.13.0"
itertools = "^0.14.0"
assert-cmp = "^0.3.0"
zero-copy-pads = "^0.2.0"
terminal_size = "^0.4.0"
clap = { version = "^4.3.8", optional = true }
clap_complete = { version = "^4.5.36", optional = true }
clap = { version = "^4.5.40", optional = true }
clap_complete = { version = "^4.5.54", optional = true }
clap-utilities = { version = "^0.2.0", optional = true }
serde = { version = "^1.0.214", optional = true }
serde_json = { version = "^1.0.132", optional = true }
sysinfo = "0.32.0"
serde = { version = "^1.0.219", optional = true }
serde_json = { version = "^1.0.140", optional = true }
sysinfo = "^0.35.2"

[dev-dependencies]
build-fs-tree = "^0.7.1"
command-extra = "^1.0.0"
maplit = "^1.0.2"
pretty_assertions = "^1.4.1"
rand = "^0.8.5"
rand = "^0.9.1"
10 changes: 7 additions & 3 deletions exports/completion.bash
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
_pdu() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
cur="$2"
else
cur="${COMP_WORDS[COMP_CWORD]}"
fi
prev="$3"
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
do
case "${cmd},${i}" in
",$1")
Expand Down
8 changes: 6 additions & 2 deletions exports/completion.fish
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
complete -c pdu -l bytes-format -d 'How to display the numbers of bytes' -r -f -a "{plain\t'Display plain number of bytes without units',metric\t'Use metric scale, i.e. 1K = 1000B, 1M = 1000K, and so on',binary\t'Use binary scale, i.e. 1K = 1024B, 1M = 1024K, and so on'}"
complete -c pdu -l quantity -d 'Aspect of the files/directories to be measured' -r -f -a "{apparent-size\t'Measure apparent sizes',block-size\t'Measure block sizes (block-count * 512B)',block-count\t'Count numbers of blocks'}"
complete -c pdu -l bytes-format -d 'How to display the numbers of bytes' -r -f -a "plain\t'Display plain number of bytes without units'
metric\t'Use metric scale, i.e. 1K = 1000B, 1M = 1000K, and so on'
binary\t'Use binary scale, i.e. 1K = 1024B, 1M = 1024K, and so on'"
complete -c pdu -l quantity -d 'Aspect of the files/directories to be measured' -r -f -a "apparent-size\t'Measure apparent sizes'
block-size\t'Measure block sizes (block-count * 512B)'
block-count\t'Count numbers of blocks'"
complete -c pdu -l max-depth -d 'Maximum depth to display the data (must be greater than 0)' -r
complete -c pdu -l total-width -d 'Width of the visualization' -r
complete -c pdu -l column-width -d 'Maximum widths of the tree column and width of the bar column' -r
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.82.0
1.87.0
2 changes: 1 addition & 1 deletion src/data_tree/constructors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl<Name, Size: size::Size> DataTree<Name, Size> {
DataTree {
name,
size,
children: Vec::with_capacity(0),
children: Vec::new(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/json_data/schema_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl TryFrom<String> for SchemaVersion {
}
}

impl<'a> From<SchemaVersion> for &'a str {
impl From<SchemaVersion> for &str {
fn from(_: SchemaVersion) -> Self {
SCHEMA_VERSION
}
Expand Down
3 changes: 2 additions & 1 deletion src/size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use super::bytes_format::{self, BytesFormat};
use derive_more::{Add, AddAssign, From, Into, Sum};
use std::{
fmt::{Debug, Display},
ops::{Mul, MulAssign},
iter::Sum,
ops::{Add, AddAssign, Mul, MulAssign},
};

#[cfg(feature = "json")]
Expand Down
2 changes: 1 addition & 1 deletion src/visualizer/methods/initial_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ where
Param {
remaining_depth: visualizer.max_depth.get(),
index_as_child: 0,
ancestors: Vec::with_capacity(0),
ancestors: Vec::new(),
preceding_sibling: None,
},
);
Expand Down
4 changes: 2 additions & 2 deletions src/visualizer/methods/tree_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ where
for excluded_row_index in excluded_row_indices.iter().copied() {
let is_child = |row: &&TreeRow<&Name, Size>| {
row.parent()
.map_or(false, |node_info| node_info.row_index == excluded_row_index)
.is_some_and(|node_info| node_info.row_index == excluded_row_index)
};
intermediate_table
.index(excluded_row_index..)
Expand Down Expand Up @@ -167,7 +167,7 @@ where
{
let is_sibling = |row: &&TreeRow<&Name, Size>| {
row.parent()
.map_or(false, |parent| parent.row_index == parent_row_index)
.is_some_and(|parent| parent.row_index == parent_row_index)
};
let is_excluded =
|row: &TreeRow<&Name, Size>| excluded_row_indices.contains(&row.row_index);
Expand Down
2 changes: 1 addition & 1 deletion src/visualizer/proportion_bar.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::BarAlignment;
use derive_more::{AsRef, Deref, Display, From, Into};
use fmt_iter::repeat;
use std::fmt::{Error, Formatter};
use std::fmt::{Display, Error, Formatter};

/// Block of proportion bar.
#[derive(Debug, Clone, Copy, PartialEq, Eq, AsRef, Deref, Display, Into)]
Expand Down
2 changes: 1 addition & 1 deletion src/visualizer/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::{ChildPosition, Direction, Parenthood};
use derive_more::{AsRef, Deref, Display, Into};
use fmt_iter::FmtIter;
use pipe_trait::Pipe;
use std::fmt::{Error, Formatter};
use std::fmt::{Display, Error, Formatter};
use zero_copy_pads::Width;

/// Determine 3 characters to use as skeletal component that connect a node
Expand Down
4 changes: 2 additions & 2 deletions tests/_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use parallel_disk_usage::{
};
use pipe_trait::Pipe;
use pretty_assertions::assert_eq;
use rand::{distributions::Alphanumeric, thread_rng, Rng};
use rand::{distr::Alphanumeric, rng, Rng};
use rayon::prelude::*;
use std::{
env::temp_dir,
Expand Down Expand Up @@ -39,7 +39,7 @@ pub struct Temp(PathBuf);
impl Temp {
/// Create a temporary directory.
pub fn new_dir() -> Result<Self, Error> {
let path = thread_rng()
let path = rng()
.sample_iter(&Alphanumeric)
.take(15)
.map(char::from)
Expand Down
5 changes: 5 additions & 0 deletions tests/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ fn json_input() {

#[test]
fn json_output_json_input() {
#![allow(
clippy::zombie_processes,
reason = "can't wait without violating borrow rule"
)]

let workspace = SampleWorkspace::default();

let json_output = Command::new(PDU)
Expand Down