bin/run | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
New commits: commit c2746a665656b61927bbf551b4723ccfae8fa9c8 Author: Hossein <hoss...@libreoffice.org> AuthorDate: Fri Jul 29 23:59:20 2022 +0200 Commit: Hossein <hoss...@libreoffice.org> CommitDate: Sat Jul 30 06:35:50 2022 +0200 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 <hoss...@libreoffice.org> Reviewed-by: Hossein <hoss...@libreoffice.org> diff --git a/bin/run b/bin/run index 523da3c0e178..5405bd34cd2a 100755 --- a/bin/run +++ b/bin/run @@ -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