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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ The benchmark was generated by [a GitHub Workflow](https://github.com/KSXGitHub/
## Limitations

* Ignorant of reflinks (from COW filesystems such as BTRFS and ZFS).
* Do not follow symbolic links.
* Do not differentiate filesystem: Mounted folders are counted as normal folders.
* Does not follow symbolic links.
* Does not differentiate filesystems: Mounted folders are counted as normal folders.
* The runtime is optimized at the expense of binary size.

## Usage
Expand Down Expand Up @@ -134,7 +134,7 @@ The [parallel-disk-usage crate](https://crates.io/crates/parallel-disk-usage) is

Alternatively, the `pdu` command provides `--json-input` flag and `--json-output` flag. The `--json-output` flag converts disk usage data into JSON and the `--json-input` flag turns said JSON into visualization. These 2 flags allow integration with other CLI tools (via pipe, as per the UNIX philosophy).

Beware that the structure of the JSON tree differs depends on the number of file/directory names that were provided (as CLI arguments):
Beware that the structure of the JSON tree differs depending on the number of file/directory names that were provided (as CLI arguments):
* If there are only 0 or 1 file/directory names, the name of the tree root would be a real path (either `.` or the provided name).
* If there are 2 or more file/directory names, the name of the tree root would be `(total)` (which is not a real path), and the provided names would correspond to the children of the tree root.

Expand Down
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl App {
if cfg!(unix) && self.args.deduplicate_hardlinks && self.args.files.len() > 1 {
// Hardlinks deduplication doesn't work properly if there are more than 1 paths pointing to
// the same tree or if a path points to a subtree of another path. Therefore, we must find
// and remove such overlapping paths before they cause problem.
// and remove such overlapping paths before they cause problems.
use overlapping_arguments::{remove_overlapping_paths, RealApi};
remove_overlapping_paths::<RealApi>(&mut self.args.files);
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/overlapping_arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl Api for RealApi {

/// Hardlinks deduplication doesn't work properly if there are more than 1 paths pointing to
/// the same tree or if a path points to a subtree of another path. Therefore, we must find
/// and remove such overlapping paths before they cause problem.
/// and remove such overlapping paths before they cause problems.
pub fn remove_overlapping_paths<Api: self::Api>(arguments: &mut Vec<Api::Argument>) {
let to_remove = find_overlapping_paths_to_remove::<Api>(arguments);
remove_items_from_vec_by_indices(arguments, &to_remove);
Expand Down Expand Up @@ -102,14 +102,14 @@ pub fn remove_items_from_vec_by_indices<Item>(vec: &mut Vec<Item>, indices: &Has
return;
}

// Optimization: If there is only 1 element to remove, shifting elements would be cheaper than reallocate a whole array.
// Optimization: If there is only 1 element to remove, shifting elements would be cheaper than reallocating a whole array.
if indices.len() == 1 {
let index = *indices.iter().next().unwrap();
vec.remove(index);
return;
}

// Default: If there are more than 1 elements to remove, just copy the whole array without them.
// Default: If there are more than 1 element to remove, just copy the whole array without them.
*vec = vec
.pipe(take)
.into_iter()
Expand Down
2 changes: 1 addition & 1 deletion src/args/threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub enum Threads {
Fixed(NonZeroUsize),
}

/// Error that occurs when parsing a string to as [`Threads`].
/// Error that occurs when parsing a string as [`Threads`].
#[derive(Debug, Display, Clone, PartialEq, Eq, Error)]
#[non_exhaustive]
pub enum FromStrError {
Expand Down
2 changes: 1 addition & 1 deletion src/fs_tree_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ where
pub hardlinks_recorder: &'a HardlinksRecorder,
/// Reports progress to external system.
pub reporter: &'a Report,
/// Deepest level of descendent display in the graph. The sizes beyond the max depth still count toward total.
/// Deepest level of descendant display in the graph. The sizes beyond the max depth still count toward total.
pub max_depth: u64,
}

Expand Down
2 changes: 1 addition & 1 deletion src/tree_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ where
pub get_info: GetInfo,
/// Function to join parent's `path` with a child's name to make the child's `name`.
pub join_path: JoinPath,
/// Deepest level of descendent to store as arrays. The sizes beyond the max depth still count toward total.
/// Deepest level of descendant to store as arrays. The sizes beyond the max depth still count toward total.
pub max_depth: u64,
}

Expand Down
2 changes: 1 addition & 1 deletion src/visualizer/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ where
Name: Display,
Size: size::Size + Into<u64>,
{
/// Create ASCII rows that visualize of the [tree](crate::data_tree::DataTree), such rows
/// Create ASCII rows that visualize the [tree](crate::data_tree::DataTree), such rows
/// are meant to be printed to a terminal screen.
pub fn rows(mut self) -> Vec<String> {
let initial_table = render_initial(self);
Expand Down