Skip to content

Commit 91c425e

Browse files
committed
Add verbose mode and --token TOKEN to --dry-run example
1 parent 0c860f2 commit 91c425e

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

src/fpm/cmd/publish.f90

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,7 @@ subroutine cmd_publish(settings)
7878
if (allocated(settings%token)) upload_data = [upload_data, string_t('upload_token="'//settings%token//'"')]
7979

8080
if (settings%show_upload_data) then
81-
do i = 1, size(upload_data)
82-
print *, upload_data(i)%s
83-
end do
84-
return
81+
call print_upload_data(upload_data); return
8582
end if
8683

8784
! Make sure a token is provided for publishing.
@@ -93,7 +90,13 @@ subroutine cmd_publish(settings)
9390
call delete_file(tmp_file); call fpm_stop(1, 'No token provided.')
9491
end if
9592

96-
! Perform network request and validate package on the backend as soon as
93+
if (settings%verbose) then
94+
print *, ''
95+
call print_upload_data(upload_data)
96+
print *, ''
97+
end if
98+
99+
! Perform network request and validate package, token etc. on the backend once
97100
! https://github.com/fortran-lang/registry/issues/41 is resolved.
98101
if (settings%is_dry_run) then
99102
print *, 'Dry run successful.'
@@ -106,4 +109,14 @@ subroutine cmd_publish(settings)
106109
call delete_file(tmp_file)
107110
if (allocated(error)) call fpm_stop(1, '*cmd_publish* Upload error: '//error%message)
108111
end
112+
113+
subroutine print_upload_data(upload_data)
114+
type(string_t), intent(in) :: upload_data(:)
115+
integer :: i
116+
117+
print *, 'Upload data:'
118+
do i = 1, size(upload_data)
119+
print *, upload_data(i)%s
120+
end do
121+
end
109122
end

src/fpm_command_line.f90

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ subroutine set_help()
758758
' [options] ', &
759759
' clean [--skip] [--all] ', &
760760
' publish [--token TOKEN] [--show-package-version] [--show-upload-data] ', &
761-
' [--dry-run] ', &
761+
' [--dry-run] [--verbose] ', &
762762
' ']
763763
help_usage=[character(len=80) :: &
764764
'' ]
@@ -883,7 +883,7 @@ subroutine set_help()
883883
' [options] ', &
884884
' clean [--skip] [--all] ', &
885885
' publish [--token TOKEN] [--show-package-version] [--show-upload-data] ', &
886-
' [--dry-run] ', &
886+
' [--dry-run] [--verbose] ', &
887887
' ', &
888888
'SUBCOMMAND OPTIONS ', &
889889
' -C, --directory PATH', &
@@ -1367,7 +1367,7 @@ subroutine set_help()
13671367
'', &
13681368
'SYNOPSIS', &
13691369
' fpm publish [--token TOKEN] [--show-package-version] [--show-upload-data]', &
1370-
' [--dry-run] ', &
1370+
' [--dry-run] [--verbose] ', &
13711371
'', &
13721372
' fpm publish --help|--version', &
13731373
'', &
@@ -1385,7 +1385,7 @@ subroutine set_help()
13851385
' But be aware that the upload is permanent. An uploaded package cannot be', &
13861386
' deleted.', &
13871387
'', &
1388-
' See documentation for more information regarding the package upload and usage:', &
1388+
' See documentation for more information regarding package upload and usage:', &
13891389
'', &
13901390
' Package upload:', &
13911391
' https://fpm.fortran-lang.org/en/spec/publish.html', &
@@ -1395,17 +1395,18 @@ subroutine set_help()
13951395
'', &
13961396
'OPTIONS', &
13971397
' --show-package-version show package version without publishing', &
1398-
' --show-upload-data show uploaded data without publishing', &
1399-
' --dry-run create tarball for revision without publishing', &
1398+
' --show-upload-data show upload data without publishing', &
1399+
' --dry-run perform dry run without publishing', &
14001400
' --help print this help and exit', &
14011401
' --version print program version information and exit', &
1402+
' --verbose print more information', &
14021403
'', &
14031404
'EXAMPLES', &
14041405
'', &
1405-
' fpm publish --show-package-version # show package version without publishing', &
1406-
' fpm publish --show-upload-data # show upload data without publishing', &
1407-
' fpm publish --dry-run # create tarball without publishing', &
1408-
' fpm publish --token TOKEN # upload package to the registry using TOKEN', &
1406+
' fpm publish --show-package-version # show package version without publishing', &
1407+
' fpm publish --show-upload-data # show upload data without publishing', &
1408+
' fpm publish --token TOKEN --dry-run # perform dry run without publishing', &
1409+
' fpm publish --token TOKEN # upload package to the registry', &
14091410
'' ]
14101411
end subroutine set_help
14111412

0 commit comments

Comments
 (0)