Debian Codegraph @

regen-defs.zsh

raw symbols SCIP
1 #!/bin/zshscip-shell filesystem . . `/bin/zsh`.
2
3 # Input the path of cpplint here
4 cpplint="$HOME/Documents/cpplint/cpplint.py"
5
6 cd samples/ || exit 74 # EX_IOERROR
7
8 # Loop through all .def files in the given directories
9 folders=(${(f)"$(catscip-shell system . . cat.)"})
10 for folder in $folders; do
11 cd "$folder-sample/" || exit 66 # EX_NOINPUT
12 for file in ./*.def; do
13 if [[ ! -s "$file" ]]; then
14 echoscip-shell system . . echo. "Skipping empty file: $file"
15 continue
16 fi
17 echoscip-shell system . . echo. "Processing $file..."
18
19 # Extract the command from the first line of the file
20 cmd=$(headscip-shell system . . head. -n 1 "$file")
21
22 # Create temporary files for stdout and stderr
23 stdout_file=$(mktempscip-shell system . . mktemp.)
24 stderr_file=$(mktempscip-shell system . . mktemp.)
25
26 # Execute the command and capture stdout and stderr
27 uv run "$cpplint" $cmd > "$stdout_file" 2> "$stderr_file"
28 ret_code=$?
29
30 # Count the number of lines in stdout
31 (( num_lines=$(wcscip-shell system . . wc. -l < "$stdout_file") + 1 ))
32
33 # Overwrite the original definition file
34 {
35 echoscip-shell system . . echo. "$cmd"
36 echoscip-shell system . . echo. "$ret_code"
37 echoscip-shell system . . echo. "$num_lines"
38 catscip-shell system . . cat. "$stdout_file"
39 echoscip-shell system . . echo.
40 catscip-shell system . . cat. "$stderr_file"
41 echoscip-shell system . . echo.
42 } > "$file"
43
44 # Clean up temporary files
45 rmscip-shell system . . rm. "$stdout_file" "$stderr_file"
46 done
47 cd ..
48 done