mirror of
https://github.com/fsquillace/junest.git
synced 2026-01-23 02:34:30 +00:00
#318: Use multi-call wrapper
This commit is contained in:
parent
369cda8dc6
commit
4db85bcf1f
2 changed files with 14 additions and 12 deletions
|
|
@ -21,6 +21,17 @@
|
|||
function create_wrappers() {
|
||||
local force=${1:-false}
|
||||
mkdir -p "${JUNEST_HOME}/usr/bin_wrappers"
|
||||
# Arguments inside a variable (i.e. `JUNEST_ARGS`) separated by quotes
|
||||
# are not recognized normally unless using `eval`. More info here:
|
||||
# https://github.com/fsquillace/junest/issues/262
|
||||
# https://github.com/fsquillace/junest/pull/287
|
||||
cat <<EOF > "${JUNEST_HOME}/usr/bin/junest_wrapper"
|
||||
#!/usr/bin/env bash
|
||||
|
||||
eval "junest_args_array=(\${JUNEST_ARGS:-ns})"
|
||||
junest "\${junest_args_array[@]}" -- \$(basename \${0}) "\$@"
|
||||
EOF
|
||||
chmod +x "${JUNEST_HOME}/usr/bin/junest_wrapper"
|
||||
|
||||
cd "${JUNEST_HOME}/usr/bin" || return 1
|
||||
for file in *
|
||||
|
|
@ -33,17 +44,8 @@ function create_wrappers() {
|
|||
then
|
||||
continue
|
||||
fi
|
||||
# Arguments inside a variable (i.e. `JUNEST_ARGS`) separated by quotes
|
||||
# are not recognized normally unless using `eval`. More info here:
|
||||
# https://github.com/fsquillace/junest/issues/262
|
||||
# https://github.com/fsquillace/junest/pull/287
|
||||
cat <<EOF > "${JUNEST_HOME}/usr/bin_wrappers/${file}"
|
||||
#!/usr/bin/env bash
|
||||
|
||||
eval "junest_args_array=(\${JUNEST_ARGS:-ns})"
|
||||
junest "\${junest_args_array[@]}" -- ${file} "\$@"
|
||||
EOF
|
||||
chmod +x "${JUNEST_HOME}/usr/bin_wrappers/${file}"
|
||||
rm -f "${JUNEST_HOME}/usr/bin_wrappers/$file"
|
||||
ln -s "../bin/junest_wrapper" "${JUNEST_HOME}/usr/bin_wrappers/$file"
|
||||
done
|
||||
|
||||
# Remove wrappers no longer needed
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ function test_create_wrappers_verify_content(){
|
|||
-b
|
||||
--bind /run /run2
|
||||
--
|
||||
myfile
|
||||
test-wrappers.sh
|
||||
pacman
|
||||
-Rsn
|
||||
neovim
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue