Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Any neat trick to convert print -rl -- **/** into a tree?



On Sep 17,  5:54pm, Sebastian Gniazdowski wrote:
} Subject: Any neat trick to convert print -rl -- **/** into a tree?
}
} Hello,
} I'm blank at this but seeing wc -c > 60 various surprising Zsh
} expansions I suspect that it can be done: converting **/**

Do you intend that second ** to be interpreted GLOB_STAR_SHORT, or
is that a typo?

} into a tree, i.e. into output that looks like e.g. output of tree
} command

It's difficult if not impossible to do this *during* the glob pass,
because the sorting ends up confused, but if you capture the result
in a variable:

    () {
      emulate -L zsh -o extendedglob
      local x=(**/*)
      print -l ${x//([^\/]##\/)/|- }
    }

Refine the replacement as desired.



Messages sorted by: Reverse Date, Date, Thread, Author