mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 22:22:40 +00:00
feat: Adds logs subcommand to shorten-url. For viewing or removing logs.
This commit is contained in:
27
env/.local/scripts/shorten-url
vendored
27
env/.local/scripts/shorten-url
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user