This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_yamlfmt_config() { | |
# $1 == file | |
cat <<EOF | |
formatter: | |
indentless_arrays: $( | |
first_list=$(grep -m 1 -B 1 '^ .* -' $1) | |
# If the first entry whitespace is not in (or is larger than) the list name whitespace - it's indented. | |
if ! grep -q "$(tail -n 1 <<<"$first_list" | cut -d'-' -f 1)" <<<"$(head -n 1 <<<"$first_list")"; then | |
echo "false" | |
else |