Skip to content

Commit c6f841c

Browse files
improving --help output
1 parent c21ee11 commit c6f841c

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/grbcxx.in

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,17 @@ function print_help {
4343
# LPF's lpfcxx doesn't recognize "--help", just "-help"
4444
help_arg="-help"
4545
fi
46+
local ALL_BACKENDS="${BACKENDS[@]}"
4647

4748
echo "* Compiles an ALP/GraphBLAS application by calling an underlying compiler and by passing needed flags."
4849
echo
49-
echo "USAGE: ${this_bin} [ALP-specific options...] [--] <compiler arguments...>"
50+
echo "Usage: ${this_bin} [ALP-specific options...] [--] <compiler arguments...>"
5051
echo
5152
echo "ALP-specific options:"
52-
echo " -b,--backend <backend> compile against the ALP/GraphBLAS backend <backend>; possible values: ${BACKENDS[@]}; default: reference"
53-
echo " --link-alp-static link the specified ALP/GraphBLAS backend statically (default linking is dynamic)"
53+
echo " -b,--backend <backend> compile against the ALP/GraphBLAS backend <backend>;"
54+
echo " possible values: ${ALL_BACKENDS// /, };"
55+
echo " default: ${BACKENDS[0]}"
56+
echo " --link-alp-static link the specified ALP/GraphBLAS backend and the utility library statically (default linking is dynamic)"
5457
echo " --show show the full compilation command WITHOUT executing it"
5558
echo " --version display the current ALP/GraphBLAS version"
5659
echo " --help display this help"
@@ -117,7 +120,13 @@ then
117120
fi
118121

119122
if [[ "${help}" == "yes" ]]; then
120-
print_help "$(realpath $0)" ${BACKEND} ${COMPILER}
123+
full_path="$0"
124+
# try calling realpath (if it exists) to get the full path
125+
real_path="$(realpath $0 2>&1)"
126+
if [[ "$?" == "0" ]]; then
127+
full_path=${real_path}
128+
fi
129+
print_help "${full_path}" "${BACKEND}" "${COMPILER}"
121130
exit 0
122131
fi
123132

src/grbrun.in

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function print_help {
3232

3333
echo "* Runs an ALP/GraphBLAS binary by calling an underlying runner and by passing needed flags."
3434
echo
35-
echo "USAGE: ${this_bin} [ALP-specific options...] [--] [runner arguments...] <ALP/GraphBLAS binary> [binary arguments...]"
35+
echo "Usage: ${this_bin} [ALP-specific options...] [--] [runner arguments...] <ALP/GraphBLAS binary> [binary arguments...]"
3636
echo
3737
echo "ALP-specific options:"
3838
echo " -b,--backend <backend> run against the ALP/GraphBLAS backend <backend>; possible values: ${BACKENDS[@]}; default: reference"
@@ -94,7 +94,13 @@ RUNNER=${BACKENDRUNNER[${BACKENDID}]}
9494
LD_PATH="@ALP_UTILS_INSTALL_DIR@:${BACKENDRUNENV[${BACKENDID}]}"
9595

9696
if [[ "${help}" == "yes" ]]; then
97-
print_help "$(realpath $0)" ${BACKEND} ${RUNNER}
97+
full_path="$0"
98+
# try calling realpath (if it exists) to get the full path
99+
real_path="$(realpath $0 2>&1)"
100+
if [[ "$?" == "0" ]]; then
101+
full_path=${real_path}
102+
fi
103+
print_help "${full_path}" "${BACKEND}" "${RUNNER}"
98104
exit 0
99105
fi
100106

0 commit comments

Comments
 (0)