summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2022-07-29 23:59:20 +0200
committerHossein <hossein@libreoffice.org>2022-07-30 06:35:50 +0200
commitc2746a665656b61927bbf551b4723ccfae8fa9c8 (patch)
tree7c4ed10cec90b3ff0098d97fcef5799ac9ba3841
parent07250a832787acdd432dccd458536de2987a58b2 (diff)
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>
-rwxr-xr-xbin/run33
1 files changed, 33 insertions, 0 deletions
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