This script automates the process of ensuring that YAML files within a specified directory contain the necessary ---
header. If a YAML file does not have the ---
header, the script adds it.
Run the script with the directory containing your YAML files as an argument. The script will check each file in the directory (and its subdirectories) to see if it starts with ---
. If the header is missing, the script will add it.
./add_yaml_header <directory>
Automatically add ---
headers to YAML files in the specified directory:
./add_yaml_header /path/to/directory
fd
to find all files with the .yaml
or .yml
extension in the specified directory.---
.---
header is missing, it adds it to the top of the file using sed
.fd
is installed (brew install fd
on macOS).