53 lines
847 B
Bash
Executable file
53 lines
847 B
Bash
Executable file
#!/bin/sh
|
|
|
|
upgrade_imports() {
|
|
for i in $(seq 1 16); do
|
|
IFS='' read -r line || break
|
|
printf '%s\n' "$line"
|
|
done | sed 's/javax/jakarta/'
|
|
cat
|
|
}
|
|
|
|
fix_inline() {
|
|
while IFS='' read -r line; do
|
|
if test -z "$line" || test "$line" = "package net.kimapr.JiraSnake"; then
|
|
continue;
|
|
fi
|
|
printf '%s\n' "$line";
|
|
break;
|
|
done
|
|
cat
|
|
}
|
|
|
|
cmd='cat snake.groovy'
|
|
|
|
for arg; do
|
|
case "$arg" in
|
|
--help)
|
|
cat <<EOF
|
|
Usage: fixup OPTIONS...
|
|
|
|
Transform the snake.groovy script to adapt to different conditions
|
|
|
|
--new-jira change "javax" imports to "jakarta"
|
|
--inline remove the package declaration
|
|
--help display this help and exit
|
|
|
|
EOF
|
|
exit
|
|
;;
|
|
--new-jira)
|
|
cmd="$cmd | upgrade_imports"
|
|
;;
|
|
--inline)
|
|
cmd="$cmd | fix_inline"
|
|
;;
|
|
*)
|
|
printf 'unrecognized option: %s\n' "$arg" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
eval "$cmd"
|