watch_cli Module

Command-line parsing and configuration assembly.

This module: - Applies built-in defaults (set_watch_defaults), - Applies project-level overrides from fpm.toml (apply_watch_from_manifest), - Parses --watch-* options and fpm subcommand arguments, - Produces a watch_config_t that drives the watcher engine.

Parsing is deliberately simple and "argv-token based": it does not implement a full shell parser. The fpm_cmdline string is built for display and for execution via execute_command_line / fpm_filesystem:run.


Uses

  • module~~watch_cli~~UsesGraph module~watch_cli watch_cli face face module~watch_cli->face fpm_command_line fpm_command_line module~watch_cli->fpm_command_line fpm_strings fpm_strings module~watch_cli->fpm_strings iso_fortran_env iso_fortran_env module~watch_cli->iso_fortran_env module~watch_cmdline watch_cmdline module~watch_cli->module~watch_cmdline module~watch_config watch_config module~watch_cli->module~watch_config module~watch_types watch_types module~watch_cli->module~watch_types fpm_environment fpm_environment module~watch_cmdline->fpm_environment module~watch_config->fpm_strings module~watch_config->module~watch_types fpm_error fpm_error module~watch_config->fpm_error fpm_filesystem fpm_filesystem module~watch_config->fpm_filesystem fpm_toml fpm_toml module~watch_config->fpm_toml tomlf tomlf module~watch_config->tomlf module~watch_types->fpm_command_line module~watch_types->fpm_strings module~watch_types->iso_fortran_env

Functions

private pure function default_build_dir() result(dir)

Return the default build directory used by fpm-watch.

Arguments

None

Return Value character(len=:), allocatable

private pure function is_supported_subcmd(s) result(ok)

Return whether a given subcommand token is supported by fpm-watch.

Arguments

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

Return Value logical

private pure function is_watch_flag(a) result(ok)

Detect whether an argv token is a watcher-specific flag.

Read more…

Arguments

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

Return Value logical


Subroutines

public subroutine parse_cli_config(cfg)

Parse CLI arguments and build the full watcher configuration.

Read more…

Arguments

Type IntentOptional Attributes Name
type(watch_config_t), intent(out) :: cfg

private subroutine add_features_csv(features, csv)

Parse a comma-separated --features value into the features array.

Read more…

Arguments

Type IntentOptional Attributes Name
type(string_t), intent(inout), allocatable :: features(:)
character(len=*), intent(in) :: csv

private subroutine apply_watch_flag(a, i, narg, w)

Apply a single --watch-* flag to the watcher options.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: a
integer, intent(inout) :: i
integer, intent(in) :: narg
type(watch_opts_t), intent(inout) :: w

private subroutine init_build_settings(settings, build_dir, prune, profile, features, compiler_in, c_compiler_in, cxx_compiler_in, archiver_in, flag_in, cflag_in, cxxflag_in, ldflag_in)

Populate settings with parsed values and environment fallbacks.

Read more…

Arguments

Type IntentOptional Attributes Name
class(fpm_build_settings), intent(inout) :: settings
character(len=*), intent(in) :: build_dir
logical, intent(in) :: prune
character(len=*), intent(in) :: profile
type(string_t), intent(in), allocatable :: features(:)
character(len=*), intent(in) :: compiler_in
character(len=*), intent(in) :: c_compiler_in
character(len=*), intent(in) :: cxx_compiler_in
character(len=*), intent(in) :: archiver_in
character(len=*), intent(in) :: flag_in
character(len=*), intent(in) :: cflag_in
character(len=*), intent(in) :: cxxflag_in
character(len=*), intent(in) :: ldflag_in

private subroutine parse_cli(w, settings, fpm_cmdline, subcmd)

Parse the complete CLI and produce watcher options + typed fpm settings.

Read more…

Arguments

Type IntentOptional Attributes Name
type(watch_opts_t), intent(out) :: w
class(fpm_build_settings), intent(out), allocatable :: settings
character(len=:), intent(out), allocatable :: fpm_cmdline
character(len=:), intent(out), allocatable :: subcmd

private pure subroutine set_names(s, names)

Transfer collected name patterns into a run/test settings object.

Read more…

Arguments

Type IntentOptional Attributes Name
class(fpm_run_settings), intent(inout) :: s
type(string_t), intent(in), allocatable :: names(:)

private subroutine usage_and_stop(msg)

Print a usage message and terminate with a non-zero exit status.

Arguments

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

private subroutine usage_and_stop_ok()

Print a usage message and terminate successfully.

Arguments

None

private subroutine usage_print_only()

Print the fpm-watch help text.

Read more…

Arguments

None