Add editorconfig, format script, and format all files consistently
This commit is contained in:
parent
f5920f79a5
commit
944af73907
45 changed files with 552 additions and 517 deletions
5
.editorconfig
Normal file
5
.editorconfig
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
[*]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = false
|
||||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
error.log
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
{
|
||||||
"104": {
|
"104": {
|
||||||
"0440": {
|
"0440": {
|
||||||
"name": "Unknown",
|
"name": "Unknown",
|
||||||
"message": "An error has occurred./n/nPlease try again later./n/nIf the problem persists, please\nmake a note of the error code and\nvisit support.nintendo.com.",
|
"message": "An error has occurred./n/nPlease try again later./n/nIf the problem persists, please\nmake a note of the error code and\nvisit support.nintendo.com.",
|
||||||
|
|
@ -9,5 +9,5 @@
|
||||||
"long_solution": "Unknown solution.",
|
"long_solution": "Unknown solution.",
|
||||||
"support_link": "https://preten.do/104-0440"
|
"support_link": "https://preten.do/104-0440"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
29
format.sh
Normal file
29
format.sh
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Remove any existing error log
|
||||||
|
rm -f error.log
|
||||||
|
|
||||||
|
# Enable recursive globbing
|
||||||
|
shopt -s globstar
|
||||||
|
|
||||||
|
# Process files in parallel using xargs
|
||||||
|
find data -type f -name "*.json" | xargs -n 1 -P "$(nproc)" -I {} bash -c '
|
||||||
|
file="{}"
|
||||||
|
echo "Processing file: $file"
|
||||||
|
jq --tab -j . <"$file" >"$file.out" 2>"$file.err"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
mv "$file.out" "$file"
|
||||||
|
rm "$file.err"
|
||||||
|
else
|
||||||
|
echo "$file.err" >> error.log
|
||||||
|
rm "$file.out"
|
||||||
|
fi
|
||||||
|
'
|
||||||
|
|
||||||
|
# Print any files that failed to process
|
||||||
|
if [ -f error.log ] && [ "$(cat error.log | wc -l)" -gt 0 ]; then
|
||||||
|
echo "The following files failed to process:"
|
||||||
|
cat error.log | sed 's/^/ - /'
|
||||||
|
else
|
||||||
|
echo "All files processed successfully."
|
||||||
|
fi
|
||||||
Loading…
Add table
Add a link
Reference in a new issue