Skip to content

Commit

Permalink
enter: fix additional flags composition, Fix #1594
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
  • Loading branch information
89luca89 committed Jan 19, 2025
1 parent 58d08f3 commit 67923ee
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions distrobox-enter
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,10 @@ while :; do
-a | --additional-flags)
if [ -n "$2" ]; then
if [ -z "${container_manager_additional_flags=}" ]; then
container_manager_additional_flags="${2}"
container_manager_additional_flags="$(echo "${2}" | sed -E "s/(--[a-zA-Z]+) ([^ ]+)/\1=\2/g" | sed 's/ --/\n--/g')"
else
container_manager_additional_flags="${container_manager_additional_flags}
${2}"
$(echo "${2}" | sed -E "s/(--[a-zA-Z]+) ([^ ]+)/\1=\2/g" | sed 's/ --/\n--/g')"
fi
shift
shift
Expand Down Expand Up @@ -523,13 +523,10 @@ generate_enter_command()
fi

# Add additional flags
IFS='
'
for flag in ${container_manager_additional_flags}; do
# ensure the flag name is separated from the value with an '=' (not a ' ')
if [ -n "${container_manager_additional_flags}" ]; then
result_command="${result_command}
$(echo "${flag}" | sed -e 's,^\( *[^= ]*\)[= ],\1=,')"
done
${container_manager_additional_flags}"
fi

# Run selected container with specified command.
result_command="${result_command}
Expand Down

1 comment on commit 67923ee

@parkerlreed
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Please sign in to comment.