From 85146b36d9fcf0e0bad828ea12e16b1aa7a1f05a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 1 Jun 2022 17:53:21 -0300 Subject: bin/article: Normalize usage() and help() text --- bin/article | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/bin/article b/bin/article index 3c4b483..a6ce748 100755 --- a/bin/article +++ b/bin/article @@ -1,28 +1,35 @@ #!/bin/sh set -eu -# shellcheck source=/dev/null -. "$DOTFILES/sh/colors.sh" - -missing() { - red "Missing argument <${1}>.\n" >&2 +usage() { + cat <<-'EOF' + Usage: + article + article -h + EOF } -usage() { - cat <&2 -Usage: - $0 +help() { + cat <<-'EOF' - Arguments: - TYPE The type of the article: article, til, slides, podcast, screencast - FULL_TITLE Full title of the post -Examples: - $0 til 'I just learned this' - $0 article 'My example article title' -EOF + Options: + -h, --help show this message + + + Examples: + + FIXME: + + $ FIXME + $0 til 'I just learned this' + $0 article 'My example article title' + EOF } + + + TYPE="${1:-}" [ -z "$TYPE" ] && { missing 'TYPE' -- cgit v1.2.3