Skip to content
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

bat the folders #427

Closed
koksnuss opened this issue Nov 23, 2018 · 4 comments
Closed

bat the folders #427

koksnuss opened this issue Nov 23, 2018 · 4 comments
Labels
question Further information is requested

Comments

@koksnuss
Copy link

koksnuss commented Nov 23, 2018

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

@ysf
Copy link

ysf commented Nov 23, 2018

Wouldn't this break cat/posix compatibility?

@keith-hall
Copy link
Collaborator

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?

@sharkdp
Copy link
Owner

sharkdp commented Nov 23, 2018

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, execute bat?

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)

@sharkdp sharkdp added the question Further information is requested label Nov 25, 2018
@sharkdp
Copy link
Owner

sharkdp commented Dec 7, 2018

Closing this, as there is no feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants