watch_cmdline Module

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().


Uses

    • fpm_environment
  • module~~watch_cmdline~~UsesGraph module~watch_cmdline watch_cmdline fpm_environment fpm_environment module~watch_cmdline->fpm_environment

Used by

  • module~~watch_cmdline~~UsedByGraph module~watch_cmdline watch_cmdline module~watch_cli watch_cli module~watch_cli->module~watch_cmdline module~watch_restart watch_restart module~watch_restart->module~watch_cmdline

Functions

public function get_arg(i) result(a)

Retrieve a command-line argument as an allocatable string.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: i

0-based/1-based index passed to get_command_argument.

Return Value character(len=:), allocatable

public function is_windows_os()

Return whether the current OS should be treated as Windows for quoting.

Arguments

None

Return Value logical

public function join_argv(i1, i2) result(s)

Join a range of argv entries into a single command-line string.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: i1

Inclusive range of argv indices to join.

integer, intent(in) :: i2

Inclusive range of argv indices to join.

Return Value character(len=:), allocatable

public pure function needs_quotes(a) result(q)

Determine whether an argument requires quoting for safe shell parsing.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: a

Return Value logical

public pure function parse_int(s, default) result(v)

Parse an integer with a default fallback on I/O error.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: s
integer, intent(in) :: default

Return Value integer

public pure function parse_real(s, default) result(v)

Parse a real with a default fallback on I/O error.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: s
real, intent(in) :: default

Return Value real

public function quote_arg(a) result(q)

Quote an argument for the host shell, escaping embedded quotes as needed.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: a

Return Value character(len=:), allocatable

public pure function starts_with(s, prefix) result(ok)

Check whether a string begins with a given prefix.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: s
character(len=*), intent(in) :: prefix

Return Value logical