From e334a3c314b8baa85018651049a3e751883f2ce9 Mon Sep 17 00:00:00 2001 From: Eric Renfro Date: Sun, 6 Jan 2019 15:49:38 -0500 Subject: [PATCH] lhpaste cleanup and better saner defaults --- .local/dotfiles/functions/lhpaste.zsh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.local/dotfiles/functions/lhpaste.zsh b/.local/dotfiles/functions/lhpaste.zsh index a42df60..f3f2efd 100644 --- a/.local/dotfiles/functions/lhpaste.zsh +++ b/.local/dotfiles/functions/lhpaste.zsh @@ -5,7 +5,7 @@ function lhpaste() { local o_expire=(--expire 60) local o_help local o_lang - local o_name=(--name Psi-Jack) + local o_name local o_private local o_reply local o_title @@ -15,8 +15,15 @@ function lhpaste() { if [[ -n "$LHPASTE_API_KEY" ]]; then o_apikey=(--apikey "$LHPASTE_API_KEY") fi + if [[ -n "$LHPASTE_NAME" ]]; then o_name=(--name "$LHPASTE_NAME") + else + o_name=(--name "$USER") + fi + + if [[ -n "$LHPASTE_SERVER_URL" ]]; then + o_url=(--url "$LHPASTE_SERVER_URL") fi zparseopts -D -K -M -- \ @@ -44,6 +51,12 @@ OPTIONS: --title TEXT, -t TEXT Set paste title text --url URL, -u URL Set paste server URL (Default: $o_url[2]) --apikey TEXT, -a TEXT Set API-KEY for Stikked Paste access + +ENVIRONMENT: + + LHPASTE_NAME Set the name to use instead of the default value of \$USER + LHPASTE_SERVER_URL Set the server base url to the stikked server + LHPASTE_API_KEY Set the apikey to use the stikked server API EOF return 0 fi