From 4b5791daa06e192f7aa47fa4280068bba767cfba Mon Sep 17 00:00:00 2001 From: theanonymousexyz Date: Sat, 9 Apr 2022 19:02:01 +0200 Subject: [PATCH] Zsh: Add http() function --- zsh/.config/zsh/functions.zsh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zsh/.config/zsh/functions.zsh b/zsh/.config/zsh/functions.zsh index 55e64e2..4d858db 100644 --- a/zsh/.config/zsh/functions.zsh +++ b/zsh/.config/zsh/functions.zsh @@ -19,3 +19,10 @@ get_ip() { eval "curl $ARGS -fsSL 'https://ifconfig.co/json$IP' $JQ" } + +http() { + (( ${+commands[python]} )) || return 1 + + [[ $# -gt 0 ]] && local DIR="--directory $1" + eval "python -m http.server 8080 --bind 127.0.0.1 $DIR" +}