Granular.jl

Julia package for granular dynamics simulation
git clone git://src.adamsgaard.dk/Granular.jl # fast
git clone https://src.adamsgaard.dk/Granular.jl.git # slow
Log | Files | Refs | README | LICENSE Back to index

granular-status.sh (2055B)


      1 #!/usr/bin/env bash
      2 
      3 version=1.0
      4 loopinterval=10
      5 
      6 function show_help {
      7     echo "usage: ${0##*/} [OPTIONS] [COMMAND]"
      8     echo "Status script which traverses the subdirectories of the current "
      9     echo "directory for simulations."
     10     echo
     11     echo "The following COMMANDS are supported:"
     12     echo "   loop                continuously show status of simulations"
     13     echo "   render              continuously show status of simulations"
     14     echo
     15     echo "OPTIONS are one or more of the following:"
     16     echo "   -h, --help                show this message"
     17     echo "   -v, --version             show version and license information"
     18     echo "   -n, --interval SECONDS    sleep duration between status loops"
     19     echo "   --                        do not consider any following args as options"
     20 }
     21 
     22 function show_version {
     23     echo "${0##*/} version $version"
     24     echo "Licensed under the GNU Public License, v3+"
     25     echo "written by Anders Damsgaard, anders@adamsgaard.dk"
     26     echo "https://gitlab.com/admesg/dotfiles"
     27 }
     28 
     29 function die {
     30     printf '%s\n' "$1" >&2
     31     exit 1
     32 }
     33 
     34 while :; do
     35     case "$1" in
     36         -h|-\?|--help)
     37             show_help
     38             exit 0
     39             ;;
     40         -v|--version)
     41             show_version
     42             exit 0
     43             ;;
     44         -n|--interval)
     45             loopinterval="$2"
     46             shift
     47             ;;
     48         --) # end all options
     49             shift
     50             break
     51             ;;
     52         -?*)
     53             die 'Error: Unknown option specified'
     54             ;;
     55         *)  # No more options
     56             break
     57     esac
     58     shift
     59 done
     60 
     61 for cmd in "$@"; do
     62     case "$cmd" in
     63         loop)
     64             julia --color=yes -e "import Granular; Granular.status(loop=true, t_int=$loopinterval)"
     65             exit 0
     66             ;;
     67         visualize)
     68             julia --color=yes -e "import Granular; Granular.status(visualize=true)"
     69             exit 0
     70             ;;
     71         *)
     72             die 'Unknown commmand specified'
     73             ;;
     74     esac
     75 done
     76 julia --color=yes -e "import Granular; Granular.status()"