From 22039b2f73ed898f7bf1a11f429dcd1ebbe97d4d Mon Sep 17 00:00:00 2001 From: Luca Di Maio Date: Tue, 20 Feb 2024 18:58:20 +0100 Subject: [PATCH] fix linting Signed-off-by: Luca Di Maio --- docs/posts/integrate_vscode_distrobox.md | 1 - extras/podman-host | 25 ++++++++++++------------ extras/vscode-distrobox | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/posts/integrate_vscode_distrobox.md b/docs/posts/integrate_vscode_distrobox.md index c8781ef6b8..0ac2ee143a 100644 --- a/docs/posts/integrate_vscode_distrobox.md +++ b/docs/posts/integrate_vscode_distrobox.md @@ -121,4 +121,3 @@ chmod +x ~/.local/bin/vscode-distrobox This will make it easy to launch VSCode attached to target distrobox, on a target path: `vscode-distrobox my-distrobox /path/to/project` - diff --git a/extras/podman-host b/extras/podman-host index 8b0fb7d7c6..e3c7367088 100755 --- a/extras/podman-host +++ b/extras/podman-host @@ -6,7 +6,7 @@ DISTROBOX_COMMAND="$(command -v distrobox 2> /dev/null)" # if we're in a flatpak, use podman-remote # else we fallback to host-spawn -if [ -n "$FLATPAK_ID" ]; then +if [ -n "${FLATPAK_ID}" ]; then if command -v podman-remote > /dev/null 2>&1; then PODMAN_COMMAND="podman-remote" else @@ -19,11 +19,12 @@ fi # we use our distrobox to properly enter the container if echo "$@" | grep -q 'exec'; then # if exec && distrobox -> use distrobox-enter -- - if [ "$($PODMAN_COMMAND inspect --type container --format '{{ index .Config.Labels "manager" }}' "${id}")" = "distrobox" ]; then + if [ "$(${PODMAN_COMMAND} inspect --type container --format '{{ index .Config.Labels "manager" }}' "${id}")" = "distrobox" ]; then # Ensure that our distrobox containers will use different vscode-servers by symlinking to different paths if [ -n "${id}" ]; then - $PODMAN_COMMAND exec -u "$USER" "${id}" /bin/sh -c ' + # shellcheck disable=SC2016 + ${PODMAN_COMMAND} exec -u "${USER}" "${id}" /bin/sh -c ' if [ ! -L "${HOME}/.vscode-server" ]; then [ -e "${HOME}/.vscode-server" ] && mv "${HOME}/.vscode-server" /var/tmp [ -d /var/tmp/.vscode-server ] && mkdir /var/tmp/.vscode-server @@ -39,22 +40,22 @@ if echo "$@" | grep -q 'exec'; then dbox_args="-e A=B" capture="false" for i; do - if [ $capture = "true" ]; then - set -- "$@" "$i" - elif echo "$i" | grep -q "VSCODE"; then - dbox_args="$dbox_args -e $i" - elif echo "$i" | grep -q "\-w"; then - dbox_args="$dbox_args -w $2" + if [ "${capture}" = "true" ]; then + set -- "$@" "${i}" + elif echo "${i}" | grep -q "VSCODE"; then + dbox_args="${dbox_args} -e ${i}" + elif echo "${i}" | grep -q "\-w"; then + dbox_args="${dbox_args} -w ${2}" fi - if [ "$i" = "${id}" ]; then + if [ "${i}" = "${id}" ]; then capture="true" fi shift done - $DISTROBOX_COMMAND enter --additional-flags "${dbox_args}" "${id}" -- "$@" + ${DISTROBOX_COMMAND} enter --additional-flags "${dbox_args}" "${id}" -- "$@" exit $? fi fi -$PODMAN_COMMAND "$@" +${PODMAN_COMMAND} "$@" diff --git a/extras/vscode-distrobox b/extras/vscode-distrobox index f5e06ec163..b35448365f 100755 --- a/extras/vscode-distrobox +++ b/extras/vscode-distrobox @@ -11,4 +11,4 @@ else exit 127 fi -${code_command} --folder-uri="vscode-remote://attached-container+${container_name}/$(realpath ${2})" +${code_command} --folder-uri="vscode-remote://attached-container+${container_name}/$(realpath "${2}")"