scripts/misc/xdg-info

19 lines
336 B
Plaintext
Raw Normal View History

2020-07-29 12:58:50 +00:00
#!/bin/zsh
#dep:xdg-mime
2020-07-29 12:58:50 +00:00
source ${$(realpath "$0"):h:h}/lib/common.zsh
if ! exists column; then
column() { cat }
fi
{
echo -e "file\ttype\tdefault program"
for file in "$@"; do
mimetype=$(xdg-mime query filetype $file)
prog=$(xdg-mime query default $mimetype)
echo -e "$file\t$mimetype\t$prog"
done
} | column -t -s $'\t'