feat: Adds logs subcommand to shorten-url. For viewing or removing logs.

This commit is contained in:
2025-11-19 09:48:48 -05:00
parent 3446460827
commit eece231724
3 changed files with 112 additions and 4 deletions

View File

@@ -15,10 +15,25 @@ LOG_FILE=${LOG_FILE:-"$LOG_LABEL.log"} && export LOG_FILE
declare -a args
no_spin_flag="0"
create_flag="0"
logs_flag="0"
usage() {
cat <<EOF
FIX ME!!!
Shorten url utility script.
USAGE:
$THIS <flags> <command>
FLAGS:
--no-spin: Disable spinners for commands.
-h | --help: Show this help page.
COMMANDS:
create: Create a new shortened url.
logs: View or remove the logs.
Run '$THIS <command> --help' for more information on a command.
EOF
}
@@ -41,6 +56,12 @@ create() {
fi
}
logs() {
script="$SCRIPTS/utils/shorten-url/logs"
export THIS="$THIS logs"
source "$script" "${args[*]}"
}
################################################################################
# MAIN
################################################################################
@@ -54,6 +75,8 @@ while [[ $# -gt 0 ]]; do
no_spin_flag="1"
elif [[ $1 == "create" ]]; then
create_flag="1"
elif [[ $1 == "logs" ]]; then
logs_flag="1"
elif [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
no_spin_flag="1"
args+=("$1")
@@ -65,6 +88,8 @@ done
if [[ $create_flag == "1" ]]; then
create
elif [[ $logs_flag == "1" ]]; then
logs
else
# If we made it here, no subcommands were executed.
usage