Format the paths of cli and return the exit status.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(cli_t), | intent(in) | :: | cli |
the parsed command line |
integer function run(cli) result(status) !! Format the paths of `cli` and return the exit status. type(cli_t), intent(in) :: cli !! the parsed command line type(config_cache_t) :: cache type(string_t), allocatable :: files(:) integer :: k, j if (cli%help) then write (output_unit, '(a)') usage() status = EXIT_OK return end if if (cli%version) then write (output_unit, '(a)') 'fformat '//VERSION status = EXIT_OK return end if allocate (cache%dirs(0), cache%configs(0)) status = EXIT_OK do k = 1, size(cli%paths) associate (path => cli%paths(k)%s) if (path == '-') then status = max(status, process_stdin(cli, cache)) else if (is_directory(path)) then call directory_files(cli, cache, path, files, status) do j = 1, size(files) status = max(status, process_file(cli, cache, files(j)%s)) end do else status = max(status, process_file(cli, cache, path)) end if end associate end do end function run