Commit Graph

29 Commits

Author SHA1 Message Date
andy.boot 1d9a56e025 A way of supporting reverse 2019-10-02 22:31:49 +01:00
andy.boot ec2d9e19d4 Run format, introduce new function.
strip_end_slash_including_root will remove end slashes including the
root directory.

The root directory has been a long running problem because if we strip
the final slash we will run dust on no directory instead of the root.
2019-10-02 20:14:13 +01:00
Bob d46b63fad8 Add detection of files which fail permission
Old code caught some file permission denied but not all.
2019-10-01 22:44:17 +01:00
Bob 872a49bb7d better var name 2019-10-01 22:35:29 +01:00
Bob 2f7a88e8dc Fix issues from running on root directory
clean up: 80338f4

Fixes -d flag to work again. Add test to stop regression
2019-10-01 22:18:16 +01:00
bootandy 80338f4731 Fix running on root dir /
Fixes: https://github.com/bootandy/dust/issues/22

Allows code to run on the root directory
2019-07-04 00:03:33 +01:00
bootandy d327bd2e68 Fix code to handle single dots in path
Before this fix adding a single dot to the end of a path would cause the
code to crash.
2019-07-02 00:56:43 +01:00
bootandy 7db6cf2f32 Add test to handle single dot in path 2019-07-02 00:54:58 +01:00
bootandy 76d0762c97 Add assert to stop infinite loops 2019-07-01 22:43:10 +01:00
bootandy 876609f2cb Obey new clippy
Clippy is like having a reviewer fix your dodgy code.
2019-07-01 22:25:06 +01:00
andy.boot b1b933d851 Refactor & Optimize use of depth
Code Refactored

Using Depth now prunes the tree below the displayable depth so display
calls finish quicker.
2018-05-10 17:36:56 +01:00
andy.boot 51561994c5 Break up display_node function slightly
Also: run rustformat
2018-05-09 11:28:23 +01:00
andy.boot dd75ec4aa7 wip: code to remove duplicate arguments
Also handle case where an argument is a substring of another argument
2018-05-09 10:35:30 +01:00
bootandy 3e9f09e339 Remove unnecessary path & pathbuf code 2018-05-02 00:42:03 +01:00
bootandy 2556885622 Rust format 2018-05-02 00:39:57 +01:00
bootandy 39db8b86fd Replace simple match with map_or 2018-05-01 14:38:34 +01:00
bootandy c5830c5d00 Stop using target_os just use target_family
target_family unix covers linux and mac and wraps up the call for inodes
in a common interface.
2018-05-01 13:59:48 +01:00
andy.boot 4ac85d7dc9 Simplify tests
dust sort is now more predictable as it orders first by size and second
by name.

Walkdir still gives different iteration orders on different systems so
all output is not entirely predictable
2018-04-27 11:35:47 +01:00
andy.boot e6c777fb8b Add support for -d depth flag
Following a user request the option '-d N' allows a user to output N
levels of sub directories.

Fixed bug: so that trailing slashes are now removed.
2018-04-27 10:01:41 +01:00
andy.boot 24c97ef92f Rewrite to use walkdir instead of recursion
Advised to use walkdir by burntsushi as using recursion on file systems
can blow the stack.

walkdir is slower but allows the code to be cleaner and more reliable

Also experimented with ignore but locking the hashmap resulted in
similar performance to walkdir but with much uglier code.
2018-04-24 14:53:47 +01:00
andy.boot 0c5b08e1d2 Change package name to du-dust
The binary is still called dust. Sadly dust was taken on crates.io.
This change should allow us to send this crate to crates.io
2018-04-18 13:40:52 +01:00
bootandy 74b9178017 Refactor code 2018-04-07 17:14:06 +01:00
bootandy 120b4e16e7 Squash Node and DirEnt objects into single object 2018-04-03 17:05:28 +01:00
bootandy ecf6c8f0e5 Refactor: Pull display code out to different file 2018-03-22 17:21:51 -04:00
bootandy 4944d517f4 Apparent size mode: handle hard links.
If we are viewing apparent size then each hard linked file should be
counted. Not just the first one.
2018-03-22 14:36:17 -04:00
bootandy cce656ab4c rm dead code 2018-03-22 14:30:30 -04:00
bootandy 03a517a310 block size is always 512 on rust 2018-03-22 14:29:59 -04:00
Joe Ardent aa3f411974 fixes blocksize error in get_blocksize().
Under Linux, MetadataExt::st_blocks() returns then number of 512B
blocks.

https://doc.rust-lang.org/1.23.0/std/os/linux/fs/trait.MetadataExt.html#tymethod.st_blocks
2018-03-22 00:34:14 -07:00
Joe Ardent eb69ad19a0 break platform cfg code into utils submodule 2018-03-22 00:00:21 -07:00