Commit Graph

42 Commits

Author SHA1 Message Date
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
bootandy
b68c450710 use eprintln! 2018-05-01 13:55:19 +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
8170a07886 Increase default to 20 from 15
Clean up README a bit.
2018-04-27 10:23:20 +01:00
andy.boot
0f1f823736 Add long options to cmd line params 2018-04-27 10:15:30 +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
bootandy
c7f0ea59f0 Fix tests on mac
Macos does not appear to have a predictable iteration order of the files
2018-04-24 16:50:37 +01:00
andy.boot
803934d84b By default only print last leaf of path
Fixes #9
https://github.com/bootandy/dust/issues/9

Instead of printing the all sub tree leaves only the last leaf is now
printed. See readme change for example

The flag '-p' was added to print the sub tree the old way
2018-04-24 14:54:11 +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
b3b1a867c4 Fix tests on CI
Files do not appear in predictable order - this order differs on
different versions of linux :-(.
2018-04-07 11:03:31 +01:00
bootandy
32561ecb18 Fix tests for linux 2018-04-07 10:23:47 +01:00
bootandy
1a34bc3198 Integration tests
Several tests for recursive dirs, hard & soft links.
Tests use the tempfile project.

Personally I find the tests hard to read. Am considering adding a
'--no-color' output option as this will make the tests much more
readable. (Currently we have to call format_string to get the matching
colors and if a test fails the diff is very hard to read).
2018-04-06 20:44:02 +01:00
bootandy
385ddb75e1 Minor code neatening 2018-04-06 20:35:00 +01:00
bootandy
5c6165da8a First integration test
This test needs neatening but it is the first example of a working
integration test
2018-04-05 14:45:04 +01:00
bootandy
778dbb44b3 Remove graying background
Remove background that gets grayer.
1) This looks funny on terminals that aren't black
2) Makes testing easier
2018-04-04 23:12:00 +01:00
bootandy
6a63cbe1bc fix: Dust was supposed to take multiple dir args
Dust will now work when given multiple dirs. Before this fix it would
only show the largest dir.
2018-04-03 17:54:45 +01:00
bootandy
120b4e16e7 Squash Node and DirEnt objects into single object 2018-04-03 17:05:28 +01:00
bootandy
6198e3183f pull units variable out as constant 2018-04-03 16:37:29 +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
Joe Ardent
c127580057 Bring over dev/inode pair changes from bootandy's repo 2018-03-21 23:47:37 -07:00
Joe Ardent
e75a666a4c better display-children-finding code 2018-03-21 13:43:52 -07:00
Joe Ardent
381d286847 use accessor and creator methods for new types in lib 2018-03-21 00:09:23 -07:00
Joe Ardent
0faf795284 First step of refactor done. 2018-03-20 22:40:53 -07:00
Joe Ardent
b7271b1da2 start of refactor 2018-03-20 22:09:29 -07:00
Joe Ardent
99f462f023 s/sibblings/siblings/g 2018-03-20 20:40:36 -07:00
Joe Ardent
1c80cbf28b Make printing slightly prettier 2018-03-20 19:23:36 -07:00
Joe Ardent
f802d7a6b4 quiet some clippy warnings 2018-03-20 19:23:36 -07:00
Joe Ardent
b4c6c68527 minor whitespace changes from rustfmt 2018-03-20 19:10:24 -07:00
bootandy
2c495364c7 None core OS: fix code bug 2018-03-19 16:11:55 -04:00
bootandy
ebc153f578 Use len instead of blocks.
len is simpler
2018-03-17 01:59:22 -04:00
bootandy
fc3fbc6f64 hack 2018-03-16 22:31:09 -04:00
bootandy
3d0d5cee33 human readable output 2018-03-16 19:02:33 -04:00
bootandy
9f5fe4d01e clean up 2018-03-16 16:14:09 -04:00
bootandy
8356cc6e1b hacking away on an experiment 2018-03-16 15:51:44 -04:00