Add help and list executables options for bin/run script

bin/run script is described as:

"simple wrapper script to run non-installed executables from workdir".

When the bin/run script was used without parameters, it was generating
error as it could not run the folder workdir/LinkTarget/Executable.
Now, we print usage instructions in this case, or when help is
requested with -h, -help or --help.

Also, now user can get the list of executables with -l, -list or --list.

In normal execution, the script's name is also printed. For example:

$ ./bin/run minvcl
Setting env variables and running workdir/LinkTarget/Executable/minvcl
...

Change-Id: I5c62c300d5247f55d1d1cfd095cecffc979d494b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137626
Tested-by: Hossein <hossein@libreoffice.org>
Reviewed-by: Hossein <hossein@libreoffice.org>
This commit is contained in:
Hossein 2022-07-29 23:59:20 +02:00
parent 07250a8327
commit c2746a6656

33
bin/run
View file

@ -9,6 +9,31 @@
# simple wrapper script to run non-installed executables from workdir
print_usage()
{
echo "This utility can be used to run the executables in this folder:"
echo
echo " workdir/LinkTarget/Executable"
echo
echo "Usage:"
echo
echo " ./bin/run application [parameters]|--list|--help"
echo
echo "Use --list (same as -list or -l) to get the list of executables"
echo "Use --help (same as -help or -h) to get this help"
}
list_executables()
{
echo "Listing executables inside workdir/LinkTarget/Executable folder:"
find workdir/LinkTarget/Executable -executable -printf "%P\n"
}
print_executable_name()
{
echo "Setting env variables and running workdir/LinkTarget/Executable/$1"
}
setdefaults()
{
dir=$(realpath "$(pwd)")
@ -25,6 +50,14 @@ setdefaults()
export URE_BOOTSTRAP=file://"${dir}"/instdir/program/fundamentalrc
}
case "$1" in
""|"-h"|"-help"|"--help")
print_usage; return 1;;
"-l"|"-list"|"--list")
list_executables; return 0;;
*) print_executable_name $1;;
esac
if uname | grep -i CYGWIN >/dev/null; then
setdefaults