Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'erd -y iflat --sort size --dirs-only' does not sort as expected; also: should the order of the params matter? #224

Open
johnnyutahh opened this issue Jul 2, 2023 · 4 comments

Comments

@johnnyutahh
Copy link

erd -y iflat --sort size --dirs-only does not appear to sort the dirs properly.

My guess is that it's sorting the non-dirs, -y iflat output first and then applying the --dirs-only "filter"... but I've not tested nor investigated my guess, so it (my guess) may not be worth much.

The order of the -y, --sort, --dirs-only parameters seems to have no effect, but I may not have tried every combination. Broader question: do we want the order to matter? I propose it should not.

$ erd --version
erdtree 3.1.2
$ type erd
erd is hashed (/opt/homebrew/bin/erd)
$
$ pwd
/Users/XXXX/gitrs/erdtree
$
$ erd -y iflat --sort size --dirs-only
6139904 B   erdtree
5607424 B   assets
 335872 B   src
  81920 B   src/context
  24576 B   src/context/config
  16384 B   src/context/config/toml
  53248 B   src/tree
  24576 B   src/tree/node
  49152 B   src/render
  20480 B   src/render/layout
  16384 B   src/render/grid
   4096 B   src/render/long
  45056 B   src/fs
  28672 B   src/fs/permissions
  32768 B   src/disk_usage
  24576 B   src/disk_usage/file_size
  24576 B   src/icons
  16384 B   src/styles
  12288 B   src/tty
  77824 B   tests
  24576 B   tests/data
   4096 B   tests/data/the_yellow_king
   4096 B   tests/data/dream_cycle
   4096 B   tests/data/lipsum
   4096 B   tests/utils
   4096 B   tests/hardlinks
   4096 B   scripts
        -   example

27 directories
$
$
$
$ git remote show origin | grep URL; git rev-parse HEAD
  Fetch URL: https://github.com/solidiquis/erdtree
  Push  URL: https://github.com/solidiquis/erdtree
202fae12b0cb4c0ce0a948060104df855e9ec3c5
$
$ sw_vers
ProductName:	macOS
ProductVersion:	12.6.5
BuildVersion:	21G531
$ date
Sun Jul  2 15:29:57 EDT 2023
$
@solidiquis
Copy link
Owner

Off to investigate

@solidiquis
Copy link
Owner

Ahh yeah so I could see why this is confusing. erdtree sorts in such a way that makes a coherent tree structure:

Screen Shot 2023-07-03 at 8 46 55 AM

I didn't think of the effects this would have on the flat and iflat layouts. I will probably have sorting work differently between the flat/iflat layouts and the regular/inverted layouts.

@johnnyutahh
Copy link
Author

I didn't think of the effects this would have on the flat and iflat layouts. I will probably have sorting work differently between the flat/iflat layouts and the regular/inverted layouts.

That's what I was thinking and makes perfect sense to me.

@solidiquis - is this comfortably feasible for a future erd release?

@solidiquis
Copy link
Owner

solidiquis commented Jul 4, 2023

Yes I'm working on it today actually :)

Edit: the next release should be out later this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants