Command-line helpers.
Provides convenience wrappers around get_command_argument and a small
collection of parsing and quoting helpers used throughout fpm-watch.
Notes:
- Argument quoting here is intended for building a safe command string,
not for implementing a complete shell escaping library.
- Windows vs POSIX quoting behavior is handled via get_os_type().
Retrieve a command-line argument as an allocatable string.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | i |
0-based/1-based index passed to |
Return whether the current OS should be treated as Windows for quoting.
Join a range of argv entries into a single command-line string.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | i1 |
Inclusive range of argv indices to join. |
||
| integer, | intent(in) | :: | i2 |
Inclusive range of argv indices to join. |
Determine whether an argument requires quoting for safe shell parsing.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | a |
Parse an integer with a default fallback on I/O error.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | s | |||
| integer, | intent(in) | :: | default |
Parse a real with a default fallback on I/O error.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | s | |||
| real, | intent(in) | :: | default |
Quote an argument for the host shell, escaping embedded quotes as needed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | a |
Check whether a string begins with a given prefix.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | s | |||
| character(len=*), | intent(in) | :: | prefix |