Giter Site home page Giter Site logo

nikitaivanovv / ictree Goto Github PK

View Code? Open in Web Editor NEW
143.0 143.0 8.0 1.13 MB

Like tree but interactive

Home Page: https://nikitaivanovv.github.io/ictree/

License: GNU General Public License v3.0

Makefile 3.89% C 94.52% Shell 1.59%
command-line command-line-interface command-line-tool interactive linux pager terminal terminal-app tree tui

ictree's People

Contributors

balsoft avatar data-man avatar dufferzafar avatar jirutka avatar nikitaivanovv avatar oliver-leete avatar rickbot-dot avatar step- avatar viccie30 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ictree's Issues

Cygwin install error when on Windows and running MSYS2

What I was trying to do:

$ pacman -S git
resolving dependencies...
looking for conflicting packages...

Packages (32) heimdal-7.7.0-3  openssh-8.8p1-1  perl-Authen-SASL-2.16-2  perl-Clone-0.45-2  perl-Convert-BinHex-1.125-1
              perl-Encode-Locale-1.05-1  perl-Error-0.17029-1  perl-File-Listing-6.14-1  perl-HTML-Parser-3.76-1
              perl-HTML-Tagset-3.20-2  perl-HTTP-Cookies-6.10-1  perl-HTTP-Daemon-6.12-1  perl-HTTP-Date-6.05-1
              perl-HTTP-Message-6.35-1  perl-HTTP-Negotiate-6.01-2  perl-IO-HTML-1.004-1  perl-IO-Socket-SSL-2.072-1
              perl-IO-Stringy-2.113-1  perl-LWP-MediaTypes-6.04-1  perl-MIME-tools-5.509-1  perl-MailTools-2.21-1
              perl-Net-HTTP-6.21-1  perl-Net-SMTP-SSL-1.04-1  perl-Net-SSLeay-1.90-1  perl-TermReadKey-2.38-2  perl-TimeDate-2.33-1
              perl-Try-Tiny-0.31-1  perl-URI-5.10-1  perl-WWW-RobotRules-6.02-2  perl-libwww-6.57-1  vim-8.2.3582-1  git-2.34.1-2

