controlapp/merge.cs.sh
2025-02-28 11:28:39 -08:00

26 lines
No EOL
708 B
Bash

#!/bin/bash
# Output file
output_file="ControlAppMonolith.cs"
# Clear the output file if it already exists
> "$output_file"
# Find all .cs files in the ./ControlApp directory
files=$(find ./ControlApp -name "*.cs")
# Extract and deduplicate using directives
using_directives=$(grep -h "^using" $files | sort | uniq)
# Write the using directives to the output file
echo "$using_directives" >> "$output_file"
echo -e "\n" >> "$output_file"
# Combine all .cs files, excluding using directives
for file in $files; do
echo "// File: $file" >> "$output_file"
grep -v "^using" "$file" >> "$output_file"
echo -e "\n" >> "$output_file"
done
echo "All .cs files have been combined into $output_file"