#!/bin/csh -f
#+
# OSIRIS library of scripts
#
# NAME
#      igoi - wrapper for osirisGoi imag 
#
# SYNOPSIS
#     igoi [x -nw] 
#
# DESCRIPTION
#
#     Expose on the IMAG detector
#
# ARGUMENTS
#     x - number of images (1-999)
#   -nw - do not wait for the exposure to finish (do not call wfgo)
#
# OPTIONS
#
# EXAMPLES
#    igoi    - take 1 exposure
#    igoi 1  - take 1 exposure
#    igoi 5  - take 5 exposures
#
# ENVIRONMENT VARIABLES
#
# FILES
#
# SERVERS & KEYWORDS
#    
#
#
# SCRIPTS CALLED
#
# EXIT STATUS
#     0 - normal exit, no error
#     1 - script aborted by an interrupt
#     2 - syncheck error
#     3 - error parsing command line input
#     other errors...
#
#
#
# Modification History:
# 20180710 - jlyke Original
#------------------------------------------------------
# Boiler plate for "-h" support for command autohelp.

if ("$1" == "-h") then
    help $0
    exit $status
endif

set num = 1
set nowait = ""

while ($#argv > 0 ) 
  switch ($1)
    case [1-9]*:
      set num = $1
      breaksw
    case -nw:
      set nowait = "-nw"
      breaksw
    default:
      breaksw
  endsw
  shift
end 

osirisGoi imag -n $num $nowait