ujjwall-r / dree Goto Github PK
View Code? Open in Web Editor NEWOne single package for visualization, debugging, and exploration of folder hierarchies
One single package for visualization, debugging, and exploration of folder hierarchies
Refer the below code.
#include <iostream>
#include <vector>
#include <string>
#include <ncurses.h>
#include <unistd.h>
struct MenuItem
{
std::string text;
std::string path;
};
void renderMenu(const std::vector<MenuItem> &menu, int selected)
{
clear();
for (int i = 0; i < menu.size(); ++i)
{
if (i == selected)
{
attron(A_REVERSE);
}
mvprintw(i + 1, 1, menu[i].text.c_str());
attroff(A_REVERSE);
}
refresh();
}
int main()
{
// Initialize ncurses
initscr();
cbreak();
noecho();
keypad(stdscr, TRUE);
// Define menu items
std::vector<MenuItem> menu = {
{"Item 1", "/path1"},
{"Item 2", "/path2"},
{"Item 3", "/path3"},
// Add more items as needed
};
int currentSelection = 0;
int key;
do
{
renderMenu(menu, currentSelection);
key = getch();
switch (key)
{
case KEY_UP:
currentSelection = std::max(0, currentSelection - 1);
break;
case KEY_DOWN:
currentSelection = std::min(static_cast<int>(menu.size() - 1), currentSelection + 1);
break;
case 10: // Enter key
// Perform action associated with the selected item (change directory and exit)
if (chdir(menu[currentSelection].path.c_str()) == 0)
{
endwin(); // End ncurses mode before executing new shell
execlp("zsh", "zsh", nullptr); // Start a new shell in the new directory
std::cerr << "Error executing new shell." << std::endl;
return 1;
}
else
{
std::cerr << "Error changing directory." << std::endl;
}
break;
}
} while (key != 27); // Exit when the user presses the Esc key
// Cleanup
endwin();
return 0;
}
Figure out way to automatically select bash or zsh.
DreeHelperInterface is not initialised in the dree loader Constructor. Its weird it worked on Linux. But showing segmentation fault in Mac.
The CLI should be basically graph/tree based showcase of directory tree in terminal. It should be informative, clean and beautiful.
Ref: https://medium.com/@tejohnso/publishing-a-command-line-c-program-to-aur-and-snapcraft-db538c2af051
Publish the repository on Arch Users Repository Base.
Come up with a plan to implement optimized and fast search
Come up with plan and implementation of level wise dree printing. (Maybe BFS)
Line 4 in 78090b0
Debug and release migration for macOS
Look where memory leak is happening and how to reduce it.
Remove unnecessary printings in terminal interface
For more info read : https://dev.to/ujjwall-r/i-tried-making-a-terminal-based-file-exploration-package-2142
Come up with plan of writing unit tests for already built methods.
It would be great to have a --help
flag passed with the dree
command for better understanding of currently available command options supported.
Why is this useful?
Helpful for the first time users.
Dree is compatible to run for Linux only . Make it also run on windows and other OS.
Add instructions for dree -f command:
eg. dree 3 -f "directory_name"
different emojis for different file extensions
Navigate view is utilizing helper model which violates the dependency rule in context of architectural boundaries.
run: dree 3 -a
compare both
Rewrite the readme.
Plan and come up how to enable directory navigation. ( Moving Closer towards a file manager )
eg node_modules, caches etc etc
Come up with a plan and discussion
eg. incase of cache files
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.