fortrangoingonforty/fuss / eb6cf08

Browse files

switch default to interactive, add --print and -p to replace old default

Authored by espadonne
SHA
eb6cf08ba4cdff79abcbd0bab34c99253694292d
Parents
b68ff79
Tree
66d970e

1 changed file

StatusFile+-
M src/fuss_main.f90 11 2
src/fuss_main.f90modified
@@ -37,9 +37,11 @@ contains
3737
         logical, intent(out) :: show_all, interactive
3838
         integer :: i, nargs
3939
         character(len=256) :: arg
40
+        logical :: print_only
4041
 
4142
         show_all = .false.
42
-        interactive = .false.
43
+        interactive = .true.  ! Interactive is now the default
44
+        print_only = .false.
4345
         nargs = command_argument_count()
4446
 
4547
         do i = 1, nargs
@@ -54,12 +56,19 @@ contains
5456
                 show_all = .true.
5557
             else if (trim(arg) == '-i' .or. trim(arg) == '--interactive') then
5658
                 interactive = .true.
59
+            else if (trim(arg) == '-p' .or. trim(arg) == '--print') then
60
+                print_only = .true.
5761
             else
5862
                 print '(A)', 'Error: Unknown option: ' // trim(arg)
5963
                 print '(A)', 'Run ''fuss --help'' for usage information'
6064
                 stop 1
6165
             end if
6266
         end do
67
+
68
+        ! If print_only is set, disable interactive mode
69
+        if (print_only) then
70
+            interactive = .false.
71
+        end if
6372
     end subroutine parse_arguments
6473
 
6574
     subroutine print_version()
@@ -78,7 +87,7 @@ contains
7887
         print '(A)', 'OPTIONS:'
7988
         print '(A)', '  -h, --help       Show this'
8089
         print '(A)', '  -v, --version    Show version'
81
-        print '(A)', '  -i               Interactive mode (default)'
90
+        print '(A)', '  -p, --print      Print tree and exit (non-interactive)'
8291
         print '(A)', '  -a, --all        Show all files, not just dirty'
8392
         print '(A)', ''
8493
         print '(A)', 'KEYS:'