Extract Daml source files from a DAR?

How can I extract the Daml source files from a DAR?
(assuming they have not been removed)

The following works on macOS:

unzip some.dar '*.daml'

Keep in mind that there is no guarantee that the embedded Daml source files are exactly the same as the source files used to compile the DAR.

DAR files are in in the zip format (similar to Java ecosystem’s JAR files). The Daml source files are included in the DAR files for convenience. However, replacing them does not invalidate the DAR file.

Bash script to extract all .daml files from .dar archives in the current directory

#!/bin/bash

# Script to extract all .daml files from .dar archives in the current directory

for dar_file in *.dar; do
   if [ -f "$dar_file" ]; then
      echo "Extracting .daml files from: $dar_file"
      unzip -o "$dar_file" '*.daml'
   fi
done

echo "Done extracting .daml files from all .dar archives"