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

Feature/Enhancement Request | Live-print the tree instead of building before displaying #4

Open
JosephLai241 opened this issue Aug 24, 2022 · 0 comments
Assignees
Labels
beta This issue or feature should be resolved or implemented before an official release enhancement New feature or request

Comments

@JosephLai241
Copy link
Owner

Provide Context for the New Feature or Enhancement You Would Like

nomad currently builds the entire tree before it is displayed in the terminal. While this is not an issue when running nomad within smaller directories, it becomes substantial when running it in very large directories like /, for example. After running nd, it appears the command is hanging but nomad is actually just building the tree in the background.

Like what the original tree command appears to do, live-printing the tree as nomad finds new files or directories would provide a better user experience.

Explain Why You Believe This Would Be a Good Feature

Everyone loves a program that runs fast. Who actually likes waiting, especially for something written in Rust?

The hanging effect after running nd in big directories in the terminal may also cause confusion for the end user (ie. "did nomad crash?").

Is Your Request Related To a Problem?

I did not open a separate bug report for this since this is technically not a bug, but rather a performance issue.

Describe Alternatives You Have Considered

I have considered writing my own implementation of a tree-building library; however, I believe ptree is already a great crate, so why reinvent the wheel?

Additional Context

This is currently just a limitation of the default method of tree building that the ptree crate offers, since I did not implement a custom TreeItem trait and just used the provided TreeBuilder struct and print_tree_with() function to create and display the tree with custom formatting settings.

I believe this feature may be fulfilled once I take a deeper dive into the inner workings of ptree. If it is not possible to do by just implementing my own TreeItem trait, perhaps I would have to modify the source code and maybe even open a pull request for ptree adding a live print option of some sort when I figure it out. If I do open a PR for ptree and it is not accepted, I will just have to fork my own version of the crate and include it in nomad's source code.

@JosephLai241 JosephLai241 added enhancement New feature or request beta This issue or feature should be resolved or implemented before an official release labels Aug 24, 2022
@JosephLai241 JosephLai241 self-assigned this Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta This issue or feature should be resolved or implemented before an official release enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant