-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the default case of command line subcommands, stop fpm
running in time
#728
Conversation
If you are going to stop after the help is displayed in this manner, there are three places, LINE NUMBER A few small changes to append to the HELP_TEXT variable instead of multiple calls to PRINTHELP would allow for another solution where PRINTHELP would only be called at these three locations and then the PRINTHELP procedure would have the STOP in it. |
I think it might be preferable to replace some of the calls to printhelp with assignments to the variable HELP_TEXT and then change PRINTHELP() to always stop. Perhaps a matter of taste, but I think that ends up with a clearer approach. For example: diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90
index 88e400c2..5ae6e6b3 100644
--- a/src/fpm_command_line.f90
+++ b/src/fpm_command_line.f90
@@ -494,10 +494,11 @@ contains
call set_args(common_args // '&
& --list F&
&', help_list, version_text)
- call printhelp(help_list_nodash)
+ help_text=help_list_nodash
if(lget('list'))then
- call printhelp(help_list_dash)
+ help_text=[character(len=256) :: help_text, help_list_dash]
endif
+ call printhelp(help_text)
case('test')
call set_args(common_args // compiler_args // run_args // ' --', &
@@ -589,11 +590,11 @@ contains
elseif(len_trim(cmdarg).eq.0)then
write(stdout,'(*(a))')'Fortran Package Manager:'
write(stdout,'(*(a))')' '
- call printhelp(help_list_nodash)
+ help_text=[character(len=256) :: help_list_nodash, help_text]
else
write(stderr,'(*(a))')'<ERROR> unknown subcommand [', &
& trim(cmdarg), ']'
- call printhelp(help_list_dash)
+ help_text=[character(len=256) :: help_list_dash, help_text]
endif
call printhelp(help_text)
endif
@@ -633,6 +634,7 @@ contains
write(stdout,'(a)')'<WARNING> *printhelp* output requested is empty'
endif
endif
+ stop
end subroutine printhelp
end subroutine get_command_line_settings |
Thanks for the reminder and suggestion, @urbanjost . I didn't even notice the need to stop at lines 461, 499, 598. I agree that stopping the program in the Line 578 in 1f2831f
|
As suggested, I made the corresponding changes:
|
The other question to me is whether those messages about the directory should show at all unless the --verbose switch is present. I think they should not. They and all such messages should go to stderr, not stdout; as in earlier versions. Going to stdout breaks or complicates many features, such as the --runner switch. If you use the --list switch or --runner switch to try to just get names that you pipe to another command those messages appear in the pipe as well, polluting it. The change as far as it goes look good to me otherwise. That prevents stops from being scattered around the code and looks much tidier to my eye. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
|
To close #727, a small modification:
>> fpm
), stopfpm
running after printhelp_text
.number_of_rows
infpm.f90
.