Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(app_config), | intent(out), | allocatable | :: | config |
Configuation data |
|
type(error_type), | intent(out), | allocatable | :: | error |
Error handling |
subroutine get_arguments(config, error) !> Configuation data class(app_config), allocatable, intent(out) :: config !> Error handling type(error_type), allocatable, intent(out) :: error type(argument_list) :: list integer :: iarg, narg character(len=:), allocatable :: arg iarg = 0 list = argument_list() narg = len(list) do while(iarg < narg) iarg = iarg + 1 call list%get(iarg, arg) select case(arg) case("--help") call info_message(error, help_text) exit case("--version") call version(output_unit) stop case default iarg = iarg - 1 allocate(run_config :: config) exit case("run") allocate(run_config :: config) exit case("param") allocate(param_config :: config) exit case("gcp") allocate(gcp_config :: config) exit end select end do if (allocated(error)) return if (.not.allocated(config)) then write(output_unit, '(a)') help_text call fatal_error(error, "Insufficient arguments provided") return end if select type(config) type is(run_config) call get_run_arguments(config, list, iarg, error) type is(param_config) call get_param_arguments(config, list, iarg, error) type is(gcp_config) call get_gcp_arguments(config, list, iarg, error) end select end subroutine get_arguments