@@ -44,14 +44,15 @@ shmesa_help () {
44
44
|___/_| |_|_| |_|_____|____/_/ \_\
45
45
46
46
EOF
47
- echo " Usage: shmesa [work|change|defaults|cp|grep|zip|help] [arguments]"
47
+ echo " Usage: shmesa [work|change|defaults|cp|grep|extras| zip|help] [arguments]"
48
48
echo
49
49
echo " Subcommands:"
50
50
echo " work copy the work directory to the current location"
51
51
echo " change change a parameter in the given inlist"
52
52
echo " defaults copy the history/profile defaults to the current location"
53
53
echo " cp copy a MESA directory without copying LOGS, photos, etc."
54
54
echo " grep search the MESA source code for a given string"
55
+ echo " extras fill in the full run_star_extras.f90 template"
55
56
echo " zip prepare a MESA directory for sharing"
56
57
echo " help display this helpful message"
57
58
echo " -h flag for getting additional details about any of the above"
@@ -258,12 +259,36 @@ shmesa_zip () {
258
259
}
259
260
260
261
262
+ shmesa_extras () {
263
+ if shmesa_check_h_flag " $@ " ; then
264
+ echo " Usage: shmesa extras [src/run_star_extras.f90]"
265
+ echo " replaces run_star_extras.f90 with the full template"
266
+ return 0
267
+ fi
268
+
269
+ local rse=' src/run_star_extras.f90'
270
+ if [[ ! -z $1 ]]; then
271
+ rse=$1
272
+ fi
273
+
274
+ local contents=$( cat " $MESA_DIR /include/standard_run_star_extras.inc" )
275
+ if [[ -z $contents ]]; then
276
+ echo " Cannot find $MESA_DIR /include/standard_run_star_extras.inc"
277
+ return 1
278
+ fi
279
+ contents=$( sed ' s:|:\\|:g' " $MESA_DIR /include/standard_run_star_extras.inc" | sed -z ' s:\n:\\n:g' )
280
+
281
+ backup_copy " $rse " " $rse " .bak
282
+ sed -i " s| include 'standard_run_star_extras.inc'|$contents |" $rse
283
+ }
284
+
285
+
261
286
# ## DEVELOPMENT USE
262
287
shmesa_template () {
263
288
# ## TEMPLATE FOR NEW SHMESA FUNCTIONS
264
289
if shmesa_check_h_flag " $@ " ; then
265
290
echo " Usage: shmesa funcname arg [optional arg]"
266
- echo " put discription here"
291
+ echo " put description here"
267
292
return 0
268
293
fi
269
294
@@ -335,6 +360,10 @@ shmesa_test () {
335
360
# shmesa cp
336
361
run_shmesa_test " cp" \
337
362
" (shmesa cp '$MESA_SHMESA_TEST ' '$MESA_SHMESA_TEST '_cp)"
363
+
364
+ # shmesa extras
365
+ run_shmesa_test " extras" \
366
+ " (cd $MESA_SHMESA_TEST && shmesa extras)"
338
367
339
368
# shmesa zip
340
369
run_shmesa_test " zip" \
@@ -435,6 +464,9 @@ case "$subcommand" in
435
464
grep)
436
465
shmesa_grep " $@ "
437
466
;;
467
+ extras)
468
+ shmesa_extras " $@ "
469
+ ;;
438
470
zip)
439
471
shmesa_zip " $@ "
440
472
;;
0 commit comments