@@ -105,9 +105,11 @@ module fpm_command_line
105
105
logical :: clean
106
106
end type
107
107
108
- type, extends(fpm_cmd_settings) :: fpm_clean_settings
109
- logical :: unix ! is the system os unix?
108
+ type, extends(fpm_cmd_settings) :: fpm_clean_settings
109
+ logical :: unix
110
110
character (len= :), allocatable :: calling_dir ! directory clean called from
111
+ logical :: clean_skip= .false.
112
+ logical :: clean_call= .false.
111
113
end type
112
114
113
115
character (len= :),allocatable :: name
@@ -543,10 +545,17 @@ subroutine get_command_line_settings(cmd_settings)
543
545
clean= lget(' clean' ))
544
546
545
547
case (' clean' )
546
- call set_args(common_args, help_clean)
548
+ call set_args(common_args // &
549
+ & ' --skip' // &
550
+ & ' --all' , &
551
+ help_install, version_text)
547
552
allocate (fpm_clean_settings :: cmd_settings)
548
553
call get_current_directory(working_dir, error)
549
- cmd_settings= fpm_clean_settings(unix= unix, calling_dir= working_dir)
554
+ cmd_settings= fpm_clean_settings( &
555
+ & unix= unix, &
556
+ & calling_dir= working_dir, &
557
+ & clean_skip= lget(' skip' ), &
558
+ clean_call= lget(' all' ))
550
559
551
560
case default
552
561
@@ -627,7 +636,7 @@ subroutine set_help()
627
636
' test Run the test programs ' , &
628
637
' update Update and manage project dependencies ' , &
629
638
' install Install project ' , &
630
- ' clean Delete the " build" directory ' , &
639
+ ' clean Delete the build ' , &
631
640
' ' , &
632
641
' Enter "fpm --list" for a brief list of subcommand options. Enter ' , &
633
642
' "fpm --help" or "fpm SUBCOMMAND --help" for detailed descriptions. ' , &
@@ -647,6 +656,7 @@ subroutine set_help()
647
656
' [--list] [--compiler COMPILER_NAME] [-- ARGS] ' , &
648
657
' install [--profile PROF] [--flag FFLAGS] [--no-rebuild] [--prefix PATH] ' , &
649
658
' [options] ' , &
659
+ ' clean [--skip] [--all] ' , &
650
660
' ' ]
651
661
help_usage= [character (len= 80 ) :: &
652
662
' ' ]
@@ -743,13 +753,14 @@ subroutine set_help()
743
753
' + build Compile the packages into the "build/" directory. ' , &
744
754
' + new Create a new Fortran package directory with sample files. ' , &
745
755
' + update Update the project dependencies. ' , &
746
- ' + run Run the local package binaries. defaults to all binaries ' , &
756
+ ' + run Run the local package binaries. Defaults to all binaries ' , &
747
757
' for that release. ' , &
748
758
' + test Run the tests. ' , &
749
759
' + help Alternate to the --help switch for displaying help text. ' , &
750
760
' + list Display brief descriptions of all subcommands. ' , &
751
- ' + install Install project ' , &
752
- ' + clean Delete the "build" directory ' , &
761
+ ' + install Install project. ' , &
762
+ ' + clean Delete directories in the build/ directory, except ' , &
763
+ ' dependencies. Prompts for confirmation to delete. ' , &
753
764
' ' , &
754
765
' Their syntax is ' , &
755
766
' ' , &
@@ -766,7 +777,7 @@ subroutine set_help()
766
777
' list [--list] ' , &
767
778
' install [--profile PROF] [--flag FFLAGS] [--no-rebuild] [--prefix PATH] ' , &
768
779
' [options] ' , &
769
- ' clean ' , &
780
+ ' clean [--skip] [-all] ' , &
770
781
' ' , &
771
782
' SUBCOMMAND OPTIONS ' , &
772
783
' -C, --directory PATH' , &
@@ -782,6 +793,10 @@ subroutine set_help()
782
793
' the fpm(1) command this shows a brief list of subcommands.' , &
783
794
' --runner CMD Provides a command to prefix program execution paths. ' , &
784
795
' -- ARGS Arguments to pass to executables. ' , &
796
+ ' --skip Delete directories in the build/ directory without ' , &
797
+ ' prompting, but skip dependencies. ' , &
798
+ ' --all Delete directories in the build/ directory without ' , &
799
+ ' prompting, including dependencies. ' , &
785
800
' ' , &
786
801
' VALID FOR ALL SUBCOMMANDS ' , &
787
802
' --help Show help text and exit ' , &
@@ -832,7 +847,7 @@ subroutine set_help()
832
847
' fpm new --help ' , &
833
848
' fpm run myprogram --profile release -- -x 10 -y 20 --title "my title" ' , &
834
849
' fpm install --prefix ~/.local ' , &
835
- ' fpm clean ' , &
850
+ ' fpm clean --all ' , &
836
851
' ' , &
837
852
' SEE ALSO ' , &
838
853
' ' , &
@@ -1022,8 +1037,8 @@ subroutine set_help()
1022
1037
' NAME ' , &
1023
1038
' new(1) - the fpm(1) subcommand to initialize a new project ' , &
1024
1039
' SYNOPSIS ' , &
1025
- ' fpm new NAME [[--lib|--src] [--app] [--test] [--example]]| ' , &
1026
- ' [--full|--bare][--backfill] ' , &
1040
+ ' fpm new NAME [[--lib|--src] [--app] [--test] [--example]]| ' , &
1041
+ ' [--full|--bare][--backfill] ' , &
1027
1042
' fpm new --help|--version ' , &
1028
1043
' ' , &
1029
1044
' DESCRIPTION ' , &
@@ -1245,16 +1260,18 @@ subroutine set_help()
1245
1260
' ' ]
1246
1261
help_clean= [character (len= 80 ) :: &
1247
1262
' NAME' , &
1248
- ' clean(1) - delete the " build" directory ' , &
1263
+ ' clean(1) - delete the build' , &
1249
1264
' ' , &
1250
1265
' SYNOPSIS' , &
1251
1266
' fpm clean' , &
1252
1267
' ' , &
1253
1268
' DESCRIPTION' , &
1254
- ' Prompts the user to confirm deletion of the "build" directory. If affirmative,' , &
1255
- ' the "build" directory in the project root is deleted using os system specific' , &
1256
- ' commands, forcing the recursive removal of all files and directories,' , &
1257
- ' including dependencies.' , &
1269
+ ' Prompts the user to confirm deletion of the build. If affirmative,' , &
1270
+ ' directories in the build/ directory are deleted, except dependencies.' , &
1271
+ ' ' , &
1272
+ ' OPTIONS' , &
1273
+ ' --skip delete the build without prompting but skip dependencies.' , &
1274
+ ' --all delete the build without prompting including dependencies.' , &
1258
1275
' ' ]
1259
1276
end subroutine set_help
1260
1277
0 commit comments