#!/bin/sh

#
# Copyright IBM Corporation 2021
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

python_command=python

if command -v python3 &> /dev/null
then
    python_command=python3
fi

if ! command -v $python_command &> /dev/null
then
    echo "a valid python command could not be found"
    exit
fi

# Find full path to rayvens_cli.sh file:
rayvens_cli_file=`$python_command -c "import subprocess; import platform; cmd = \"where\" if platform.system() == \"Windows\" else \"which\"; subprocess.call([cmd, \"rayvens_cli.py\"]);"`

# Invoke command line processing:
$python_command $rayvens_cli_file $@