shorter logic for missing arguments
This commit is contained in:
parent
295b5348f3
commit
70817606db
19
src/CLI.f90
19
src/CLI.f90
|
@ -59,6 +59,8 @@ subroutine CLI_init()
|
|||
i
|
||||
integer, dimension(8) :: &
|
||||
dateAndTime
|
||||
logical :: &
|
||||
hasArg
|
||||
external :: &
|
||||
quit
|
||||
|
||||
|
@ -109,6 +111,7 @@ subroutine CLI_init()
|
|||
print'(1x,a,1x,2(i2.2,a),i2.2)', 'Time:',dateAndTime(5),':',dateAndTime(6),':',dateAndTime(7)
|
||||
|
||||
do i = 1, command_argument_count()
|
||||
hasArg = i < command_argument_count()
|
||||
arg = getArg(i)
|
||||
select case(trim(arg)) ! extract key
|
||||
case ('-h','--help')
|
||||
|
@ -155,25 +158,25 @@ subroutine CLI_init()
|
|||
print'(1x,a,/)',' Prints this message and exits'
|
||||
call quit(0) ! normal Termination
|
||||
case ('-g', '--geom', '--geometry')
|
||||
if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --geom'
|
||||
if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --geom'
|
||||
geomArg = getArg(i+1)
|
||||
case ('-l', '--load', '--loadcase')
|
||||
if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --load'
|
||||
if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --load'
|
||||
loadArg = getArg(i+1)
|
||||
case ('-m', '--material', '--materialconfig')
|
||||
if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --material'
|
||||
if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --material'
|
||||
materialArg = getArg(i+1)
|
||||
case ('-n', '--numerics', '--numericsconfig')
|
||||
if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --numerics'
|
||||
if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --numerics'
|
||||
numericsArg = getArg(i+1)
|
||||
case ('-j', '--job', '--jobname')
|
||||
if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --jobname'
|
||||
if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --jobname'
|
||||
solverJobname = getArg(i+1)
|
||||
case ('-w', '--wd', '--workingdir', '--workingdirectory')
|
||||
if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --workingdirectory'
|
||||
if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --workingdirectory'
|
||||
workingDirArg = getArg(i+1)
|
||||
case ('-r', '--rs', '--restart')
|
||||
if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --restart'
|
||||
if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --restart'
|
||||
arg = getArg(i+1)
|
||||
read(arg,*,iostat=stat) CLI_restartInc
|
||||
if (CLI_restartInc < 0 .or. stat /= 0) then
|
||||
|
@ -340,7 +343,7 @@ function getPathRelCWD(path,fileType)
|
|||
|
||||
inquire(file=getPathRelCWD, exist=file_exists)
|
||||
if (.not. file_exists) then
|
||||
print'(1x,a)', 'ERROR: '//fileType//' file does not exist: '//trim(getPathRelCWD)
|
||||
print'(/,1x,a)', 'ERROR: '//fileType//' file does not exist: '//trim(getPathRelCWD)
|
||||
call quit(1)
|
||||
end if
|
||||
|
||||
|
|
Loading…
Reference in New Issue