You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.7 KiB

#! /bin/sh
#
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright 2022 Yzena Tech
#
# Licensed under the Yzena User License, Version 0.1 (the "Yzena User License"
# or "YUL"). You may not use this file except in compliance with the Yzena
# User License.
#
# You may obtain a copy of the Yzena User License at
#
# https://yzena.com/yzena-user-license/
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Yzena Network License is distributed under the
# following disclaimer:
#
# As far as the law allows, this software comes as is, without any
# warranty or condition, and no contributor will be liable to anyone for
# any damages related to this software or this license, under any kind of
# legal claim.
#
# ****** END LICENSE BLOCK ******
script="$0"
scriptdir=$(dirname "$script")
script=$(basename "$script")
# Simply prints the help message and quits based on the argument.
# @param msg The help message to print.
usage() {
if [ $# -gt 0 ]; then
_usage_val=1
printf "%s\n\n" "$1"
else
_usage_val=0
fi
printf 'usage:\n'
printf ' %s -h\n' "$script"
printf ' %s [-f] [-l] [-t]\n' "$script"
printf '\n'
printf ' This script diffs all files of the chosen category or categories, in order\n'
printf ' from YOL, YCL, YCUL, YNL, YNUL, YVL, and YVUL.\n'
printf ' Diffs the license files by default.\n'
printf '\n'
printf ' -f Diff the FAQ files. Disables diffing the licenses unless -l is given.\n'
printf ' -l Diff the license files regardless of other options.\n'
printf ' -t Diff the template files. Disables diffing the licenses unless -l is\n'
printf ' given.\n'
exit "$_usage_val"
}
licenses=1
faqs=0
templates=0
force_licenses=0
while getopts "hflt" opt; do
case "$opt" in
f) faqs=1 ; licenses=0 ;;
h) usage ;;
l) force_licenses=1 ;;
t) templates=1 ; licenses=0 ;;
?) usage "Invalid option: $opt" ;;
esac
done
if [ "$templates" -ne 0 ]; then
meld YOL/YOL.md.in YCL/YCL.md.in
meld YCL/YCL.md.in YCUL/YCUL.md.in
meld YCL/YCL.md.in YNL/YNL.md.in
meld YNL/YNL.md.in YNUL/YNUL.md.in
meld YNL/YNL.md.in YVL/YVL.md.in
meld YVL/YVL.md.in YUL/YUL.md.in
meld YVL/YVL.md.in YVUL/YVUL.md.in
fi
if [ "$licenses" -ne 0 ] || [ "$force_licenses" -ne 0 ]; then
meld YOL/YOL.md YCL/YCL.md
meld YCL/YCL.md YCUL/YCUL.md
meld YCL/YCL.md YNL/YNL.md
meld YNL/YNL.md YNUL/YNUL.md
meld YNL/YNL.md YVL/YVL.md
meld YVL/YVL.md YUL/YUL.md
meld YVL/YVL.md YVUL/YVUL.md
fi
if [ "$faqs" -ne 0 ]; then
meld YOL/FAQ.md YCL/FAQ.md
meld YCL/FAQ.md YCUL/FAQ.md
meld YCL/FAQ.md YNL/FAQ.md
meld YNL/FAQ.md YNUL/FAQ.md
meld YNL/FAQ.md YVL/FAQ.md
meld YVL/FAQ.md YUL/FAQ.md
meld YVL/FAQ.md YVUL/FAQ.md
fi