-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathgenerate_specs.sh
More file actions
executable file
·33 lines (24 loc) · 946 Bytes
/
generate_specs.sh
File metadata and controls
executable file
·33 lines (24 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Check if the correct number of arguments is provided
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <source_directory> <specs_directory>"
exit 1
fi
# Assign arguments to variables
source_dir="$1"
specs_dir="$2"
# Ensure source_dir doesn't end with a slash
source_dir="${source_dir%/}"
# Find all .gv.txt files in the source directory and its subdirectories
find "$source_dir" -type f -name "*.gv.txt" | while read -r file; do
# Get the relative path of the file from the source directory
rel_path="${file#$source_dir/}"
# Create the output filename, preserving the directory structure
output_file="$specs_dir/${rel_path%.gv.txt}.xml"
# Create the directory structure if it doesn't exist
mkdir -p "$(dirname "$output_file")"
# Run the command
python3 -m graphviz2drawio "$file" -o "$output_file"
echo "Processed: $file -> $output_file"
done
echo "All .gv.txt files have been processed."