Skip to content

Commit d08e91f

Browse files
authored
Merge pull request #607 from urbanjost/list
Repair --list option and correct obsolete descriptions of the --list option
2 parents c5ef60d + 76f87eb commit d08e91f

File tree

3 files changed

+46
-47
lines changed

3 files changed

+46
-47
lines changed

src/fpm.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ subroutine cmd_build(settings)
287287
call build_package(targets,model)
288288
endif
289289

290-
end subroutine
290+
end subroutine cmd_build
291291

292292
subroutine cmd_run(settings,test)
293293
class(fpm_run_settings), intent(in) :: settings

src/fpm_command_line.f90

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -121,26 +121,25 @@ module fpm_command_line
121121

122122
! '12345678901234567890123456789012345678901234567890123456789012345678901234567890',&
123123
character(len=80), parameter :: help_text_compiler(*) = [character(len=80) :: &
124-
' --compiler NAME Specify a compiler name. The default is "gfortran"',&
125-
' unless set by the environment variable FPM_FC.',&
126-
' --c-compiler NAME Specify the C compiler name. Automatically determined by ',&
127-
' default unless set by the environment variable FPM_CC.',&
128-
' --archiver NAME Specify the archiver name. Automatically determined by ',&
129-
' default unless set by the environment variable FPM_AR.'&
124+
' --compiler NAME Specify a compiler name. The default is "gfortran" ',&
125+
' unless set by the environment variable FPM_FC. ',&
126+
' --c-compiler NAME Specify the C compiler name. Automatically determined by ',&
127+
' default unless set by the environment variable FPM_CC. ',&
128+
' --archiver NAME Specify the archiver name. Automatically determined by ',&
129+
' default unless set by the environment variable FPM_AR. '&
130130
]
131131

132+
! '12345678901234567890123456789012345678901234567890123456789012345678901234567890',&
132133
character(len=80), parameter :: help_text_flag(*) = [character(len=80) :: &
133-
' --flag FFLAGS selects compile arguments for the build, the default',&
134-
' value is set by the FPM_FFLAGS environment variable.', &
135-
' These are added to the profile options if --profile', &
136-
' is specified, else these options override the defaults.',&
137-
' Note object and .mod directory locations are always',&
138-
' built in.',&
134+
' --flag FFLAGS selects compile arguments for the build, the default value is',&
135+
' set by the FPM_FFLAGS environment variable. These are added ',&
136+
' to the profile options if --profile is specified, else these ',&
137+
' these options override the defaults. Note object and .mod ',&
138+
' directory locations are always built in. ',&
139139
' --c-flag CFLAGS selects compile arguments specific for C source in the build.',&
140-
' The default value is set by the FPM_CFLAGS environment',&
141-
' variable.',&
142-
' --link-flag LDFLAGS',&
143-
' select arguments passed to the linker for the build. The',&
140+
' The default value is set by the FPM_CFLAGS environment ',&
141+
' variable. ',&
142+
' --link-flag LDFLAGS select arguments passed to the linker for the build. The ',&
144143
' default value is set by the FPM_LDFLAGS environment variable.'&
145144
]
146145

