diff options
author | Laurence Kedward <laurence.kedward@bristol.ac.uk> | 2021-06-05 13:44:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-05 13:44:15 +0100 |
commit | 6fc695ffb7549444b36353c920aeb4f6820b14b8 (patch) | |
tree | cb17a4e6179cc59690a5404fed74e7491bbe4e59 /src/fpm_command_line.f90 | |
parent | 831ab078d07b2881c5d7fb4318185f3a06192722 (diff) | |
parent | 845217f13a23de91021ba393ef432d68683af282 (diff) | |
download | fpm-6fc695ffb7549444b36353c920aeb4f6820b14b8.tar.gz fpm-6fc695ffb7549444b36353c920aeb4f6820b14b8.zip |
Merge branch 'master' into master
Diffstat (limited to 'src/fpm_command_line.f90')
-rw-r--r-- | src/fpm_command_line.f90 | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90 index 931178a..d324b97 100644 --- a/src/fpm_command_line.f90 +++ b/src/fpm_command_line.f90 @@ -48,6 +48,7 @@ public :: fpm_cmd_settings, & get_command_line_settings type, abstract :: fpm_cmd_settings + character(len=:), allocatable :: working_dir logical :: verbose=.true. end type @@ -121,6 +122,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, @@ -147,12 +149,14 @@ contains CLI_RESPONSE_FILE=.true. cmdarg = get_subcommand() + 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 +209,7 @@ contains & verbose=lget('verbose') ) case('build') - call set_args( '& + call set_args(common_args // '& & --profile " " & & --list F & & --show-model F & @@ -227,7 +231,7 @@ contains & verbose=lget('verbose') ) case('new') - call set_args('& + call set_args(common_args // '& & --src F & & --lib F & & --app F & @@ -297,7 +301,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 +349,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 +375,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 +384,7 @@ contains call printhelp(help_list_dash) endif case('test') - call set_args('& + call set_args(common_args // '& & --target " " & & --list F& & --profile " "& @@ -424,7 +429,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 @@ -439,6 +444,7 @@ contains clean=lget('clean')) case default + if(which('fpm-'//cmdarg).ne.'')then call run('fpm-'//trim(cmdarg)//' '// get_command_arguments_quoted(),.false.) else @@ -464,6 +470,12 @@ contains endif 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() @@ -676,6 +688,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.',& |