CtrlK
BlogDocsLog inGet started
Tessl Logo

pantheon-ai/bash-script-toolkit

Complete bash-script toolkit with generation and validation capabilities

97

Quality

97%

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Risky

Do not use without reviewing

Overview
Quality
Evals
Security
Files

standard-template.shgenerator/assets/templates/

#!/usr/bin/env bash
#
# Script Name: SCRIPT_NAME
# Description: Brief description of what this script does
# Usage: SCRIPT_NAME [OPTIONS] ARGUMENTS
#

set -euo pipefail
IFS=$'\n\t'

readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
readonly VERSION="1.0.0"

VERBOSE=false
DRY_RUN=false
LOG_LEVEL="INFO"

usage() {
    cat << EOF
Usage: ${SCRIPT_NAME} [OPTIONS] [ARGUMENTS]

Description:
    Brief description of what the script does

Options:
    -h, --help      Show this help message and exit
    -v, --verbose   Enable verbose output
    -d, --debug     Enable debug mode
    -n, --dry-run   Perform dry run without making changes

Examples:
    ${SCRIPT_NAME} -v file.txt
    ${SCRIPT_NAME} --dry-run input.txt output.txt

EOF
}

log() {
    local level="$1"
    shift
    echo "[${level}] $(date '+%Y-%m-%d %H:%M:%S') - $*" >&2
}

log_info() { log "INFO" "$@"; }
log_warn() { log "WARN" "$@"; }
log_error() { log "ERROR" "$@"; }
log_debug() { [[ "${LOG_LEVEL}" == "DEBUG" ]] && log "DEBUG" "$@"; }

die() {
    log_error "$@"
    exit 1
}

check_command() {
    command -v "$1" &> /dev/null || die "Required command not found: $1"
}

validate_file() {
    [[ -f "$1" ]] || die "File not found: $1"
    [[ -r "$1" ]] || die "File not readable: $1"
}

cleanup() {
    local exit_code=$?
    log_debug "Cleaning up..."
    exit "${exit_code}"
}

parse_args() {
    while [[ $# -gt 0 ]]; do
        case "$1" in
            -h|--help) usage; exit 0 ;;
            -v|--verbose) VERBOSE=true; shift ;;
            -d|--debug) LOG_LEVEL="DEBUG"; VERBOSE=true; shift ;;
            -n|--dry-run) DRY_RUN=true; shift ;;
            -*) die "Unknown option: $1" ;;
            *) break ;;
        esac
    done
    ARGS=("$@")
}

main() {
    parse_args "$@"

    log_info "Starting ${SCRIPT_NAME}..."

    # Main logic goes here

    log_info "Completed successfully"
}

trap cleanup EXIT ERR INT TERM

main "$@"

generator

assets

templates

standard-template.sh

log-analyzer.sh

SKILL.md

tile.json