From 829b6a2310485095aa539e74d9a120b29d87eba0 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Sun, 11 Sep 2022 19:41:19 +0200 Subject: [PATCH] Fix http() and get_ip() --- zsh/.config/zsh/functions.zsh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/zsh/.config/zsh/functions.zsh b/zsh/.config/zsh/functions.zsh index cb0bd64..6896063 100644 --- a/zsh/.config/zsh/functions.zsh +++ b/zsh/.config/zsh/functions.zsh @@ -42,14 +42,15 @@ get_ip() { shift done - eval "curl ${ARGS[@]} -fsSL 'https://ifconfig.co/json$IP' \ - $( (( ${+commands[jq]} )) && echo "| jq" )" + (( ${+commands[jq]} )) && local JQ="| jq" + eval "curl ${ARGS[@]} -fsSL 'https://ifconfig.co/json$IP' $JQ" } http() { (( ${+commands[python]} )) || return 2 - eval "python -m http.server 8080 --bind 127.0.0.1 \ - $( [[ $# -gt 0 ]] && echo "--directory $1" ) $@" + + [[ $# -gt 0 ]] && local DIR="--directory=$1" && shift + eval "python -m http.server 8080 --bind 127.0.0.1 $DIR $@" } open() {