@@ -705,15 +704,15 @@ subroutine set_help()
705704
'SUBCOMMANDS ', &
706705
' Valid fpm(1) subcommands are: ', &
707706
' ', &
708-
' + build Compile the packages into the "build/" directory. ', &
709-
' + new Create a new Fortran package directory with sample files. ', &
710-
' + update Update the project dependencies. ', &
711-
' + run Run the local package binaries. defaults to all binaries for ', &
712-
' that release. ', &
713-
' + test Run the tests. ', &
714-
' + help Alternate to the --help switch for displaying help text. ', &
715-
' + list Display brief descriptions of all subcommands. ', &
716-
' + install Install project ', &
707+
' + build Compile the packages into the "build/" directory. ', &
708+
' + new Create a new Fortran package directory with sample files. ', &
709+
' + update Update the project dependencies. ', &
710+
' + run Run the local package binaries. defaults to all binaries ', &
711+
' for that release. ', &
712+
' + test Run the tests. ', &
713+
' + help Alternate to the --help switch for displaying help text. ', &
714+
' + list Display brief descriptions of all subcommands. ', &
715+
' + install Install project ', &
717716
' ', &
718717
' Their syntax is ', &
719718
' ', &
@@ -758,7 +757,7 @@ subroutine set_help()
758757
' directory. ', &
759758
' ', &
760759
' If "file" does not exist or cannot be read, then an error occurs and', &
761-
' the program stops. Each line of the file is prefixed with "options"', &
760+
' the program stops. Each line of the file is prefixed with "options" ', &
762761
' and interpreted as a separate argument. The file itself may not ', &
763762
' contain @file arguments. That is, it is not processed recursively. ', &
764763
' ', &
@@ -865,7 +864,7 @@ subroutine set_help()
865864
help_text_flag, &
866865
' --runner CMD A command to prefix the program execution paths with. ', &
867866
' see "fpm help runner" for further details. ', &
868-
' --list list pathname of candidates instead of running them. Note ', &
867+
' --list list basenames of candidates instead of running them. Note ', &
869868
' out-of-date candidates will still be rebuilt before being ', &
870869
' listed. ', &
871870
' -- ARGS optional arguments to pass to the program(s). The same ', &
@@ -877,7 +876,9 @@ subroutine set_help()
877876
' fpm(1) - run or display project applications: ', &
878877
' ', &
879878
' fpm run # run a target when only one exists or list targets ', &
880-
' fpm run --list # list all targets, running nothing. ', &
879+
' fpm run --list # list basename of all targets, running nothing. ', &
880+
' fpm run "demo*" --list # list target basenames starting with "demo*".', &
881+
' fpm run "psi*" --runner # list target pathnames starting with "psi*".', &
881882
' fpm run --all # run all targets, no matter how many there are. ', &
882883
' ', &
883884
' # run default program built or to be built with the compiler command ', &
@@ -886,7 +887,7 @@ subroutine set_help()
886887
' fpm run --compiler f90 ', &
887888
' ', &
888889
' # run example programs instead of the application programs. ', &
889-
' fpm run --example ''*'' ', &
890+
' fpm run --example "*" ', &
890891
' ', &
891892
' # run a specific program and pass arguments to the command ', &
892893
' fpm run myprog -- -x 10 -y 20 --title "my title line" ', &
@@ -932,11 +933,11 @@ subroutine set_help()
932933
' default. ',&
933934
help_text_compiler, &
934935
help_text_flag, &
935-
' --list list candidates instead of building or running them ', &
936-
' --tests build all tests (otherwise only if needed) ', &
937-
' --show-model show the model and exit (do not build) ', &
938-
' --help print this help and exit ', &
939-
' --version print program version information and exit ', &
936+
' --list list candidates instead of building or running them ', &
937+
' --tests build all tests (otherwise only if needed) ', &
938+
' --show-model show the model and exit (do not build) ', &
939+
' --help print this help and exit ', &
940+
' --version print program version information and exit ', &
940941
' ', &
941942
help_text_environment, &
942943
' ', &
@@ -1111,7 +1112,8 @@ subroutine set_help()
11111112
help_text_flag, &
11121113
' --runner CMD A command to prefix the program execution paths with. ', &
11131114
' see "fpm help runner" for further details. ', &
1114-
' --list list candidates instead of building or running them ', &
1115+
' --list list candidate basenames instead of running them. Note they', &
1116+
' --list will still be built if not currently up to date. ', &
11151117
' -- ARGS optional arguments to pass to the test program(s). ', &
11161118
' The same arguments are passed to all test names ', &
11171119
' specified. ', &

src/fpm_filesystem.F90

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,21 +94,18 @@ function basename(path,suffix) result (base)
9494
with_suffix = suffix
9595
end if
9696

97-
if (with_suffix) then
98-
call split(path,file_parts,delimiters='\/')
99-
if(size(file_parts).gt.0)then
100-
base = trim(file_parts(size(file_parts)))
101-
else
102-
base = ''
103-
endif
97+
call split(path,file_parts,delimiters='\/')
98+
if(size(file_parts).gt.0)then
99+
base = trim(file_parts(size(file_parts)))
104100
else
105-
call split(path,file_parts,delimiters='\/.')
101+
base = ''
102+
endif
103+
if(.not.with_suffix)then
104+
call split(base,file_parts,delimiters='.')
106105
if(size(file_parts).ge.2)then
107106
base = trim(file_parts(size(file_parts)-1))
108-
else
109-
base = ''
110107
endif
111-
end if
108+
endif
112109

113110
end function basename
114111

0 commit comments

Comments
 (0)