Skip to content

Commit

Permalink
get-installer: remove unnecessary regex complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Sep 13, 2024
1 parent 1fdae98 commit 4506b7f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions commands/get-installer
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,11 @@ function get_installer() (
if [[ $util == *' '* ]]; then
# --classic code --classic => code
# (^| ) matches either start of the line, or a space character
# [-][^ ]+ matches a dash followed by one or more non-space characters
# -[^ ]+ matches a dash followed by one or more non-space characters
# so this is what converts the `--classic` flag into ``
# then we trim whitespace at the start and end
setup-util-sd --quiet
util="$(sd '(^| )[-][^ ]+' '' <<<"$util" | sd '^\s+|\s+$' '')"
util="$(sd '(^| )-[^ ]+' '' <<<"$util" | sd '^\s+|\s+$' '')"
fi

# skip if empty
Expand Down

0 comments on commit 4506b7f

Please sign in to comment.