aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-01-17 23:26:37 -0300
committerEuAndreh <eu@euandre.org>2021-01-17 23:27:20 -0300
commite51a01060551381bde896dd674585febdea5b264 (patch)
tree8a9516b3186078d715d6137470570466e9111a4c
parentSplit sheband line from shell options (diff)
downloaddotfiles-e51a01060551381bde896dd674585febdea5b264.tar.gz
dotfiles-e51a01060551381bde896dd674585febdea5b264.tar.xz
scripts/post.sh: STDOUT filename for use with backticks
-rwxr-xr-xscripts/post.sh12
1 files changed, 7 insertions, 5 deletions
diff --git a/scripts/post.sh b/scripts/post.sh
index a3007883..3759c216 100755
--- a/scripts/post.sh
+++ b/scripts/post.sh
@@ -5,17 +5,17 @@ set -eu
. "$DOTFILES/bash/colors.sh"
missing() {
- red "Missing argument <${1}>.\n"
+ red "Missing argument <${1}>.\n" >&2
}
usage() {
- cat <<EOF
+ cat <<EOF >&2
Usage:
$0 <TYPE> <FULL_TITLE>
Arguments:
TYPE The type of the article: article, til, slides, podcast, screencast
- FULL_TITLE Full title of the pastebin
+ FULL_TITLE Full title of the post
Examples:
$0 til 'I just learned this'
@@ -40,7 +40,7 @@ case "$TYPE" in
DIR=_slides
;;
*)
- red "Invalid type '$TYPE'\n"
+ red "Invalid type '$TYPE'\n" >&2
usage
exit 2
;;
@@ -72,7 +72,7 @@ OUT="$DIR/$PASTE_DATE-$SLUG_TITLE.md"
cd ~/dev/libre/website
[ -f "$OUT" ] && {
- red "Pastebin named $OUT already exists.\n"
+ red "Post named $OUT already exists.\n"
exit 1
}
@@ -119,3 +119,5 @@ ref: $SLUG_TITLE
---
EOF
fi
+
+echo "$OUT"