Hello,
I'm looking to do something like which foo | bat --paths-from-stdin, which would print the contents of the file foo in my $PATH. Is that currently possible with bat? If not, would it be possible to implement something like that?
More generically, it would be nice to be able to do something like
bat file_of_paths | bat --paths-from-stdin
and have the content of each file in file_of_paths printed.
I believe the xargs command might be able to help with that!
xargs bat < file_of_paths
Example:
~/ which bat | xargs bat
โโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ File: /Users/eth-p/.local/bin/bat
โโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1 โ #!/usr/bin/env bash
2 โ ARGS=()
3 โ case "$(defaults read -globalDomain AppleInterfaceStyle 2>/dev/null ||
โ echo "Light")" in
4 โ Light) ARGS+=(--theme OneHalfLight) ;;
5 โ Dark|*) : ;;
6 โ esac
7 โ ARGS+=("$@")
8 โ
9 โ exec /usr/local/bin/bat "${ARGS[@]}"
10 โ
โโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
@eth-p ah thank you! I need a solution for Windows as well (where foo | bat), but I think I can just use the batch script here https://superuser.com/questions/652492/windows-equivalent-to-xargs.
Most helpful comment
I believe the xargs command might be able to help with that!
Example: