Skip to content

Commit 8485e94

Browse files
committed
add runner_command function
1 parent 40b7888 commit 8485e94

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/fpm_command_line.f90

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ module fpm_command_line
9292
character(len=:),allocatable :: runner
9393
character(len=:),allocatable :: runner_args
9494
logical :: example
95+
contains
96+
procedure :: runner_command
9597
end type
9698

9799
type, extends(fpm_run_settings) :: fpm_test_settings
@@ -1436,4 +1438,21 @@ function get_fpm_env(env, default) result(val)
14361438
val = get_env(fpm_prefix//env, default)
14371439
end function get_fpm_env
14381440

1441+
!> Build a full runner command (executable + command-line arguments)
1442+
function runner_command(cmd) result(run_cmd)
1443+
class(fpm_run_settings), intent(in) :: cmd
1444+
character(len=:), allocatable :: run_cmd
1445+
1446+
!> Get executable
1447+
if (len_trim(cmd%runner)>0) then
1448+
run_cmd = trim(cmd%runner)
1449+
else
1450+
run_cmd = ''
1451+
end if
1452+
1453+
!> Append command-line arguments
1454+
if (len_trim(cmd%runner_args)>0) run_cmd = run_cmd//' '//trim(cmd%runner_args)
1455+
1456+
end function runner_command
1457+
14391458
end module fpm_command_line

0 commit comments

Comments
 (0)