aboutsummaryrefslogtreecommitdiff
path: root/src/fpm_command_line.f90
diff options
context:
space:
mode:
authorJohn S. Urban <urbanjost@comcast.net>2021-06-01 01:35:23 -0400
committerJohn S. Urban <urbanjost@comcast.net>2021-06-01 01:35:23 -0400
commit75af0a2a395d55344af5be7a3934458fdd8465ea (patch)
tree73b9b2ca7b050931aae3bc4b70c648cb5331eba9 /src/fpm_command_line.f90
parent6d9004d93460dc15b99051c90d1b58d724b010e6 (diff)
downloadfpm-75af0a2a395d55344af5be7a3934458fdd8465ea.tar.gz
fpm-75af0a2a395d55344af5be7a3934458fdd8465ea.zip
alpha plugins, take III
Diffstat (limited to 'src/fpm_command_line.f90')
-rw-r--r--src/fpm_command_line.f9052
1 files changed, 27 insertions, 25 deletions
diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90
index 2a2ecf5..3f24dac 100644
--- a/src/fpm_command_line.f90
+++ b/src/fpm_command_line.f90
@@ -27,8 +27,10 @@ use fpm_environment, only : get_os_type, get_env, &
OS_UNKNOWN, OS_LINUX, OS_MACOS, OS_WINDOWS, &
OS_CYGWIN, OS_SOLARIS, OS_FREEBSD, OS_OPENBSD
use M_CLI2, only : set_args, lget, sget, unnamed, remaining, specified
+use M_CLI2, only : get_subcommand, CLI_RESPONSE_FILE
use fpm_strings, only : lower, split, fnv_1a
-use fpm_filesystem, only : basename, canon_path, to_fortran_name
+use fpm_filesystem, only : basename, canon_path, to_fortran_name, which
+use fpm_environment, only : run, get_command_arguments_quoted
use fpm_compiler, only : get_default_compile_flags
use,intrinsic :: iso_fortran_env, only : stdin=>input_unit, &
& stdout=>output_unit, &
@@ -142,11 +144,8 @@ contains
& os_type]
! find the subcommand name by looking for first word on command
! not starting with dash
- cmdarg=' '
- do i = 1, command_argument_count()
- call get_command_argument(i, cmdarg)
- if(adjustl(cmdarg(1:1)) .ne. '-')exit
- enddo
+ CLI_RESPONSE_FILE=.true.
+ cmdarg = get_subcommand()
! now set subcommand-specific help text and process commandline
! arguments. Then call subcommand routine
@@ -440,26 +439,29 @@ contains
clean=lget('clean'))
case default
-
- call set_args('&
- & --list F&
- & --verbose F&
- &', help_fpm, version_text)
- ! Note: will not get here if --version or --usage or --help
- ! is present on commandline
- help_text=help_usage
- if(lget('list'))then
- help_text=help_list_dash
- elseif(len_trim(cmdarg).eq.0)then
- write(stdout,'(*(a))')'Fortran Package Manager:'
- write(stdout,'(*(a))')' '
- call printhelp(help_list_nodash)
+ if(which('fpm-'//cmdarg).ne.'')then
+ call run('fpm-'//trim(cmdarg)//' '// get_command_arguments_quoted(),.false.)
else
- write(stderr,'(*(a))')'<ERROR> unknown subcommand [', &
- & trim(cmdarg), ']'
- call printhelp(help_list_dash)
+ call set_args('&
+ & --list F&
+ & --verbose F&
+ &', help_fpm, version_text)
+ ! Note: will not get here if --version or --usage or --help
+ ! is present on commandline
+ help_text=help_usage
+ if(lget('list'))then
+ help_text=help_list_dash
+ elseif(len_trim(cmdarg).eq.0)then
+ write(stdout,'(*(a))')'Fortran Package Manager:'
+ write(stdout,'(*(a))')' '
+ call printhelp(help_list_nodash)
+ else
+ write(stderr,'(*(a))')'<ERROR> unknown subcommand [', &
+ & trim(cmdarg), ']'
+ call printhelp(help_list_dash)
+ endif
+ call printhelp(help_text)
endif
- call printhelp(help_text)
end select
contains
@@ -655,7 +657,7 @@ contains
' + run Run the local package binaries. defaults to all binaries for ', &
' that release. ', &
' + test Run the tests. ', &
- ' + help Alternate method for displaying subcommand help. ', &
+ ' + help Alternate to the --help switch for displaying help text. ', &
' + list Display brief descriptions of all subcommands. ', &
' + install Install project ', &
' ', &