You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/bin/bash# Check if a directory path is providedif [ "$#"-ne 1 ];thenecho"Usage: $0 <path-to-directory>"exit 1
fi# Function to add properties to Contents.json using jqadd_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 |whileread -r dir;do# Check if directory name does not end with .imagesetif [[ "$dir"=~\.imageset$ ]] || [[ "$dir"=="$1" ]];thenecho"Skipping $dir"elseecho"Processing $dir"# Check if Contents.json does not exist in the directoryif [ !-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"fidone
Usage:
sh metadata-update.sh My/Path/To/Assets.xcassets
Note: jq is required, can be installed using brew: brew install jq
No description provided.
The text was updated successfully, but these errors were encountered: