nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 51 lines 1.1 kB view raw
1#!@runtimeShell@ 2 3set -euo pipefail 4 5usage() { 6 cat "@out@/share/doc/sbetool.txt" >&2 7} 8 9if [[ $# -lt 1 ]]; then 10 usage 11 exit 1 12fi 13 14files=() 15opts=() 16opt_regex='^-.+$' 17only_files= 18 19for arg in "$@"; do 20 if [[ -n $only_files ]] || ! [[ "$arg" =~ $opt_regex ]]; then 21 files+=("$arg") 22 continue 23 fi 24 if [[ "$arg" == "-h" ]] || [[ "$arg" == "--help" ]]; then 25 usage 26 exit 0 27 fi 28 if [[ "$arg" == "--" ]]; then 29 only_files=true 30 continue 31 fi 32 opts+=("$arg") 33done 34 35if [[ -z "${files[*]}" ]]; then 36 echo "Error: no files provided. If your file starts with -, pass it after -- like this:" >&2 37 echo " sbetool -- -my-file.xml" >&2 38 echo >&2 39 usage 2>&1 | tail +2 1>&2 40 exit 1 41fi 42 43# NB: `--add-opens` flag is added because newer version of `agrona` (a utility 44# lib used in `sbetool`) depends on jdk.internal.misc.Unsafe 45# 46# The Unsafe API is deprecated and requires special opt-in to use. 47@java@ \ 48 --add-opens java.base/jdk.internal.misc=ALL-UNNAMED \ 49 "${opts[@]}" \ 50 -jar "@tool@/share/sbe/sbe-all-@version@.jar" \ 51 "${files[@]}"