Improve samples organization, add check script

This commit is contained in:
Jeremy Soller 2024-03-04 13:07:06 -07:00
parent 636e51510d
commit 39a6cbe67d
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
7 changed files with 28 additions and 0 deletions

27
samples/check.sh Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
for file in */*
do
filetype="$(xdg-mime query filetype "${file}")"
if [ -z "${filetype}" ]
then
echo "${file}: no filetype found"
exit 1
fi
if [ "${file%.*}" != "${filetype}" ]
then
echo "${file} is not named according to filetype ${filetype}"
exit 1
fi
default="$(xdg-mime query default "${filetype}")"
if [ -z "${default}" ]
then
echo "${file}: ${filetype}: no default application found"
exit 1
fi
echo "${file}: ${filetype}: ${default}"
done

1
samples/text/plain.txt Normal file
View file

@ -0,0 +1 @@
This is a plain text file.