Restructure the command parsing loops so the mode commands only parse the mode options

This commit is contained in:
Alex Selimov 2019-12-11 09:07:59 -05:00 committed by Alex Selimov
parent c291ec65b4
commit 0dff3b2ca9
5 changed files with 49 additions and 52 deletions

View file

@ -12,13 +12,14 @@ module mode_merge
public
contains
subroutine merge
subroutine merge(arg_pos)
integer, intent(out) :: arg_pos
integer :: i
real(kind=dp) :: displace(3), temp_box_bd(6)
!First we parse the merge command
call parse_command
call parse_command(arg_pos)
!Now loop over all files and stack them
do i = 1, in_num
@ -44,10 +45,12 @@ module mode_merge
return
end subroutine merge
subroutine parse_command
subroutine parse_command(arg_pos)
integer, intent(out) :: arg_pos
character(len=100) :: textholder
integer :: i, stat, arglen, arg_pos
integer :: i, stat, arglen
!Get dimension to concatenate along
call get_command_argument(2, dim, arglen)
@ -88,13 +91,8 @@ module mode_merge
select case(trim(textholder))
case default
!Check to see if it is an option command, if so then mode_create must be finished
if(textholder(1:1) == '-') then
exit
!Check to see if a filename was passed
elseif(scan(textholder,'.',.true.) > 0) then
call get_out_file(textholder)
end if
!If it isn't an available option to mode merge then we just exit
exit
end select
end do