-
-
Save wesbos/1432b08749e3cd2aea22fcea2628e2ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put this in your .zshrc or .bashrc file | |
# Install `tree` first — brew install tree | |
function t() { | |
# Defaults to 3 levels deep, do more with `t 5` or `t 1` | |
# pass additional args after | |
tree -I '.git|node_modules|bower_components|.DS_Store' --dirsfirst --filelimit 15 -L ${1:-3} -aC $2 | |
} |
Copied your gist into my zsh :
# Install `tree` first — brew install tree
function t() {
# Defaults to 3 levels deep, do more with `t 5` or `t 1`
# pass additional args after
tree -I '.git|node_modules|bower_components|.DS_Store' --dirsfirst --filelimit 15 -L ${1:-3} -aC $2
}
alias t=t
But every time i get t:3: maximum nested function level reached
message :(
@azakordonets since you have a function named t
, there really is no reason to alias it to t
. I don't see this in my zsh but I believe that's the issue, if you want to use an alias, name the function _t
for example and then alias t=_t
.
Also, it seems like --filelimit
and -a
are conflicting options, at least when I tried to original function, and it only seems to take one additional parameter after the level parameter, so with these issues in mind, I made the following change:
function _t() {
# Defaults to 3 levels deep, do more with `t 5` or `t 1`
# pass additional args after
local levels=${1:-3}; shift
tree -I '.git|node_modules|bower_components|.DS_Store' --dirsfirst -L $levels -aC $@
}
alias t=_t
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you have any customizations you like please comment below!
Docs for
tree
: