Skip to content

Commit 03fec87

Browse files
committed
better examples for --runner and errata per @awvwgk
1 parent f62bec5 commit 03fec87

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

fpm/src/fpm.f90

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ subroutine add_dependencies(dependency_list)
8585
character(:), allocatable :: dependency_path
8686

8787
do i=1,size(dependency_list)
88-
88+
8989
if (dependency_list(i)%name .in. package_list) then
9090
cycle
9191
end if
@@ -100,7 +100,7 @@ subroutine add_dependencies(dependency_list)
100100
end if
101101

102102
else if (allocated(dependency_list(i)%path)) then
103-
103+
104104
dependency_path = join_path(package_root,dependency_list(i)%path)
105105

106106
end if
@@ -121,11 +121,11 @@ subroutine add_dependencies(dependency_list)
121121
dependency%library%source_dir = "src"
122122
end if
123123

124-
124+
125125
call add_libsources_from_package(sources,link_libraries,package_list,dependency, &
126126
package_root=dependency_path, &
127127
dev_depends=.false., error=error)
128-
128+
129129
if (allocated(error)) then
130130
error%message = 'Error while processing sources for dependency package "'//&
131131
new_line('a')//dependency%name//'"'//&
@@ -358,7 +358,7 @@ subroutine cmd_run(settings,test)
358358
exe_source => exe_target%dependencies(1)%ptr%source
359359

360360
if (exe_source%unit_scope == &
361-
merge(FPM_SCOPE_TEST,FPM_SCOPE_APP,test)) then
361+
merge(FPM_SCOPE_TEST,FPM_SCOPE_APP,test)) then
362362

363363
col_width = max(col_width,len(basename(exe_target%output_file))+2)
364364

@@ -372,7 +372,7 @@ subroutine cmd_run(settings,test)
372372
do j=1,size(settings%name)
373373

374374
if (trim(settings%name(j))==exe_source%exe_name) then
375-
375+
376376
found(j) = .true.
377377
exe_cmd%s = exe_target%output_file
378378
executables = [executables, exe_cmd]
@@ -382,7 +382,7 @@ subroutine cmd_run(settings,test)
382382
end do
383383

384384
end if
385-
385+
386386
end if
387387

388388
end if
@@ -415,14 +415,14 @@ subroutine cmd_run(settings,test)
415415
do i=1,size(model%targets)
416416

417417
exe_target => model%targets(i)%ptr
418-
418+
419419
if (exe_target%target_type == FPM_TARGET_EXECUTABLE .and. &
420420
allocated(exe_target%dependencies)) then
421421

422422
exe_source => exe_target%dependencies(1)%ptr%source
423423

424424
if (exe_source%unit_scope == &
425-
merge(FPM_SCOPE_TEST,FPM_SCOPE_APP,test)) then
425+
merge(FPM_SCOPE_TEST,FPM_SCOPE_APP,test)) then
426426

427427
write(stderr,'(A)',advance=(merge("yes","no ",modulo(j,nCol)==0))) &
428428
& [character(len=col_width) :: basename(exe_target%output_file)]
@@ -451,13 +451,13 @@ subroutine cmd_run(settings,test)
451451
if (settings%list) then
452452
write(stderr,*) executables(i)%s
453453
else
454-
454+
455455
if (exists(executables(i)%s)) then
456-
if(settings%runner .ne. ' ')then
456+
if(settings%runner .ne. ' ')then
457457
call run(settings%runner//' '//executables(i)%s//" "//settings%args)
458-
else
458+
else
459459
call run(executables(i)%s//" "//settings%args)
460-
endif
460+
endif
461461
else
462462
write(stderr,*)'fpm::run<ERROR>',executables(i)%s,' not found'
463463
stop 1

fpm/src/fpm_command_line.f90

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ subroutine set_help()
314314
' executables. ', &
315315
' ', &
316316
'SYNOPSIS ', &
317-
' fpm run|test --runner CMD ... ', &
317+
' fpm run|test --runner CMD ... -- SUFFIX_OPTIONS ', &
318318
' ', &
319319
'DESCRIPTION ', &
320320
' The --runner option allows specifying a program to launch ', &
@@ -329,6 +329,8 @@ subroutine set_help()
329329
' --runner ''CMD'' quoted command used to launch the fpm(1) executables. ', &
330330
' Available for both the "run" and "test" subcommands. ', &
331331
' ', &
332+
' -- SUFFIX_OPTIONS additional options to suffix the command CMD and executable ', &
333+
' file names with. ', &
332334
'EXAMPLES ', &
333335
' Use cases for ''fpm run|test --runner "CMD"'' include employing ', &
334336
' the following common GNU/Linux and Unix commands: ', &
@@ -361,6 +363,10 @@ subroutine set_help()
361363
' fpm run --runner strip ', &
362364
' fpm run --runner ''cp -t /usr/local/bin'' ', &
363365
' ', &
366+
' # options after executable name can be specified after the -- option ', &
367+
' fpm --runner cp run -- /usr/local/bin/ ', &
368+
' # generates commands of the form "cp $FILENAME /usr/local/bin/" ', &
369+
' ', &
364370
' # bash(1) alias example: ', &
365371
' alias fpm-install="ffpm run --release --runner \ ', &
366372
' ''install -vbp -m 0711 -t ~/.local/bin''" ', &

0 commit comments

Comments
 (0)