-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide useful output when bat
is given a directory instead of a file
#1940
Comments
Personally I would consider this to be out-of-scope for It would be easy to write a wrapper script that invokes |
This has been requested before and I previously had a similar reply like @Enselic. On the other hand, I do have to admit that it also happens to me from time to time 😄. Maybe we could indeed print a simple directory listing. Similar to what But I'm also okay with closing this as "won't do". It's not really in the scope of |
The tool mentioned at #800 (comment) also can provide this functionality. |
Potential solution: #2203 |
I was having this exact issue and thanks to @keith-hall for linking to the awesome program rsop created by @desbma. Thank you to you two awesome people! Here's my little guide for using In the
curl -o ~/.config/rsop/config.toml https://raw.githubusercontent.com/desbma/rsop/master/config/config.toml.advanced
|
It's pretty common (for me) to run
bat thing
whenthing
is a directory. It's usually because I want to see what's inthing
but (initially) I may not know it's a directory.Since bat's purpose (in my words) is to be a more useful
cat
, I think it would be helpful to print more useful output when given –accidentally or otherwise– a directory. My initial suggestion would be to print the directory's contents as if vials
.Granted, it still should be considered an error to invoke either
cat
and therefore alsobat
with a directory. So I would still consider the exit code to be1
; and it should continue to print[bat error]: 'thing' is a directory.
But bat could emit a file listing to STDOUT (or STDERR) along with the existing error message.
Thoughts?
The text was updated successfully, but these errors were encountered: