Skip to content

Commit 8c55133

Browse files
committed
Add --all as an alias for --target '*' on "run" subcommand
1 parent f280332 commit 8c55133

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

fpm/src/fpm.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,9 @@ subroutine cmd_run(settings,test)
296296

297297
! Check all names are valid
298298
! or no name and found more than one file
299-
if ( any(.not.found) .or. (size(settings%name).eq.0 .and. size(executables).gt.1 .and. .not.test) ) then
299+
if ( any(.not.found) .or. &
300+
& (size(settings%name).eq.0 .and. size(executables).gt.1 .and. .not.test) .and.&
301+
& .not.settings%list) then
300302
if(any(.not.found))then
301303
write(stderr,'(A)',advance="no")'fpm::run<ERROR> specified names '
302304
do j=1,size(settings%name)

fpm/src/fpm_command_line.f90

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ subroutine get_command_line_settings(cmd_settings)
152152
call set_args('&
153153
& --target " " &
154154
& --list F &
155+
& --all F &
155156
& --release F&
156157
& --example F&
157158
& --runner " " &
@@ -171,6 +172,9 @@ subroutine get_command_line_settings(cmd_settings)
171172
call split(sget('target'),tnames,delimiters=' ,:')
172173
names=[character(len=max(len(names),len(tnames))) :: names,tnames]
173174
endif
175+
if(lget('all'))then
176+
names=[character(len=max(len(names),1)) :: names,'*']
177+
endif
174178

175179
allocate(fpm_run_settings :: cmd_settings)
176180
val_runner=sget('runner')
@@ -696,7 +700,7 @@ subroutine set_help()
696700
' By default applications in /app or specified as "executable" in your ', &
697701
' "fpm.toml" manifest are used. Alternatively demonstration programs ', &
698702
' in example/ or specified in the "example" section in "fpm.toml" ', &
699-
' can be executed with this subcommand. ', &
703+
' can be executed. ', &
700704
' ', &
701705
'OPTIONS ', &
702706
' --target NAME(s) list of specific application names to execute. ', &
@@ -707,6 +711,7 @@ subroutine set_help()
707711
' Simple "globbing" is supported where "?" represents ', &
708712
' any single character and "*" represents any string. ', &
709713
' Therefore a quoted asterisk ''*'' runs all programs. ', &
714+
' --all An alias for "--target ''*''. All targets are selected. ', &
710715
' --example run example programs instead of applications ', &
711716
' --release selects the optimized build instead of the debug build. ', &
712717
' --compiler COMPILER_NAME Specify a compiler name. The default is ', &

0 commit comments

Comments
 (0)