Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

groupUsingNamespace parameter doesn't work for icons #212

Open
dankinsoid opened this issue Jul 5, 2023 · 2 comments
Open

groupUsingNamespace parameter doesn't work for icons #212

dankinsoid opened this issue Jul 5, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@dankinsoid
Copy link

No description provided.

@subdan subdan added the enhancement New feature or request label Jul 26, 2023
@dioKaratzas
Copy link

@subdan any progress on that?

@AllDmeat
Copy link
Contributor

Using this script as a workaround:

#!/bin/bash

# Check if a directory path is provided
if [ "$#" -ne 1 ]; then
    echo "Usage: $0 <path-to-directory>"
    exit 1
fi

# Function to add properties to Contents.json using jq
add_properties() {
    local json_file=$1
    jq --argjson info '{"author": "xcode", "version": 1}' \
       --argjson properties '{"provides-namespace": true}' \
       '.info = $info | .properties = $properties' \
       "$json_file" > "$json_file.tmp" && mv "$json_file.tmp" "$json_file"
}

# Iterate over the directories recursively
find "$1" -type d | while read -r dir; do
    # Check if directory name does not end with .imageset
    if [[ "$dir" =~ \.imageset$ ]] || [[ "$dir" == "$1" ]]; then
        echo "Skipping $dir"
    else
        echo "Processing $dir"
        
        # Check if Contents.json does not exist in the directory
        if [ ! -f "$dir/Contents.json" ]; then
            # Create Contents.json with empty object {}
            echo '{}' > "$dir/Contents.json"
        fi
        # Add properties to Contents.json
        add_properties "$dir/Contents.json"
    fi
done

Usage:

sh metadata-update.sh My/Path/To/Assets.xcassets

Note: jq is required, can be installed using brew: brew install jq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants