Created
August 31, 2025 09:14
-
-
Save dhamidi/e003189aee25450f0a16ad51da98bf9e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| describe() { | |
| printf "name: dev-server\n" | |
| printf "description: %s\n" \ | |
| "Use this tool to run the development server." \ | |
| "The development server is a persistent process and automatically reloads when code changes are made." \ | |
| "Use the tail action to retrieve recent log lines." | |
| printf "action: string the action to take, one of start, stop or tail." | |
| } | |
| execute() { | |
| local arg value | |
| local -A args=() | |
| mapfile LINES | |
| for line in "${LINES[@]}"; do | |
| IFS=": " read arg value <<<"$line" | |
| args["$arg"]="$value" | |
| done | |
| case "${args['action']}" in | |
| start) printf "starting the development server..." ;; | |
| stop) printf "stopping the development server..." ;; | |
| tail) printf "Logs: ..." ;; | |
| *) | |
| printf "Unknown action: ${args['action']}. Valid actions are: start, stop, and tail." >&2 | |
| exit 1 | |
| ;; | |
| esac | |
| } | |
| main() { | |
| case "$1" in | |
| describe | --help) describe ;; | |
| execute) execute ;; | |
| *) | |
| printf "Unknown action: $1" >&2 | |
| exit 1 | |
| ;; | |
| esac | |
| } | |
| main "${TOOLBOX_ACTION:-$1}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment