@@ -31,7 +31,8 @@ module fpm_command_line
3131use fpm_strings, only : lower, split, fnv_1a, to_fortran_name, is_fortran_name
3232use fpm_filesystem, only : basename, canon_path, which
3333use fpm_environment, only : run, get_command_arguments_quoted
34- use fpm_compiler, only : get_default_compile_flags
34+ use fpm_compiler, only : get_default_compile_flags
35+ use fpm_error, only : fpm_stop
3536use ,intrinsic :: iso_fortran_env, only : stdin= >input_unit, &
3637 & stdout= >output_unit, &
3738 & stderr= >error_unit
@@ -139,7 +140,6 @@ subroutine get_command_line_settings(cmd_settings)
139140 end select
140141 version_text = [character (len= 80 ) :: &
141142 & ' Version: 0.3.0, alpha' , &
142- & ' PR: 511' , &
143143 & ' Program: fpm(1)' , &
144144 & ' Description: A Fortran package manager and build system' , &
145145 & ' Home Page: https://github.com/fortran-lang/fpm' , &
@@ -245,25 +245,23 @@ subroutine get_command_line_settings(cmd_settings)
245245 & help_new, version_text)
246246 select case (size (unnamed))
247247 case (1 )
248- write (stderr,' (*(g0,/))' )' <ERROR> directory name required'
249248 write (stderr,' (*(7x,g0,/))' ) &
250249 & ' <USAGE> fpm new NAME [[--lib|--src] [--app] [--test] [--example]]|[--full|--bare] [--backfill]'
251- stop 1
250+ call fpm_stop( 1 , ' directory name required ' )
252251 case (2 )
253252 name= trim (unnamed(2 ))
254253 case default
255- write (stderr,' (g0)' )' <ERROR> only one directory name allowed'
256254 write (stderr,' (7x,g0)' ) &
257255 & ' <USAGE> fpm new NAME [[--lib|--src] [--app] [--test] [--example]]| [--full|--bare] [--backfill]'
258- stop 2
256+ call fpm_stop( 2 , ' only one directory name allowed ' )
259257 end select
260258 ! *! canon_path is not converting ".", etc.
261259 name= canon_path(name)
262260 if ( .not. is_fortran_name(to_fortran_name(basename(name))) )then
263261 write (stderr,' (g0)' ) [ character (len= 72 ) :: &
264262 & ' <ERROR> the fpm project name must be made of up to 63 ASCII letters,' , &
265263 & ' numbers, underscores, or hyphens, and start with a letter.' ]
266- stop 4
264+ call fpm_stop( 4 , ' ' )
267265 endif
268266
269267 allocate (fpm_new_settings :: cmd_settings)
@@ -272,13 +270,13 @@ subroutine get_command_line_settings(cmd_settings)
272270 write (stderr,' (*(a))' )&
273271 &' <ERROR> --full and any of [--src|--lib,--app,--test,--example,--bare]' , &
274272 &' are mutually exclusive.'
275- stop 5
273+ call fpm_stop( 5 , ' ' )
276274 elseif (any ( specified([character (len= 10 ) :: ' src' ,' lib' ,' app' ,' test' ,' example' ,' full' ])) &
277275 & .and. lget(' bare' ) )then
278276 write (stderr,' (*(a))' )&
279277 &' <ERROR> --bare and any of [--src|--lib,--app,--test,--example,--full]' , &
280278 &' are mutually exclusive.'
281- stop 3
279+ call fpm_stop( 3 , ' ' )
282280 elseif (any ( specified([character (len= 10 ) :: ' src' ,' lib' ,' app' ,' test' ,' example' ]) ) )then
283281 cmd_settings= fpm_new_settings(&
284282 & backfill= lget(' backfill' ), &
0 commit comments