diff options
author | LKedward <laurence.kedward@bristol.ac.uk> | 2021-06-05 14:37:40 +0100 |
---|---|---|
committer | LKedward <laurence.kedward@bristol.ac.uk> | 2021-06-05 14:37:40 +0100 |
commit | 7e9c3390b04a0fc746812abd65a574a9dd219c81 (patch) | |
tree | 66a5df663bf46aa1df7c8cf174f10902ac06f1e1 /src/fpm_command_line.f90 | |
parent | 086ae55dfa09c1924d2b54bc88ddb1827f9dcfa7 (diff) | |
parent | 845217f13a23de91021ba393ef432d68683af282 (diff) | |
download | fpm-7e9c3390b04a0fc746812abd65a574a9dd219c81.tar.gz fpm-7e9c3390b04a0fc746812abd65a574a9dd219c81.zip |
Merge branch 'upstream_master' into backend-grace
Diffstat (limited to 'src/fpm_command_line.f90')
-rw-r--r-- | src/fpm_command_line.f90 | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90 index 9e9a572..f44bcd0 100644 --- a/src/fpm_command_line.f90 +++ b/src/fpm_command_line.f90 @@ -25,7 +25,7 @@ module fpm_command_line use fpm_environment, only : get_os_type, get_env, & OS_UNKNOWN, OS_LINUX, OS_MACOS, OS_WINDOWS, & - OS_CYGWIN, OS_SOLARIS, OS_FREEBSD + OS_CYGWIN, OS_SOLARIS, OS_FREEBSD, OS_OPENBSD use M_CLI2, only : set_args, lget, sget, unnamed, remaining, specified use fpm_strings, only : lower, split, fnv_1a use fpm_filesystem, only : basename, canon_path, to_fortran_name @@ -46,6 +46,7 @@ public :: fpm_cmd_settings, & get_command_line_settings type, abstract :: fpm_cmd_settings + character(len=:), allocatable :: working_dir logical :: verbose=.true. end type @@ -119,6 +120,7 @@ contains integer :: i integer :: widest type(fpm_install_settings), allocatable :: install_settings + character(len=:), allocatable :: common_args, working_dir call set_help() ! text for --version switch, @@ -129,6 +131,7 @@ contains case (OS_CYGWIN); os_type = "OS Type: Cygwin" case (OS_SOLARIS); os_type = "OS Type: Solaris" case (OS_FREEBSD); os_type = "OS Type: FreeBSD" + case (OS_OPENBSD); os_type = "OS Type: OpenBSD" case (OS_UNKNOWN); os_type = "OS Type: Unknown" case default ; os_type = "OS Type: UNKNOWN" end select @@ -147,12 +150,14 @@ contains if(adjustl(cmdarg(1:1)) .ne. '-')exit enddo + common_args = '--directory:C " " ' + ! now set subcommand-specific help text and process commandline ! arguments. Then call subcommand routine select case(trim(cmdarg)) case('run') - call set_args('& + call set_args(common_args //'& & --target " " & & --list F & & --all F & @@ -205,7 +210,7 @@ contains & verbose=lget('verbose') ) case('build') - call set_args( '& + call set_args(common_args // '& & --profile " " & & --list F & & --show-model F & @@ -227,7 +232,7 @@ contains & verbose=lget('verbose') ) case('new') - call set_args('& + call set_args(common_args // '& & --src F & & --lib F & & --app F & @@ -297,7 +302,7 @@ contains endif case('help','manual') - call set_args('& + call set_args(common_args // '& & --verbose F & & ',help_help,version_text) if(size(unnamed).lt.2)then @@ -345,7 +350,8 @@ contains call printhelp(help_text) case('install') - call set_args('--profile " " --no-rebuild F --verbose F --prefix " " & + call set_args(common_args // '& + & --profile " " --no-rebuild F --verbose F --prefix " " & & --list F & & --compiler "'//get_env('FPM_COMPILER','gfortran')//'" & & --flag:: " "& @@ -370,7 +376,7 @@ contains call move_alloc(install_settings, cmd_settings) case('list') - call set_args('& + call set_args(common_args // '& & --list F& & --verbose F& &', help_list, version_text) @@ -379,7 +385,7 @@ contains call printhelp(help_list_dash) endif case('test') - call set_args('& + call set_args(common_args // '& & --target " " & & --list F& & --profile " "& @@ -424,7 +430,7 @@ contains & verbose=lget('verbose') ) case('update') - call set_args('--fetch-only F --verbose F --clean F', & + call set_args(common_args // ' --fetch-only F --verbose F --clean F', & help_update, version_text) if( size(unnamed) .gt. 1 )then @@ -440,7 +446,7 @@ contains case default - call set_args('& + call set_args(common_args // '& & --list F& & --verbose F& &', help_fpm, version_text) @@ -461,6 +467,12 @@ contains call printhelp(help_text) end select + + if (allocated(cmd_settings)) then + working_dir = sget("directory") + call move_alloc(working_dir, cmd_settings%working_dir) + end if + contains subroutine check_build_vals() @@ -673,6 +685,8 @@ contains ' install [--profile PROF] [--flag FFLAGS] [--no-rebuild] [--prefix PATH] [options]', & ' ', & 'SUBCOMMAND OPTIONS ', & + ' -C, --directory PATH', & + ' Change working directory to PATH before running any command', & ' --profile PROF selects the compilation profile for the build.',& ' Currently available profiles are "release" for',& ' high optimization and "debug" for full debug options.',& |