Skip to content

Commit

Permalink
[ci skip] zip include and exclude patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
earlbellinger committed Jul 21, 2023
1 parent 85dfea3 commit 28681eb
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions scripts/shmesa/shmesa
Original file line number Diff line number Diff line change
Expand Up @@ -237,23 +237,24 @@ shmesa_grep () {
shmesa_zip () {
if shmesa_check_h_flag "$@"; then
echo "Usage: shmesa zip [directory]"
echo "zips the inlists and models of the specified directory for sharing"
echo "zips the appropriate files of the specified directory for sharing"
return 0
fi

local dir_to_zip='.'
local zip_name="mesa.zip"
if [[ ! -z $1 ]]; then
dir_to_zip=$1
zip_name="${dir_to_zip}_mesa.zip"
fi

if [[ ! $(find "$dir_to_zip" -type f -iname "*inlist*" -o -iname "*.mod") ]]; then
echo "Warning: No files with 'inlist' in their names or files ending in '.mod' found in the directory '$dir_to_zip'."
if [[ ! $(find "$dir_to_zip" -type f -iname "*inlist*") ]]; then
echo "Warning: No inlist files found in the directory '$dir_to_zip'."
fi

# Create a zip file containing only inlists and models
zip -r "$zip_name" "$dir_to_zip" -i '*inlist*' '*.mod'

local include_pattern="*inlist* *.mod *.list *.net */src/*"
local exclude_pattern="*/make/*.mod *.bak"
zip -r "$zip_name" "$dir_to_zip" -i "$include_pattern" -x "$exclude_pattern"
}


Expand Down Expand Up @@ -337,7 +338,7 @@ shmesa_test () {

# shmesa zip
run_shmesa_test "zip" \
"(cd $MESA_SHMESA_TEST && shmesa zip)"
"(shmesa zip '$MESA_SHMESA_TEST')"

# shmesa grep
run_shmesa_test "grep" \
Expand Down

0 comments on commit 28681eb

Please sign in to comment.