From e68f93fd752505bc9419a873dbed8314f53077cd Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Mon, 23 Sep 2024 17:25:59 +0200 Subject: [PATCH] With --json, --grad should not accept extra argument --- app/cli.f90 | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/cli.f90 b/app/cli.f90 index 3719cbbc..0c40522d 100644 --- a/app/cli.f90 +++ b/app/cli.f90 @@ -222,14 +222,16 @@ subroutine get_run_arguments(config, list, start, error) config%wrap = .false. case("--grad") config%grad = .true. - iarg = iarg + 1 - call list%get(iarg, arg) - if (allocated(arg)) then - if (arg(1:1) == "-") then - iarg = iarg - 1 - cycle + if (.not.config%json) then + iarg = iarg + 1 + call list%get(iarg, arg) + if (allocated(arg)) then + if (arg(1:1) == "-") then + iarg = iarg - 1 + cycle + end if + call move_alloc(arg, config%grad_output) end if - call move_alloc(arg, config%grad_output) end if case("--atm") config%inp%s9 = 1.0_wp