Total Download Size:   16.41 MiB
Total Installed Size:  92.11 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 perl-Net-SSLeay-1.90-1-x86_64                       236.3 KiB   193 KiB/s 00:01 [#############################################] 100%
 perl-MIME-tools-5.509-1-any                         194.9 KiB   414 KiB/s 00:00 [#############################################] 100%
 heimdal-7.7.0-3-x86_64                              430.2 KiB   221 KiB/s 00:02 [#############################################] 100%
 git-2.34.1-2-x86_64                                   5.5 MiB  1337 KiB/s 00:04 [#############################################] 100%
 perl-IO-Socket-SSL-2.072-1-any                      153.2 KiB  59.9 KiB/s 00:03 [#############################################] 100%
 vim-8.2.3582-1-x86_64                                 8.0 MiB  1753 KiB/s 00:05 [#############################################] 100%
 perl-HTML-Parser-3.76-1-x86_64                       80.5 KiB   348 KiB/s 00:00 [#############################################] 100%
 perl-libwww-6.57-1-any                              128.0 KiB  48.7 KiB/s 00:03 [#############################################] 100%
 openssh-8.8p1-1-x86_64                              898.9 KiB   182 KiB/s 00:05 [#############################################] 100%
 perl-MailTools-2.21-1-any                            81.0 KiB  94.5 KiB/s 00:01 [#############################################] 100%
 perl-IO-Stringy-2.113-1-any                          66.4 KiB   120 KiB/s 00:01 [#############################################] 100%
 perl-URI-5.10-1-any                                  76.4 KiB  88.1 KiB/s 00:01 [#############################################] 100%
 perl-HTTP-Message-6.35-1-any                         75.9 KiB  92.9 KiB/s 00:01 [#############################################] 100%
 perl-TimeDate-2.33-1-any                             55.2 KiB  75.4 KiB/s 00:01 [#############################################] 100%
 perl-Authen-SASL-2.16-2-any                          42.4 KiB   229 KiB/s 00:00 [#############################################] 100%
 perl-Convert-BinHex-1.125-1-any                      42.8 KiB  93.1 KiB/s 00:00 [#############################################] 100%
 perl-HTTP-Daemon-6.12-1-any                          39.6 KiB   243 KiB/s 00:00 [#############################################] 100%
 perl-LWP-MediaTypes-6.04-1-any                       40.7 KiB   128 KiB/s 00:00 [#############################################] 100%
 perl-Error-0.17029-1-any                             39.4 KiB  86.3 KiB/s 00:00 [#############################################] 100%
 perl-TermReadKey-2.38-2-x86_64                       42.0 KiB  44.5 KiB/s 00:01 [#############################################] 100%
 perl-HTTP-Date-6.05-1-any                            28.9 KiB  42.3 KiB/s 00:01 [#############################################] 100%
 perl-Encode-Locale-1.05-1-any                        24.3 KiB  32.2 KiB/s 00:01 [#############################################] 100%
 perl-HTTP-Cookies-6.10-1-any                         23.4 KiB   183 KiB/s 00:00 [#############################################] 100%
 perl-Net-SMTP-SSL-1.04-1-any                         18.4 KiB   128 KiB/s 00:00 [#############################################] 100%
 perl-Try-Tiny-0.31-1-any                             19.8 KiB   125 KiB/s 00:00 [#############################################] 100%
 perl-Net-HTTP-6.21-1-any                             23.9 KiB  28.6 KiB/s 00:01 [#############################################] 100%
 perl-IO-HTML-1.004-1-any                             16.1 KiB  81.1 KiB/s 00:00 [#############################################] 100%
 perl-WWW-RobotRules-6.02-2-any                       12.2 KiB  69.2 KiB/s 00:00 [#############################################] 100%
 perl-File-Listing-6.14-1-any                         11.7 KiB  58.6 KiB/s 00:00 [#############################################] 100%
 perl-HTTP-Negotiate-6.01-2-any                       11.4 KiB  44.1 KiB/s 00:00 [#############################################] 100%
 perl-Clone-0.45-2-x86_64                             11.3 KiB  7.62 KiB/s 00:01 [#############################################] 100%
 perl-HTML-Tagset-3.20-2-any                          10.3 KiB  3.77 KiB/s 00:03 [#############################################] 100%
 Total (32/32)                                        16.4 MiB  1284 KiB/s 00:13 [#############################################] 100%
(32/32) checking keys in keyring                                                 [#############################################] 100%
(32/32) checking package integrity                                               [#############################################] 100%
(32/32) loading package files                                                    [#############################################] 100%
(32/32) checking for file conflicts                                              [#############################################] 100%
(32/32) checking available disk space                                            [#############################################] 100%
:: Processing package changes...
( 1/32) installing vim                                                           [#############################################] 100%
( 2/32) installing heimdal                                                       [#############################################] 100%
( 3/32) installing openssh                                                       [#############################################] 100%
( 4/32) installing perl-Error                                                    [#############################################] 100%
( 5/32) installing perl-Authen-SASL                                              [#############################################] 100%
( 6/32) installing perl-Encode-Locale                                            [#############################################] 100%
( 7/32) installing perl-HTTP-Date                                                [#############################################] 100%
( 8/32) installing perl-File-Listing                                             [#############################################] 100%
( 9/32) installing perl-HTML-Tagset                                              [#############################################] 100%
(10/32) installing perl-Clone                                                    [#############################################] 100%
(11/32) installing perl-IO-HTML                                                  [#############################################] 100%
(12/32) installing perl-LWP-MediaTypes                                           [#############################################] 100%
(13/32) installing perl-URI                                                      [#############################################] 100%
(14/32) installing perl-HTTP-Message                                             [#############################################] 100%
(15/32) installing perl-HTML-Parser                                              [#############################################] 100%
(16/32) installing perl-HTTP-Cookies                                             [#############################################] 100%
(17/32) installing perl-HTTP-Daemon                                              [#############################################] 100%
(18/32) installing perl-HTTP-Negotiate                                           [#############################################] 100%
(19/32) installing perl-Net-HTTP                                                 [#############################################] 100%
(20/32) installing perl-WWW-RobotRules                                           [#############################################] 100%
(21/32) installing perl-Try-Tiny                                                 [#############################################] 100%
(22/32) installing perl-libwww                                                   [#############################################] 100%
Optional dependencies for perl-libwww
    perl-LWP-Protocol-https: for https:// url schemes
(23/32) installing perl-TimeDate                                                 [#############################################] 100%
(24/32) installing perl-MailTools                                                [#############################################] 100%
(25/32) installing perl-IO-Stringy                                               [#############################################] 100%
(26/32) installing perl-Convert-BinHex                                           [#############################################] 100%
module test... pass.
(27/32) installing perl-MIME-tools                                               [#############################################] 100%
(28/32) installing perl-Net-SSLeay                                               [#############################################] 100%
(29/32) installing perl-IO-Socket-SSL                                            [#############################################] 100%
(30/32) installing perl-Net-SMTP-SSL                                             [#############################################] 100%
(31/32) installing perl-TermReadKey                                              [#############################################] 100%
(32/32) installing git                                                           [#############################################] 100%
Optional dependencies for git
    python: various helper scripts [installed]
    subversion: git svn
$ git clone --recursive https://github.com/NikitaIvanovV/ictree.git
Cloning into 'ictree'...
remote: Enumerating objects: 467, done.
remote: Counting objects: 100% (467/467), done.
remote: Compressing objects: 100% (258/258), done.
remote: Total 467 (delta 296), reused 367 (delta 198), pack-reused 0
Receiving objects: 100% (467/467), 1.07 MiB | 4.90 MiB/s, done.
Resolving deltas: 100% (296/296), done.
Submodule 'c-vector' (https://github.com/eteran/c-vector) registered for path 'c-vector'
Submodule 'termbox2' (https://github.com/termbox/termbox2) registered for path 'termbox2'
Cloning into '/c/Users/tyler/scoop/persist/msys2/home/tyler/ictree/c-vector'...
remote: Enumerating objects: 248, done.
remote: Counting objects: 100% (168/168), done.
remote: Compressing objects: 100% (115/115), done.
remote: Total 248 (delta 86), reused 110 (delta 45), pack-reused 80
Receiving objects: 100% (248/248), 62.09 KiB | 648.00 KiB/s, done.
Resolving deltas: 100% (128/128), done.
Cloning into '/c/Users/tyler/scoop/persist/msys2/home/tyler/ictree/termbox2'...
remote: Enumerating objects: 131, done.
remote: Counting objects: 100% (131/131), done.
remote: Compressing objects: 100% (88/88), done.
remote: Total 131 (delta 63), reused 102 (delta 38), pack-reused 0
Receiving objects: 100% (131/131), 73.96 KiB | 4.93 MiB/s, done.
Resolving deltas: 100% (63/63), done.
Submodule path 'c-vector': checked out '396fb9b6ffff99f204edebaa322d27bfe0c19ba5'
Submodule path 'termbox2': checked out '00c017b261de809400a789ebadccda3059bdecbc'

$ make install

The bug:

cc -c -o build/args.o -std=gnu99 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude -I. -Os -Itermbox2 -Ic-vector -MD src/args.c
make: cc: No such file or directory
make: *** [Makefile:71: build/args.o] Error 127

Left / Right arrow keys to fold

Currently, up/down arrow keys can be used to traverse the tree, while enter folds / unfolds.

In other tree like controls (usually on GUIs), left / right arrow keys are used to unfold / fold an item

Parse json?

I know this sounds far fetched, but do you think ictree could be used as an interactive JSON viewer? Like jless.

This would allow us to use ictree as an interactive tree as well, since tree supports json output as well, so something like this would work: tree -J | ictree

Can't exit via Ctrl + C

Run ictree without piping any input. There's no way to exit it now. I guess it's trying to read some input?

Only thing that works is sending Ctrl + \ which sends SIGKILL.

grep and other tools respect Ctrl + C when ran without any files etc.

Consider porting this to FreeBSD, Windows, etc.

I feel this is only supported on GNU/Linux. There's already a tree command in every major OS and shell.
However, I would recommend that all software can be used on every OS. Consider making ports of ictree?

Released binary depends on libc and hardcodes the interpreter

Typically, when people distribute standalone binaries for Linux, they are expected to be statically linked and have no external library dependencies. However, it is not the case for the binary distributed with the release now:

$ file ictree
ictree: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=559effd629008872ca992ef83c7b78f9ce73b2d7, for GNU/Linux 4.4.0, stripped
$ ldd ictree
	linux-vdso.so.1 (0x00007fff03b8b000)
	libc.so.6 => /nix/store/saw6nkqqqfx5xm1h5cpk7gxnxmw9wk47-glibc-2.33-62/lib/libc.so.6 (0x00007ff4a1968000)
	/lib64/ld-linux-x86-64.so.2 => /nix/store/saw6nkqqqfx5xm1h5cpk7gxnxmw9wk47-glibc-2.33-62/lib64/ld-linux-x86-64.so.2 (0x00007ff4a1b43000)

This may cause issues when running on musl systems, or on systems without /lib/ld-linux-x86-64.so.2 since then the hardcoded interpreter doesn't exist. One way to avoid such dependencies is to produce a statically linked executable linked to musl. E.g. with Nix:

nix-build -E 'with import <nixpkgs> {}; pkgsStatic.stdenv.mkDerivation { name = "ictree"; src = ./.; installPhase = "make install PREFIX=$out"; }'

The resulting executable will be a bit larger (since it carries the relevant parts of libc with it) but it should work on a much wider set of systems, and do so more reproducibly and consistently.

make "y" copy independent of a display server

First of all thank your work on this really interesting tool. I found it via suckless.org and the termbox library links. Nice to know you're also an Archlinux user. It really deserves a post there on the forum.

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.

So, by default, "y" is binded to a clipboard action. When one is not using X11/Wayland it doesnt do anything.

Since I'm using tmux, without X11 I tried in ~/.config/ictree/config

map y echo "$f" | tmux load-buffer -

And it worked !

So, my suggestion, instead of hard coding "y" to use xsel etc,

Maybe you could probe for a $DISPLAY environement (returning false), and a $TMUX environment (returning true). If both check then map y to the tmux copy buffer.

By the way,

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

You might want to add to the README/man page a word or two about quoting that $f.
Apparently ictree sends $f unquoted.

I first tried

map e $EDITOR $f
or
map i $PAGER $f

But very often my folders and files have spaces, so it failed.

I had to

map e $EDITOR "$f"
or
map i $PAGER "$f"

What would be cool....

  • The ability to edit with the editor set in the environmental variable $EDITOR.
  • View an image with the default image viewer (in my case imv)
    You get the idea ๐Ÿ˜„

[Question] Package dependencies with releases?

Hello and thank you for making this useful tool. I am currently trying to package it for Void Linux. Void requires that only official releases be packaged and not just the current git HEAD.

However, when downloading the releases the c-vector and termbox2 directories are empty (as if cloned without git clone --recursive). Is it possible to package these so that ictree can be built from the release tarballs?

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.