@@ -192,9 +192,9 @@ module fpm_command_line
192192 subroutine get_command_line_settings (cmd_settings )
193193 class(fpm_cmd_settings), allocatable , intent (out ) :: cmd_settings
194194
195+ integer , parameter :: widest = 256
195196 character (len= 4096 ) :: cmdarg
196197 integer :: i
197- integer :: widest
198198 integer :: os
199199 logical :: unix
200200 type (fpm_install_settings), allocatable :: install_settings
@@ -434,7 +434,6 @@ subroutine get_command_line_settings(cmd_settings)
434434 elseif (unnamed(2 )==' manual' )then
435435 unnamed= manual
436436 endif
437- widest= 256
438437 allocate (character (len= widest) :: help_text(0 ))
439438 do i= 2 ,size (unnamed)
440439 select case (unnamed(i))
@@ -507,10 +506,12 @@ subroutine get_command_line_settings(cmd_settings)
507506 call set_args(common_args // ' &
508507 & --list F&
509508 &' , help_list, version_text)
510- call printhelp(help_list_nodash)
511509 if (lget(' list' ))then
512- call printhelp(help_list_dash)
510+ help_text = [character (widest) :: help_list_nodash, help_list_dash]
511+ else
512+ help_text = help_list_nodash
513513 endif
514+ call printhelp(help_text)
514515
515516 case (' test' )
516517 call set_args(common_args // compiler_args // run_args // ' --' , &
@@ -592,23 +593,23 @@ subroutine get_command_line_settings(cmd_settings)
592593
593594 if (cmdarg.ne. ' ' .and. which(' fpm-' // cmdarg).ne. ' ' )then
594595 call run(' fpm-' // trim (cmdarg)// ' ' // get_command_arguments_quoted(),.false. )
596+ stop
595597 else
596598 call set_args(' &
597599 & --list F&
598600 &' , help_fpm, version_text)
599601 ! Note: will not get here if --version or --usage or --help
600602 ! is present on commandline
601- help_text= help_usage
602603 if (lget(' list' ))then
603- help_text= help_list_dash
604+ help_text = help_list_dash
604605 elseif (len_trim (cmdarg)==0 )then
605606 write (stdout,' (*(a))' )' Fortran Package Manager:'
606607 write (stdout,' (*(a))' )' '
607- call printhelp(help_list_nodash)
608+ help_text = [ character (widest) :: help_list_nodash, help_usage]
608609 else
609610 write (stderr,' (*(a))' )' <ERROR> unknown subcommand [' , &
610611 & trim (cmdarg), ' ]'
611- call printhelp(help_list_dash)
612+ help_text = [ character (widest) :: help_list_dash, help_usage]
612613 endif
613614 call printhelp(help_text)
614615 endif
@@ -638,6 +639,7 @@ subroutine check_build_vals()
638639
639640 end subroutine check_build_vals
640641
642+ ! > Print help text and stop
641643 subroutine printhelp (lines )
642644 character (len= :),intent (in ),allocatable :: lines(:)
643645 integer :: iii,ii
@@ -649,6 +651,7 @@ subroutine printhelp(lines)
649651 write (stdout,' (a)' )' <WARNING> *printhelp* output requested is empty'
650652 endif
651653 endif
654+ stop
652655 end subroutine printhelp
653656
654657 end subroutine get_command_line_settings
0 commit comments