Closed budRich closed 1 year ago
Thanks!
What about use case like this:
walk | cat
Or other tools what may like to take input from walk.
Maybe we should find a better alias? Like ww
. (w
is already in use).
Or even lk
. 2 letter together. Hmmm.
What about use case like this:
for those cases one could use command walk | cat
. But i see what you mean, maybe the best is to let users decide, and clarify how it works more detailed in the readme, like:
By default when
walk
is terminated normally (by pressing escape), the full path of the last active directory in walk will get printed to stdout. To have walk actually change directory in an interactive shell, you can pass its output as an argument tocd
. Example:cd "$(walk "$@")"
. If you only intend to usewalk
like this (changing directory interactively), it can make sense to create a shell function in.bashrc
or equivalent:
command -v walk >/dev/null \
&& cdwalk() { command cd "$(command walk "$@")" || return ;}
in the example, the function is named
cdwalk
, but you can name it anything that makes sense fi.cdw
,ww
or simplywalk
I just now saw that this project used to be called llama, and the
function ll ...
stuff in the readme makes slightly more sense now. But it might be a good idea to change it. For some reason it is extremely common to have an alias in bashrc something like this:alias ll='ls -l'
, i think it originates from debians default bashrc . And it is not 100% clear that you are supposed to startwalk
by typingll
after it has been set up.Why not name the function
walk
? In bash functions have priority over commands (and i think aliases have priority over functions) if they have the same name. And it is possible to override this by using thecommand
command. So this works as expected:but it will throw a warning when linting with shellcheck ( ^-- SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails.)
so even better would be:
In my own bashrc i ended up with this:
command -v walk
will print the path to the command (or name if it is a function) or silently fail if it isn't available. This is good because if i have this bashrc on a system that doesn't have thewalk
command, or if i uninstall walk, the functionwalk()
will not be defined either. I also ended up usingcommand cd
because i actually have a function called cd that also doesls && pwd
and it was annoying to have ls output after selecting a directory with walk.I never liked terminal filemanagers before, but this walk thing is really neat and integrates a lot more fluently into regular interactive shell usage, keep up the good work!