Git Product home page Git Product logo

as-tree's People

Contributors

0xflotus avatar jez avatar raytracer 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

as-tree's Issues

If piped output is empty can as-tree not print new line?

If fdfind folder_name returns a empty output | as-tree prints a new-line. Is it possible to not make it print new-line?

Actual behavior:

$ fdfind folder_name  # returns no solution
$ fdfind folder_name | as-tree                                       

$

Wanted behavior:

$ fdfind folder_name  # returns no solution
$ fdfind folder_name | as-tree                                       
$

Windows build?

This looks like a very useful tool. Any chance of releasing a build for Windows (e.g. Cygwin)?

[CR]: remove token from .travis.yml?

secure: BnKdnETj/m+MgWkeMWcw5geKD0+gadJPCYBVj8eSW6WCjwHTqfAhasjSRNGdR4KbvNwAYfl2b12AMsdWci5lR97TmVZB7SyNnSwpilQM3kEiGUGv3BaTnZ6MNe2rcmcTNSKcQ1/ou8vBXwVeeH2aSlhLASW5kpjnBu9cz7vbuuuWsV5faXD1WPlxI+zGjwBtasBk+hcW9CnMvXYoklosRPk1dTg6Y571d6xcIPJ4C8hjLWCLY984YPluZNkqmOUhGmQThkElQfzbtl2ABcpGkINDyjFM30D1N47Ccu7FIsmgtmspHn3RisEFyCw/68qUGO39i9v0MELCx/Zxccj4F4a37FAOXjjRXFQC8HsVITg3cr5utPddpiGl3e9dNa7lKzJqYEn6OOwfUOHWpL1ZrDmjYwHSNj6ii/O66DdqJ8UE/PvxraA2GUKztro4PmDnj/dq05NdK/CIFSCEdJwZEOBdgHAdhSVLC1Y6wrPyyHGD/4doK5HqdfXGCVDI4NYLFySJ9Z+mopPXKsFlFd79OPFtvaHsjXvxvYUAABtxM62CqfRhJs1XjHs9yPuW6h9DDq7bY+jxj9EwkX9vmhntpkzmbDWAHDHnb7Rzhk9iS9XEKG3rlJGx8F/O1FwQKUoOhUz1mJBiiChENNfIJXLLLkPvC/wgEfD7vCF9KAKK+Is=

Is it a good idea to store this token in .travis.yml? Wouldn't it be better to use an environment variable which you can store on travis?

Windows Support/Binary ?

Hi

This is not an issue but just a query.
I just recently came across this repository and was excited to test it.
However, there doesn't appear to be any Windows binaries release I could take out for a spin.
I briefly tried installing via rust/cargo but quickly ran into some errors.
Is there support (or at least a plan) for Windows ?

about tree views ?

Hi,

thanks to fd, I have found as-tree which is very nice (and works well on Windows with cargo install -f --git https://github.com/jez/as-tree ).

Very nice that it can work with text:

>"A/B/C" | as-tree.exe
A/B
└── C

Could there be options to get if the use case is not rare enough?

A
└── B
    └── C

(I was surprised by the mixture of single line common parts at first run).
Would it be possible to precise separator/delimiter, default being "/" (Maybe not as it works well with default \ on Windows/PowerShell) but for any other sequence separated by :,. in cas the tool is used in other context?

C:/ seems displayed like so: C:/\.

Thanks

Option to group directories last

When finding paths with find and fd, I often pipe the results into a script I wrote called pathsort that groups files before directories.

Piping the output of pathsort into as-tree has no effect, as as-tree sorts its input.

It would be nice if as-tree had an option to group files before directories.

Gnu ls has the --group-directories-first option. tree has the --dirsfirst option. A long flag like those would be fine, but a one letter short flag would be ideal. Neither has an option to group files first.

For list output, I can see both groupings to be useful, but the existing tools only offer directories first.

For find and tree output, for some reason grouping files before directories makes more sense to me. I'm not sure why. Maybe it's because once you've seen the files in the directory, you can be done thinking about that directory for the remainder of the output.

This is my pathsort script:

#!/bin/sh
set -euo pipefail

# 1.  Replace the last `/` with `/ /`
# 2.  Sort
# 3.  Replace the `/ /` with `/`
pathsort()
{
        sed -E 's/(.*)\//\1\/ \//' | sort | sed -E 's/(.*)\/ \//\1\//'
}

case "${1-}" in
        -fd )
                # It would be nice if `fd` had an option to prepend `./` to all relative paths,
                # so that all paths have at least one `/` in them.
                sed 's/^/.\//' | pathsort
                ;;
        * )
                pathsort
                ;;
esac

Off topic

I have this in my shell's rc file:

fdtree() { fd . -H -E .git "$@" | as-tree ; }

I've been using fdtree more than tree lately because I can write fdtree -E aaa -E bbb to exclude using multiple patterns, while tree can only have one -I ignore pattern.

Thanks for as-tree. I love it!

Publish on crates.io

Would you please publish it to crates.io? It would make it much easier to install, I use an automated script for such cases.

Add support for musl release package

Hi,

I have an old linux distribution that does not come with GLIBC_2.18. So the linux binaries archive does not work for me.

Would it be possible to add a release target that either compiles with GLIBC statically? Or alternatively, a MUSL target, which seems to be a static build anyway, similar to ripgrep or fd ?

Thread panic - broken pipe when piping output to pager

To reproduce, any of these commands cause a thread panic when piping the output of as-tree to a pager (tested with less, more, most, bat):

ls /usr/lib | as-tree | less (same when replacing less with more, most, bat, etc)

fd | as-tree | bat

fd | as-tree | cat | less

With RUST_BACKTRACE=1, the trace output is:

thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1021:9
stack backtrace:
   0: rust_begin_unwind
             at /build/rust/src/rustc-1.49.0-src/library/std/src/panicking.rs:495:5
   1: std::panicking::begin_panic_fmt
             at /build/rust/src/rustc-1.49.0-src/library/std/src/panicking.rs:437:5
   2: std::io::stdio::print_to
             at /build/rust/src/rustc-1.49.0-src/library/std/src/io/stdio.rs:1021:9
   3: std::io::stdio::_print
             at /build/rust/src/rustc-1.49.0-src/library/std/src/io/stdio.rs:1033:5
   4: as_tree::PathTrie::_print
   5: as_tree::PathTrie::_print
   6: as_tree::PathTrie::_print
   7: as_tree::main

AUR package

Hey folks!

I like this package. It can be pretty useful sometimes. Are there any plans on creating an AUR package?

Difference with `tree`

It would be interesting to include in the README any differences between as-tree and tree -C --fromfile ., since tree is already packaged by many (most?) distributions. The only one immediately apparent to me is a slight performance gain:

$ wc -l ls.list
84758 ls.list

$ hyperfine --warmup 3 'cat ls.list | tree -C --fromfile .' 'cat ls.list | as-tree'
Benchmark #1: cat ls.list | tree -C --fromfile .
  Time (mean ± σ):     571.0 ms ±   5.6 ms    [User: 571.4 ms, System: 32.9 ms]
  Range (min … max):   562.2 ms … 580.9 ms    10 runs

Benchmark #2: cat ls.list | as-tree
  Time (mean ± σ):     454.3 ms ±   7.8 ms    [User: 349.1 ms, System: 131.4 ms]
  Range (min … max):   443.1 ms … 471.9 ms    10 runs

Summary
  'cat ls.list | as-tree' ran
    1.26 ± 0.02 times faster than 'cat ls.list | tree -C --fromfile .'

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.