본문으로 건너뛰기
cccskills
무료GitHub에 공개

getopts-parser-generator

Generate getopts-based argument parsing for shell scripts with short/long options and validation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md3.1 KB
  • README.md757 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Getopts Parser Generator

Generate getopts-based argument parsing for shell scripts.

Capabilities

  • Generate getopts parsing code
  • Support short and long options
  • Implement option validation
  • Create help text generation
  • Handle required arguments
  • Generate usage documentation

Usage

Invoke this skill when you need to:

  • Add argument parsing to shell scripts
  • Support short and long options
  • Validate argument values
  • Generate help text

Generated Patterns

Getopts with Long Options

#!/usr/bin/env bash

# Default values
VERBOSE=false
OUTPUT=""
FORMAT="text"
FORCE=false

# Usage function
usage() {
    cat <<EOF
Usage: $(basename "$0") [OPTIONS] <input>

Options:
    -h, --help              Show this help
    -v, --verbose           Enable verbose output
    -o, --output FILE       Output file (default: stdout)
    -f, --format FORMAT     Output format: text, json, csv (default: text)
    -F, --force             Force overwrite existing files

Arguments:
    input                   Input file to process
EOF
}

# Parse options
parse_options() {
    # Transform long options to short ones
    for arg in "$@"; do
        shift
        case "$arg" in
            '--help')    set -- "$@" '-h' ;;
            '--verbose') set -- "$@" '-v' ;;
            '--output')  set -- "$@" '-o' ;;
            '--format')  set -- "$@" '-f' ;;
            '--force')   set -- "$@" '-F' ;;
            *)           set -- "$@" "$arg" ;;
        esac
    done

    # Parse short options
    local OPTIND opt
    while getopts ":hvo:f:F" opt; do
        case "$opt" in
            h) usage; exit 0 ;;
            v) VERBOSE=true ;;
            o) OUTPUT="$OPTARG" ;;
            f)
                case "$OPTARG" in
                    text|json|csv) FORMAT="$OPTARG" ;;
                    *) die "Invalid format: $OPTARG" ;;
                esac
                ;;
            F) FORCE=true ;;
            :) die "Option -$OPTARG requires an argument" ;;
            \?) die "Unknown option: -$OPTARG" ;;
        esac
    done

    shift $((OPTIND - 1))

    # Remaining arguments
    if [[ $# -lt 1 ]]; then
        usage
        die "Missing required argument: input"
    fi

    INPUT="$1"
    shift

    # Extra arguments
    EXTRA_ARGS=("$@")
}

die() {
    echo "Error: $*" >&2
    exit 1
}

# Parse and validate
parse_options "$@"

# Validation
[[ -f "$INPUT" ]] || die "Input file not found: $INPUT"
[[ -n "$OUTPUT" && -f "$OUTPUT" && "$FORCE" != true ]] && \
    die "Output file exists: $OUTPUT (use --force to overwrite)"

Target Processes

  • shell-script-development
  • shell-completion-scripts
  • argument-parser-setup

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Provide implementations of advanced data structures

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

a5c-ai/babysitter1.9천2026년 9월 17일 업데이트

Fresh adversarial code review with binary PASS/FAIL verdicts, evidence citations, and anchoring bias prevention via fresh reviewer spawning.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

a5c-ai/babysitter1.9천2026년 9월 17일 업데이트

WASM-based instant code transforms for simple tasks, achieving 352x speedup over LLM inference with zero cost.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

a5c-ai/babysitter1.9천2026년 9월 17일 업데이트

Coordinate Crew (persistent) and Polecat (transient) agents using Gas Town's hook-based work distribution and GUPP principle.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

a5c-ai/babysitter1.9천2026년 9월 17일 업데이트

Generate visual representations of algorithm execution

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

a5c-ai/babysitter1.9천2026년 9월 17일 업데이트

Hierarchical coordination and drift detection with frequent checkpoints, shared memory coherence validation, role specialization enforcement, and short task cycles.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

a5c-ai/babysitter1.9천2026년 9월 17일 업데이트

a5c-ai의 스킬 모두 보기

이 스킬의 문제 신고