Skip to content

NikitaIvanovV/ictree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ictree

Sometimes I need to find some file with locate or find. I use the command but, instead of getting several lines of output that are easy to look through, I get hundreds of them... Then I try to pipe that mess into tree --fromfile . | less, hoping that it will be less of a pain to find what I'm looking for. But it's not always the case: you cannot fold directories you're not interested in within less, so you have to hold ^F...

I got sick of it and made this simple program that takes a list of contents of directories and provides a terminal interface where you can fold/unfold items and jump between them quickly.

showcase

The program is written in C using awesome termbox2 library for rendering UI.

Installation

Manual

git clone --recursive https://github.com/NikitaIvanovV/ictree
cd ictree
sudo make install

Uninstall with sudo make uninstall

Warning: don't forget to add --recursive option to git clone command! Otherwise, you will get No such file or directory errors while compiling.

Alpine Linux

If you are an Alpine Linux user, you can install ictree package (available in Alpine v3.17+ and in Edge).

apk add ictree

AUR

If you are an Arch Linux user, you can install ictree AUR package.

yay -S ictree

Usage

Basic usage:

locate something | ictree
find | ictree

ictree can also read from a file:

ictree list.txt

Once you invoke the command, the UI should pop up. You can toggle folding of directories by hitting Enter. You can move around with arrow keys but if you know the Vi commands, they are supported too!

You can press y to copy a selected item into X or Wayland clipboard. Note that you must have xsel or wl-copy installed (depending on whether you use X or Wayland) to use the command.

You also can press o to write a path to standard output and exit program. It may be useful in a system without a display server.

You can define custom commands in a configuration file to open selected path in another program (e.g. an image viewer or a text editor):

# open file in $EDITOR
map e $EDITOR "$f"

Please read the manual (man ictree) for more details on existing commands and options: https://nikitaivanovv.github.io/ictree

License

This project is licensed under GPLv3. Please refer to the LICENSE for more information.