From f70e6916a1c9aca77e7bd1b976a3f6100752f0a5 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 27 Jul 2024 14:28:24 +0200 Subject: fix(lib): turn off `rematchpcre` option in `omz_urlencode` (#12388) Fixes #12388 --- lib/functions.zsh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/functions.zsh') diff --git a/lib/functions.zsh b/lib/functions.zsh index f5c671f9c..2e667332e 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -160,6 +160,8 @@ zmodload zsh/langinfo # -P causes spaces to be encoded as '%20' instead of '+' function omz_urlencode() { emulate -L zsh + setopt norematchpcre + local -a opts zparseopts -D -E -a opts r m P -- cgit v1.2.3-70-g09d2 From 9bcafe1c27f62f224c095cd2479763280336090b Mon Sep 17 00:00:00 2001 From: Erik Teichmann Date: Wed, 18 Sep 2024 11:26:38 -0700 Subject: feat(functions): add `takezip` (#12670) --- lib/functions.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/functions.zsh') diff --git a/lib/functions.zsh b/lib/functions.zsh index 2e667332e..b68c35c13 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -57,6 +57,16 @@ function takeurl() { cd "$thedir" } +function takezip() { + local data thedir + data="$(mktemp)" + curl -L "$1" > "$data" + unzip "$data" -d "./" + thedir="$(unzip -l "$data" | awk 'NR==4 {print $4}' | sed 's/\/.*//')" + rm "$data" + cd "$thedir" +} + function takegit() { git clone "$1" cd "$(basename ${1%%.git})" @@ -65,6 +75,8 @@ function takegit() { function take() { if [[ $1 =~ ^(https?|ftp).*\.(tar\.(gz|bz2|xz)|tgz)$ ]]; then takeurl "$1" + elif [[ $1 =~ ^(https?|ftp).*\.(zip)$ ]]; then + takezip "$1" elif [[ $1 =~ ^([A-Za-z0-9]\+@|https?|git|ssh|ftps?|rsync).*\.git/?$ ]]; then takegit "$1" else -- cgit v1.2.3-70-g09d2 From 788eaa5930eeafceb0cc43f338b0bacf7a2e36a8 Mon Sep 17 00:00:00 2001 From: James Langley Date: Sun, 8 Jun 2025 09:25:23 +0100 Subject: fix(functions): escape especial chars in WSL (#13158) --- lib/functions.zsh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/functions.zsh') diff --git a/lib/functions.zsh b/lib/functions.zsh index b68c35c13..330b0e3e9 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -23,6 +23,9 @@ function open_command() { linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || { open_cmd='cmd.exe /c start ""' [[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 } + [[ "$1" = (http|https)://* ]] && { + 1="$(echo "$1" | sed -E 's/([&|()<>^])/^\1/g')" || return 1 + } } ;; msys*) open_cmd='start ""' ;; *) echo "Platform $OSTYPE not supported" -- cgit v1.2.3-70-g09d2