Command-line interface: argument parsing and processing of files and directories.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public, | parameter | :: | EXIT_CHANGED | = | 1 |
with |
| integer, | public, | parameter | :: | EXIT_ERROR | = | 2 |
bad arguments, unreadable files or internal errors |
| integer, | public, | parameter | :: | EXIT_OK | = | 0 |
success |
| character(len=*), | public, | parameter | :: | VERSION | = | '1.0.3' |
Parsed command line.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | public | :: | check | = | .false. |
report files that would change; write nothing |
|
| character(len=:), | public, | allocatable | :: | config |
|
||
| logical, | public | :: | diff | = | .false. |
write a diff of the changes; write nothing else |
|
| type(string_t), | public, | allocatable | :: | exclude(:) |
|
||
| type(string_t), | public, | allocatable | :: | extensions(:) |
|
||
| logical, | public | :: | help | = | .false. |
show the |
|
| logical, | public | :: | no_config | = | .false. |
ignore configuration files |
|
| type(string_t), | public, | allocatable | :: | paths(:) |
files, directories, or |
||
| logical, | public | :: | quiet | = | .false. |
do not report warnings |
|
| type(setting_t), | public, | allocatable | :: | settings(:) |
formatting settings given on the command line, in order |
||
| logical, | public | :: | stdout | = | .false. |
write results to standard output |
|
| logical, | public | :: | version | = | .false. |
show the version and do nothing else |
True if string s ends with suffix.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | s |
the string, and the ending to look for |
||
| character(len=*), | intent(in) | :: | suffix |
the string, and the ending to look for |
Format file path in place (or write it to standard output, or report it with --check /
--diff), with the configuration of its directory, and return the exit status.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(cli_t), | intent(in) | :: | cli |
the parsed command line |
||
| type(config_cache_t), | intent(inout) | :: | cache |
configurations found so far |
||
| character(len=*), | intent(in) | :: | path |
the file, as given on the command line or found in a directory |
Format standard input to standard output (or report it with --check / --diff), with
the configuration of the current directory, and return the exit status.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(cli_t), | intent(in) | :: | cli |
the parsed command line |
||
| type(config_cache_t), | intent(inout) | :: | cache |
configurations found so far |
Format text from file name in directory dir, and write or report the result.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(cli_t), | intent(in) | :: | cli |
the parsed command line |
||
| type(config_cache_t), | intent(inout) | :: | cache |
configurations found so far |
||
| character(len=*), | intent(in) | :: | name |
the file, for messages and diff headers and to write
the result to; |
||
| character(len=*), | intent(in) | :: | dir |
the directory whose configuration applies |
||
| character(len=*), | intent(in) | :: | text |
the source as read |
||
| logical, | intent(in) | :: | to_stdout |
write the result to standard output instead of to |
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 |
The --help text.
The configuration that applies in directory dir (absolute).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(cli_t), | intent(in) | :: | cli |
the parsed command line ( |
||
| type(config_cache_t), | intent(inout) | :: | cache |
configurations found so far; |
||
| character(len=*), | intent(in) | :: | dir |
absolute path of the directory |
||
| type(config_t), | intent(out) | :: | cfg |
the configuration; |
||
| integer, | intent(out) | :: | stat |
nonzero if a configuration file cannot be read |
||
| character(len=:), | intent(out), | allocatable | :: | errmsg |
what is wrong, if |
The Fortran files under dir, selected with the [files] settings of its configuration and
the command line.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(cli_t), | intent(in) | :: | cli |
the parsed command line |
||
| type(config_cache_t), | intent(inout) | :: | cache |
configurations found so far |
||
| character(len=*), | intent(in) | :: | dir |
the directory, as given on the command line |
||
| type(string_t), | intent(out), | allocatable | :: | files(:) |
paths of the files found |
|
| integer, | intent(inout) | :: | status |
exit status so far; set to |
The options for a file in directory dir: defaults, then configuration, then command line.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(cli_t), | intent(in) | :: | cli |
the parsed command line |
||
| type(config_cache_t), | intent(inout) | :: | cache |
configurations found so far |
||
| character(len=*), | intent(in) | :: | dir |
the file's directory, relative or absolute |
||
| type(format_options_t), | intent(out) | :: | opts |
the options |
||
| integer, | intent(out) | :: | stat |
nonzero for an unreadable configuration or a bad setting |
||
| character(len=:), | intent(out), | allocatable | :: | errmsg |
what is wrong, if |
Parse command-line arguments (without the program name).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(string_t), | intent(in) | :: | args(:) |
the arguments, in order |
||
| type(cli_t), | intent(out) | :: | cli |
the parsed command line |
||
| integer, | intent(out) | :: | stat |
0, or |
||
| character(len=:), | intent(out), | allocatable | :: | errmsg |
what is wrong, if |