MCP HubMCP Hub
スキル一覧に戻る

json-config-loader-4-multi-section-ini-parsing

vamseeachanta
更新日 Today
10 閲覧
3
2
3
GitHubで表示
その他general

について

このスキルは、セクションヘッダーを含むINI形式の設定ファイルを構造化データとして解析します。[section]ヘッダーやsection.key形式でのアクセスパターンをサポートし、ファイルが見つからない場合のエラー処理も備えています。bashスクリプトで複数セクションの設定ファイルを処理する必要がある場合にご利用ください。

クイックインストール

Claude Code

推奨
メイン
npx skills add vamseeachanta/workspace-hub
プラグインコマンド代替
/plugin add https://github.com/vamseeachanta/workspace-hub
Git クローン代替
git clone https://github.com/vamseeachanta/workspace-hub.git ~/.claude/skills/json-config-loader-4-multi-section-ini-parsing

このコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします

ドキュメント

4. Multi-Section INI Parsing

4. Multi-Section INI Parsing

Parse INI-style files with sections:

#!/bin/bash
# ABOUTME: Parse INI-style configuration with sections
# ABOUTME: Supports [section] headers and section.key access

declare -A INI_CONFIG
declare -a INI_SECTIONS=()

parse_ini() {
    local file="$1"
    local current_section="default"

    if [[ ! -f "$file" ]]; then
        echo "Error: INI file not found: $file" >&2
        return 1
    fi

    INI_SECTIONS=("default")

    while IFS= read -r line || [[ -n "$line" ]]; do
        # Skip comments and empty lines
        [[ "$line" =~ ^[[:space:]]*[#\;] ]] && continue
        [[ -z "${line// /}" ]] && continue

        # Section header
        if [[ "$line" =~ ^\[([^\]]+)\] ]]; then
            current_section="${BASH_REMATCH[1]}"
            INI_SECTIONS+=("$current_section")
            continue
        fi

        # Key=value within section
        if [[ "$line" =~ ^([^=]+)=(.*)$ ]]; then
            local key="${BASH_REMATCH[1]}"
            local value="${BASH_REMATCH[2]}"

            # Trim whitespace
            key="${key#"${key%%[![:space:]]*}"}"
            key="${key%"${key##*[![:space:]]}"}"
            value="${value#"${value%%[![:space:]]*}"}"
            value="${value%"${value##*[![:space:]]}"}"

            # Store as section.key
            INI_CONFIG["${current_section}.${key}"]="$value"
        fi
    done < "$file"
}

# Get INI value
ini_get() {
    local section="$1"
    local key="$2"
    local default="${3:-}"

    echo "${INI_CONFIG["${section}.${key}"]:-$default}"
}

# Get all keys in a section
ini_section_keys() {
    local section="$1"
    local prefix="${section}."

    for key in "${!INI_CONFIG[@]}"; do
        if [[ "$key" == "${prefix}"* ]]; then
            echo "${key#$prefix}"
        fi
    done
}

# List all sections
ini_sections() {
    printf '%s\n' "${INI_SECTIONS[@]}" | sort -u
}

# Usage
parse_ini "settings.ini"

# Access values
DB_HOST=$(ini_get "database" "host" "localhost")
DB_PORT=$(ini_get "database" "port" "5432")
LOG_LEVEL=$(ini_get "logging" "level" "INFO")

echo "Database: $DB_HOST:$DB_PORT"
echo "Log Level: $LOG_LEVEL"

# Iterate section keys
echo "Database settings:"
for key in $(ini_section_keys "database"); do
    echo "  $key = $(ini_get "database" "$key")"
done

GitHub リポジトリ

vamseeachanta/workspace-hub
パス: .claude/skills/_core/bash/json-config-loader/4-multi-section-ini-parsing

関連スキル

algorithmic-art

メタ

This Claude Skill creates original algorithmic art using p5.js with seeded randomness and interactive parameters. It generates .md files for algorithmic philosophies, plus .html and .js files for interactive generative art implementations. Use it when developers need to create flow fields, particle systems, or other computational art while avoiding copyright issues.

スキルを見る

subagent-driven-development

開発

This skill executes implementation plans by dispatching a fresh subagent for each independent task, with code review between tasks. It enables fast iteration while maintaining quality gates through this review process. Use it when working on mostly independent tasks within the same session to ensure continuous progress with built-in quality checks.

スキルを見る

executing-plans

デザイン

Use the executing-plans skill when you have a complete implementation plan to execute in controlled batches with review checkpoints. It loads and critically reviews the plan, then executes tasks in small batches (default 3 tasks) while reporting progress between each batch for architect review. This ensures systematic implementation with built-in quality control checkpoints.

スキルを見る

cost-optimization

その他

This Claude Skill helps developers optimize cloud costs through resource rightsizing, tagging strategies, and spending analysis. It provides a framework for reducing cloud expenses and implementing cost governance across AWS, Azure, and GCP. Use it when you need to analyze infrastructure costs, right-size resources, or meet budget constraints.

スキルを見る