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

Skip through single parent directory in interactive mode #110

Closed
kidonng opened this issue Oct 24, 2021 · 4 comments
Closed

Skip through single parent directory in interactive mode #110

kidonng opened this issue Oct 24, 2021 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@kidonng
Copy link
Contributor

kidonng commented Oct 24, 2021

If given a single directory as parameter in interactive mode (e.g. dua i Developer), dua-cli's initial state will be like:

Screen Shot 2021-10-25 at 01 33 57

However there's nothing useful here, the total usage is available at the bottom and the percentage will certainly be 100%. What users expect is more likely this (e.g. dua i Developer/*):

Screen Shot 2021-10-25 at 01 33 52

(The entries difference is because we are not counting the parent directory, but that should not matter.)

There should a badge or something like that to inform the users dua-cli has skipped through the parent directory.


If dua-cli can skip all single parent directory, that will be more awesome.

Let's suppose we have the following file structure:

a
└── b
   └── c
      ├── 1
      ├── 2
      ├── 3
      ├── 4
      ├── 5
      ├── 6
      ├── 7
      ├── 8
      ├── 9
      └── 10

It is ideal that dua i a equals dua i a/b/c/*.

@Byron Byron added enhancement New feature or request help wanted Extra attention is needed labels Oct 24, 2021
@Byron
Copy link
Owner

Byron commented Oct 24, 2021

Thanks for sharing :)! I like the idea of generalizing the 'skip single-parent roots', which would solve the startup issue of showing something people probably aren't very interested in, while also preventing people from having to skip through mostly empty directories.

If that auto-skipping happens, showing some information would definitely be useful.

Allow me a few questions though:

  • what happens when the user goes backwards? Will it skip 'upwards' the the behaviour is symetrical?
    • How can the user delete directories that where skipped?
  • In the light of the above, would an MVP version of the feature rather be to skip over the initial parent if there is nothing more to see, without generalizing it?

@Byron Byron added the question Further information is requested label Oct 24, 2021
@kidonng
Copy link
Contributor Author

kidonng commented Oct 25, 2021

  • what happens when the user goes backwards? Will it skip 'upwards' the the behaviour is symetrical?

No, it should behave just like normal.

GitHub has a similar behavior for skipping single parent directories, however it only does so when you open subdirectories, not when you go upwards.

  • How can the user delete directories that where skipped?

That's a good question, I didn't think about it. I will answer it in the next question.

  • In the light of the above, would an MVP version of the feature rather be to skip over the initial parent if there is nothing more to see, without generalizing it?

Ideally it should work "transparently", i.e. it should behave like the user supplied subdirectories as arguments. But since #82 has not been implemented yet, transparently skipping stuff will cause some inability.

In that case, dua-cli can just "fast-forward" its initial root to the most meaningful subdirectory.

I'm not sure what do you mean by "generalizing", here is how it may work:

  1. User supplied a root directory with single child
  2. dua-cli analyze the directory as usual, but instead of showing it directly, it shows the first subdirectory with multiple children, and display a message single-parent root "foo" has been skipped (or "foo/bar/baz" if multiple ones are skipped). User can still go up (and execute actions on those skipped ones) just like normal.

@Byron Byron removed the question Further information is requested label Apr 20, 2023
Byron added a commit that referenced this issue Dec 6, 2023
…orking dir (#110)

This makes it seem like the user started the directory walk directly in the given directory,
which is more intuitive than the previous approach only showed the given directory as
top-level directory.

Note that this change only affects invocations like `dua <dir>` or `dua i <dir>`.
@gosuwachu
Copy link
Contributor

IMHO this is as much done as it makes sense to do.

@Byron
Copy link
Owner

Byron commented Dec 9, 2023

Thanks for the reminder!

@Byron Byron closed this as completed Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants