I like big bat.
It is awesome.
Really great bat.
It's huge.
We gonna have some really great bat.
Let's make bat great again.
Serious content: Make bat show directory content like ls.
I know batter:
# This is bat
$ bat fancy_dir
[bat error]: 'fancy_dir' is a directory.
# This would be batter.
$ bat fancy_dir
file1 file2 file3
# This would be the batst.
$ bat fancy_dir
total 6447476
-rw-r--r-- 1 not_batman not_dc_comics 0 Nov 23 03:07 file1
-rw-r--r-- 1 not_batman not_dc_comics 0 Nov 23 03:07 file2
-rw-r--r-- 1 not_batman not_dc_comics 0 Nov 23 03:07 file3
Thank you for reading this. I like you so bat.
rckwrtz/cocanut
Wouldn't this break cat/posix compatibility?
could you perhaps have a shell alias that would check if the target is a file or folder, and if it's a directory, execute ls, if it's a file, execute bat?
Thank you for the feedback.
I don't think we should add this feature to bat. Granted, we are not following the "do one thing and do it well" philosophy very strictly with bat, but the functionality can still be summarized with "display file contents". I'm not inclined to broaden that.
could you perhaps have a shell alias that would check if the target is a file or folder, and if it's a directory, execute
ls, if it's a file, executebat?
That's exactly what I would also suggest. You can start with something simple like
function bat-ls() {
for file in "$@"; do
if [[ -d "$file" ]]; then
ls "$file"
else
bat "$file"
fi
done
}
(it will not work if you want to pass arguments to bat)
Closing this, as there is no feedback.
Most helpful comment
Wouldn't this break cat/posix compatibility?