@@ -190,9 +190,9 @@ module fpm_command_line
190190 subroutine get_command_line_settings (cmd_settings )
191191 class(fpm_cmd_settings), allocatable , intent (out ) :: cmd_settings
192192
193+ integer , parameter :: widest = 256
193194 character (len= 4096 ) :: cmdarg
194195 integer :: i
195- integer :: widest
196196 integer :: os
197197 logical :: unix
198198 type (fpm_install_settings), allocatable :: install_settings
@@ -423,7 +423,6 @@ subroutine get_command_line_settings(cmd_settings)
423423 elseif (unnamed(2 )==' manual' )then
424424 unnamed= manual
425425 endif
426- widest= 256
427426 allocate (character (len= widest) :: help_text(0 ))
428427 do i= 2 ,size (unnamed)
429428 select case (unnamed(i))
@@ -494,10 +493,12 @@ subroutine get_command_line_settings(cmd_settings)
494493 call set_args(common_args // ' &
495494 & --list F&
496495 &' , help_list, version_text)
497- call printhelp(help_list_nodash)
498496 if (lget(' list' ))then
499- call printhelp(help_list_dash)
497+ help_text = [character (widest) :: help_list_nodash, help_list_dash]
498+ else
499+ help_text = help_list_nodash
500500 endif
501+ call printhelp(help_text)
501502
502503 case (' test' )
503504 call set_args(common_args // compiler_args // run_args // ' --' , &
@@ -576,23 +577,23 @@ subroutine get_command_line_settings(cmd_settings)
576577
577578 if (cmdarg.ne. ' ' .and. which(' fpm-' // cmdarg).ne. ' ' )then
578579 call run(' fpm-' // trim (cmdarg)// ' ' // get_command_arguments_quoted(),.false. )
580+ stop
579581 else
580582 call set_args(' &
581583 & --list F&
582584 &' , help_fpm, version_text)
583585 ! Note: will not get here if --version or --usage or --help
584586 ! is present on commandline
585- help_text= help_usage
586587 if (lget(' list' ))then
587- help_text= help_list_dash
588+ help_text = help_list_dash
588589 elseif (len_trim (cmdarg)==0 )then
589590 write (stdout,' (*(a))' )' Fortran Package Manager:'
590591 write (stdout,' (*(a))' )' '
591- call printhelp(help_list_nodash)
592+ help_text = [ character (widest) :: help_list_nodash, help_usage]
592593 else
593594 write (stderr,' (*(a))' )' <ERROR> unknown subcommand [' , &
594595 & trim (cmdarg), ' ]'
595- call printhelp(help_list_dash)
596+ help_text = [ character (widest) :: help_list_dash, help_usage]
596597 endif
597598 call printhelp(help_text)
598599 endif
@@ -621,6 +622,7 @@ subroutine check_build_vals()
621622
622623 end subroutine check_build_vals
623624
625+ ! > Print help text and stop
624626 subroutine printhelp (lines )
625627 character (len= :),intent (in ),allocatable :: lines(:)
626628 integer :: iii,ii
@@ -632,6 +634,7 @@ subroutine printhelp(lines)
632634 write (stdout,' (a)' )' <WARNING> *printhelp* output requested is empty'
633635 endif
634636 endif
637+ stop
635638 end subroutine printhelp
636639
637640 end subroutine get_command_line_settings
0 commit comments