From 9fc759a1821df5a11bde1e48f0f09aca39130f1f Mon Sep 17 00:00:00 2001 From: "John S. Urban" Date: Fri, 12 Nov 2021 15:33:27 -0500 Subject: white-space adjustments to help to conform to txt2man(1) utility A few lines in the help text no longer conformed to the rules used by txt2man(1), causing errors in generating man-pages and an HTML version of the documentation available via the "help" subcommand. --- src/fpm_command_line.f90 | 61 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90 index 4fce58a..ed99e58 100644 --- a/src/fpm_command_line.f90 +++ b/src/fpm_command_line.f90 @@ -121,26 +121,25 @@ character(len=:), allocatable :: val_runner, val_compiler, val_flag, val_cflag, ! '12345678901234567890123456789012345678901234567890123456789012345678901234567890',& character(len=80), parameter :: help_text_compiler(*) = [character(len=80) :: & - ' --compiler NAME Specify a compiler name. The default is "gfortran"',& - ' unless set by the environment variable FPM_FC.',& - ' --c-compiler NAME Specify the C compiler name. Automatically determined by ',& - ' default unless set by the environment variable FPM_CC.',& - ' --archiver NAME Specify the archiver name. Automatically determined by ',& - ' default unless set by the environment variable FPM_AR.'& + ' --compiler NAME Specify a compiler name. The default is "gfortran" ',& + ' unless set by the environment variable FPM_FC. ',& + ' --c-compiler NAME Specify the C compiler name. Automatically determined by ',& + ' default unless set by the environment variable FPM_CC. ',& + ' --archiver NAME Specify the archiver name. Automatically determined by ',& + ' default unless set by the environment variable FPM_AR. '& ] +! '12345678901234567890123456789012345678901234567890123456789012345678901234567890',& character(len=80), parameter :: help_text_flag(*) = [character(len=80) :: & - ' --flag FFLAGS selects compile arguments for the build, the default',& - ' value is set by the FPM_FFLAGS environment variable.', & - ' These are added to the profile options if --profile', & - ' is specified, else these options override the defaults.',& - ' Note object and .mod directory locations are always',& - ' built in.',& + ' --flag FFLAGS selects compile arguments for the build, the default value is',& + ' set by the FPM_FFLAGS environment variable. These are added ',& + ' to the profile options if --profile is specified, else these ',& + ' these options override the defaults. Note object and .mod ',& + ' directory locations are always built in. ',& ' --c-flag CFLAGS selects compile arguments specific for C source in the build.',& - ' The default value is set by the FPM_CFLAGS environment',& - ' variable.',& - ' --link-flag LDFLAGS',& - ' select arguments passed to the linker for the build. The',& + ' The default value is set by the FPM_CFLAGS environment ',& + ' variable. ',& + ' --link-flag LDFLAGS select arguments passed to the linker for the build. The ',& ' default value is set by the FPM_LDFLAGS environment variable.'& ] @@ -705,15 +704,15 @@ contains 'SUBCOMMANDS ', & ' Valid fpm(1) subcommands are: ', & ' ', & - ' + build Compile the packages into the "build/" directory. ', & - ' + new Create a new Fortran package directory with sample files. ', & - ' + update Update the project dependencies. ', & - ' + run Run the local package binaries. defaults to all binaries for ', & - ' that release. ', & - ' + test Run the tests. ', & - ' + help Alternate to the --help switch for displaying help text. ', & - ' + list Display brief descriptions of all subcommands. ', & - ' + install Install project ', & + ' + build Compile the packages into the "build/" directory. ', & + ' + new Create a new Fortran package directory with sample files. ', & + ' + update Update the project dependencies. ', & + ' + run Run the local package binaries. defaults to all binaries ', & + ' for that release. ', & + ' + test Run the tests. ', & + ' + help Alternate to the --help switch for displaying help text. ', & + ' + list Display brief descriptions of all subcommands. ', & + ' + install Install project ', & ' ', & ' Their syntax is ', & ' ', & @@ -758,7 +757,7 @@ contains ' directory. ', & ' ', & ' If "file" does not exist or cannot be read, then an error occurs and', & - ' the program stops. Each line of the file is prefixed with "options"', & + ' the program stops. Each line of the file is prefixed with "options" ', & ' and interpreted as a separate argument. The file itself may not ', & ' contain @file arguments. That is, it is not processed recursively. ', & ' ', & @@ -932,11 +931,11 @@ contains ' default. ',& help_text_compiler, & help_text_flag, & - ' --list list candidates instead of building or running them ', & - ' --tests build all tests (otherwise only if needed) ', & - ' --show-model show the model and exit (do not build) ', & - ' --help print this help and exit ', & - ' --version print program version information and exit ', & + ' --list list candidates instead of building or running them ', & + ' --tests build all tests (otherwise only if needed) ', & + ' --show-model show the model and exit (do not build) ', & + ' --help print this help and exit ', & + ' --version print program version information and exit ', & ' ', & help_text_environment, & ' ', & -- cgit v1.2.3 From 76f87ebbf1e763426d6eae2e57dc27fb78767d03 Mon Sep 17 00:00:00 2001 From: "John S. Urban" Date: Fri, 12 Nov 2021 16:45:06 -0500 Subject: correct basename(3f) function and subsequently fix --list option The --list option was incorrectly trimming pathnames when suffix=.false. was present, and the meaning of the --list option has changed from originally being an option to display the full pathnames of targets to displaying a table of matching target basenames. Since the --runner command can be used to display the full pathnames and the runner command defaults to an "echo" command the pathnames can still easily be generated, but an example was added to reflect that. As the help text needed editing anyway, changed some whitespace to conform to the requirements of the txt2man(1) utility, to facilitate easily generating man-pages and HTML versions of the help text. --- src/fpm.f90 | 2 +- src/fpm_command_line.f90 | 11 +++++++---- src/fpm_filesystem.F90 | 19 ++++++++----------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/fpm.f90 b/src/fpm.f90 index 0dd723c..6084a11 100644 --- a/src/fpm.f90 +++ b/src/fpm.f90 @@ -287,7 +287,7 @@ else call build_package(targets,model) endif -end subroutine +end subroutine cmd_build subroutine cmd_run(settings,test) class(fpm_run_settings), intent(in) :: settings diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90 index ed99e58..db5d7c7 100644 --- a/src/fpm_command_line.f90 +++ b/src/fpm_command_line.f90 @@ -864,7 +864,7 @@ contains help_text_flag, & ' --runner CMD A command to prefix the program execution paths with. ', & ' see "fpm help runner" for further details. ', & - ' --list list pathname of candidates instead of running them. Note ', & + ' --list list basenames of candidates instead of running them. Note ', & ' out-of-date candidates will still be rebuilt before being ', & ' listed. ', & ' -- ARGS optional arguments to pass to the program(s). The same ', & @@ -876,7 +876,9 @@ contains ' fpm(1) - run or display project applications: ', & ' ', & ' fpm run # run a target when only one exists or list targets ', & - ' fpm run --list # list all targets, running nothing. ', & + ' fpm run --list # list basename of all targets, running nothing. ', & + ' fpm run "demo*" --list # list target basenames starting with "demo*".', & + ' fpm run "psi*" --runner # list target pathnames starting with "psi*".', & ' fpm run --all # run all targets, no matter how many there are. ', & ' ', & ' # run default program built or to be built with the compiler command ', & @@ -885,7 +887,7 @@ contains ' fpm run --compiler f90 ', & ' ', & ' # run example programs instead of the application programs. ', & - ' fpm run --example ''*'' ', & + ' fpm run --example "*" ', & ' ', & ' # run a specific program and pass arguments to the command ', & ' fpm run myprog -- -x 10 -y 20 --title "my title line" ', & @@ -1110,7 +1112,8 @@ contains help_text_flag, & ' --runner CMD A command to prefix the program execution paths with. ', & ' see "fpm help runner" for further details. ', & - ' --list list candidates instead of building or running them ', & + ' --list list candidate basenames instead of running them. Note they', & + ' --list will still be built if not currently up to date. ', & ' -- ARGS optional arguments to pass to the test program(s). ', & ' The same arguments are passed to all test names ', & ' specified. ', & diff --git a/src/fpm_filesystem.F90 b/src/fpm_filesystem.F90 index 102d6c5..83cffe7 100644 --- a/src/fpm_filesystem.F90 +++ b/src/fpm_filesystem.F90 @@ -94,21 +94,18 @@ function basename(path,suffix) result (base) with_suffix = suffix end if - if (with_suffix) then - call split(path,file_parts,delimiters='\/') - if(size(file_parts).gt.0)then - base = trim(file_parts(size(file_parts))) - else - base = '' - endif + call split(path,file_parts,delimiters='\/') + if(size(file_parts).gt.0)then + base = trim(file_parts(size(file_parts))) else - call split(path,file_parts,delimiters='\/.') + base = '' + endif + if(.not.with_suffix)then + call split(base,file_parts,delimiters='.') if(size(file_parts).ge.2)then base = trim(file_parts(size(file_parts)-1)) - else - base = '' endif - end if + endif end function basename -- cgit v1.2.3